.net-4.0

WPF Inner Glow Effect

[亡魂溺海] 提交于 2020-01-14 04:24:08
问题 Does anyone know how to make an Inner Glow effect in WPF without using expression blend or deprecated BitmapEffects? Sample image: For instance, here is some xaml for a button with an image and some text. I want this button to have an inner glow (not an outer glow): <Button Click="HandleDeleteRows" Style="{StaticResource ButtonCellStyle}"> <DockPanel> <Image Style="{StaticResource DeleteButtonImage}" /> <TextBlock Style="{StaticResource DeleteButtonCaption}" /> </DockPanel> </Button> 回答1:

DateTime supported language for formatting?

杀马特。学长 韩版系。学妹 提交于 2020-01-14 01:56:38
问题 DateTime let you format depending of the current culture. What are the culture supported by default? The scenario I have in mind use this.Date.Value.ToString("MMMM") which will print "January" if the culture is set to english-us but will print "Janvier" if the culture is in french-ca. This formatting documentation can be found at MSDN website but doesn't give the scope of culture this one can translate. I would like to know what languages are supported and if a language is not, what are my

DateTime supported language for formatting?

五迷三道 提交于 2020-01-14 01:56:08
问题 DateTime let you format depending of the current culture. What are the culture supported by default? The scenario I have in mind use this.Date.Value.ToString("MMMM") which will print "January" if the culture is set to english-us but will print "Janvier" if the culture is in french-ca. This formatting documentation can be found at MSDN website but doesn't give the scope of culture this one can translate. I would like to know what languages are supported and if a language is not, what are my

How to get the maximum outbound requests when parellellizing asynchronous calls?

让人想犯罪 __ 提交于 2020-01-14 01:45:09
问题 Analysing the code below in action through Fiddler, I realized that using Parallel Extensions I can get at maximum 2 outbound requests: new string[] { "http://stackoverflow.com", "http://superuser.com", "http://serverfault.com", "http://stackexchange.com" } .AsParallel() .Select(a => HttpWebRequest.Create(a).GetResponse()) .ToArray() ; What method should I use to maximize the number of outbound requests? 回答1: This code runs all 6 HTTP requests in parallel on my machine according to Wireshark:

CLR String References Don't (Always) Match

大城市里の小女人 提交于 2020-01-13 17:07:01
问题 From Richter and this discussion, I would expect any two "identical" strings to be the same reference. But just now in LINQPad I got mixed results on this topic. Here is the code: void Main() { string alpha = String.Format("Hello{0}", 5); string brava = String.Format("Hello{0}", 5); ReferenceEquals(alpha, brava).Dump(); String.IsInterned(alpha).Dump(); String.IsInterned(brava).Dump(); alpha = "hello"; brava = "hello"; ReferenceEquals(alpha, brava).Dump(); } And here are the results from the

CLR String References Don't (Always) Match

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-13 17:04:30
问题 From Richter and this discussion, I would expect any two "identical" strings to be the same reference. But just now in LINQPad I got mixed results on this topic. Here is the code: void Main() { string alpha = String.Format("Hello{0}", 5); string brava = String.Format("Hello{0}", 5); ReferenceEquals(alpha, brava).Dump(); String.IsInterned(alpha).Dump(); String.IsInterned(brava).Dump(); alpha = "hello"; brava = "hello"; ReferenceEquals(alpha, brava).Dump(); } And here are the results from the

How do I pass function delegates to be called with LINQ? [closed]

北城以北 提交于 2020-01-13 14:01:10
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 8 years ago . I think I'm asking the right question here... I have 4 stored procedures that return different subsets of the same data. I map this data to the same object in my server application. I've set my code up as follows

Using Task with Parallel.Foreach in .NET 4.0

人盡茶涼 提交于 2020-01-13 11:07:20
问题 I started off trying to add a progress bar to the windows form that updates the progress of code running within a Parallel.Foreach loop. In order to do this the UI thread has to be available to update the progress bar. I used a Task to run the Parallel.Foreach loop to allow the UI thread to update the progress bar. The work done within the Parallel.Foreach loop is rather intensive. After running the executables of the program(not debugging within visual studio) with the Task, the program

Is BackgroundWorker's IsBusy same as “IsAlive”?

人盡茶涼 提交于 2020-01-13 09:27:12
问题 I am trying to figure out a way to verify that a BackgroundWorker thread is alive (i.e. still running. The thread is essentially implemented as a simple infinite loop: while (AllConditionsMet()) { DoSomeMagic(); Thread.Sleep(10000); } The closest thing to IsAlive() I found so far is the IsBusy property, but given that my thread Sleep()s most of the time, I am not sure whether this will do the job. Can I count on IsBusy to do: if (!myWorker.IsBusy) RestartWorker(); or am I calling for trouble?

Move UIElement in Visual Tree without recalculating layout

↘锁芯ラ 提交于 2020-01-13 05:50:12
问题 We have a WPF application (.Net 4.0) using a Docking Control (Actipro). We can dock out the docking windows. In that case, a "real" Window is created and the content is assigned to that window. Of course, moving stuff in the Visual Tree will re-trigger the complete layouting . This is problematic, because in one of these docking windows, we have a diagramming control (Mindfusion Diagramming,WPF control) that can take up to 10 seconds to completely layout itself (very large diagrams). I don't