.net-4.5

HorizontalScroll.Value won't programmatically set

前提是你 提交于 2019-12-12 16:04:52
问题 I have a Panel with scrollbars, and I frequently want to programmatically scroll a control into view. For reasons that don't bear mentioning I need my own methods. Frequently when I try to set MyPanel.HorizontalScroll.Value = newScrollValue; the value simply won't take . I can check MyPanel.HorizontalScroll.Value immediately after the set, and its value is unchanged. The values that I'm trying to set are definitely within the Minimum and Maximum range. Now here's the worst part. I found out

String.Split is not removing the split text, only the first letter

风流意气都作罢 提交于 2019-12-12 15:55:43
问题 What's going on here? issue.CallAction has the following value: "Blah blah - WebSite - 9/20/2017 - Containers remaining changed to 0." Splitting on it, like so: issue.CallAction.Split("Containers remaining changed to ").ToList() returns more than 1 string element (as expected in this case) but the elements are: Blah blah - WebSite - 9/20/2017 - ontainers remaining changed to 0. It was my understanding that Split replaces the entire string that you're splitting yet it's only replacing the

Split audio file into pieces

天大地大妈咪最大 提交于 2019-12-12 15:32:27
问题 I´m trying to split an audio file in some pieces. The fact is: I have a byte array and I would like do split the wav file into some random pieces (3 for example). Of course, I know that I can´t do something like this. But does anyone have an idea on how to do it? byte[] result = stream.ToArray(); byte[] testing = new byte[44]; for (int ix = 0; ix < testing.Length; ix++) { testing[ix] = result[ix]; } System.IO.File.WriteAllBytes("yourfilepath_" + System.Guid.NewGuid() + ".wav", testing); I

C# async awaitable clarification?

人走茶凉 提交于 2019-12-12 15:16:01
问题 I've read here that : Await examines that awaitable to see if it has already completed; if the awaitable has already completed, then the method just continues running (synchronously, just like a regular method). What ? Of course it won't be completed because it hasn't even started ! example : public async Task DoSomethingAsync() { await DoSomething(); } Here await examines the awaitable to see if it has already completed (according to the article) , but it (DoSomething) haven't event started

.Net Framework issue with RTZ2 time zone

僤鯓⒐⒋嵵緔 提交于 2019-12-12 14:01:01
问题 It seems we have found an issue with RTZ2 timezone (Russian Standard Time) in .Net Framework 4.5. If you try to convert time between 2014-01-01 00:00:00 and 2014-01-01 00:59:59 (in RTZ2 timezone) to UTC, you get an error: The supplied DateTime represents an invalid time. For example, when the clock is adjusted forward, any time in the period that is skipped is invalid. Example (https://dotnetfiddle.net/rNbp8F): var rtz2 = TimeZoneInfo.FindSystemTimeZoneById("Russian Standard Time"); var

AccessViolationException goes away when native code debugging is enabled

不羁的心 提交于 2019-12-12 12:09:44
问题 I get an AccessViolationException when I run the Google Drive API sample in Visual Studio 2012 on Windows 7 x64. My project is targeting .Net 4.5. I get the exception on line 185: await service.Files.Delete(file.Id).ExecuteAsync(); It happens in both Debug and Release modes, and in all platforms (x86, x64, AnyCPU). It does NOT happen when I run without the debugger attached ("Start without Debugging"). It does NOT happen when I enable the "Enable native code debugging" in the Project

What is RFC-compliant URI

让人想犯罪 __ 提交于 2019-12-12 11:16:37
问题 While going through features of .NET framework 4.5, I found that it supports RFC-compliant URIs. What does it mean to have RFC-compliant URI support? 回答1: RFC is a set of internet standards that define various aspects of internet protocols - in your case the standard format of an URI. You can find the relevant standard here: http://www.ietf.org/rfc/rfc2396.txt RFC 2396 defines explicitly what are the parts that make up an URI (for example the scheme, authority, path etc.) and what are the

.NET 4.5 HttpClient request ServicePoint

折月煮酒 提交于 2019-12-12 10:57:09
问题 I have always used so far: HttpWebRequest request = (HttpWebRequest)WebRequest.Create(targetUri); do the request ................. request.ServicePoint. Now I would like to use the new HttpClient from .net 4.5 and I don't know how to access the ServicePoint properties. Any ideas how can I access the ServicePoint by using HttpClient? 回答1: I believe you will have to use the ServicePointManager to do what you want. Something like; ServicePointManager.FindServicePoint(targetUri) 来源: https:/

MediaCapture Windows 8 Desktop - Photo is Dark

回眸只為那壹抹淺笑 提交于 2019-12-12 10:09:11
问题 I am attempting to use the MediaCapture API within a Windows 8 Desktop Application (WinForms .NET 4.5). I am able to take the photo using the API, but the photo comes out very dark. Also, it does not appear that the MediaCapture API is triggering the camera flash automatically as it should. I have tried to set the Brightness, Contracts, WhiteBalance and exposure to automatic per MSDN documentation. Here is the relevant code. _mediaCapture = new MediaCapture(); // init the settings of the

Displaying a picture stored in Storage file in a metroapp

孤人 提交于 2019-12-12 09:52:47
问题 I would like to display the content of a picture stored in a StorageFile through a binding, but whatever I'm trying to do it doesn't seem to work. Here are the two solutions I have already tested : string img =( await CompetencesFolder.GetFileAsync(FormatImageNameToFileName(imageName))).Path; And then returning the path obtained (a full absolute path to the file) to the source Property through binding, and : BitmapImage img = await LoadImage(await CompetencesFolder.GetFileAsync