.net-4.0

How to run a progress bar in different thread in WPF?

跟風遠走 提交于 2019-12-04 02:29:47
问题 I am populating the list view items dynamically. At the same time I wanna display a progress bar. When data populated the progress bar should be disabled. How to achieve this. I am new in WPF. 回答1: You can use the BackgroundWorker class, which simplifies the handling of background threads when you are working with WPF. There are plenty of examples on the web for this. Here two from codeproject, but it's easy to find more examples: http://www.codeproject.com/Tips/83317/BackgroundWorker-and

WCF Exists and partially working but for some calls returns “no endpoint listening - (404) Not Found.”

ε祈祈猫儿з 提交于 2019-12-04 02:22:25
We have service that's working with small to large sets of data (document generation), and it's working fine for some calls, but for some specific requests (exact same method, different arguments) it just returns: System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at http://localhost:8010/MyService/MyService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. ---> System.Net.WebException: The remote server returned an error: (404) Not Found. Note that the service is working

Exception when specifying defaultProxy in app.config when running NET4.0 application from network share

妖精的绣舞 提交于 2019-12-04 02:19:59
We're seeing a very strange issue when running the following application from a network share under NET4.0. When specifying a defaultProxy section in app.config a System.Net.WebException is thrown. There is no problem when running from a local drive. According to documentation applications will run as full-trust assemblies from a network share so we're assuming this should work just fine. Any ideas how we can work around this problem? Has anyone else experienced this issue or does anyone know why this might be happening? Sample program using System; using System.Net; namespace ProxyTest {

Entity Framework 5 - Enum based Discriminator for derived classes

人走茶凉 提交于 2019-12-04 02:14:39
I have the following (abbreviated for clarity) - an enum, a base class with that enum, and two derived classes that set the enum to a specific value. public enum MyEnum { Value1, Value2 } public class MyBaseClass { public MyEnum { get; protected set; } } public class DerivedOne: MyBaseClass { public DerivedOne { MyEnum = MyEnum.Value1; } } public class DerivedTwo: MyBaseClass { public DerivedTwo { MyEnum = MyEnum.Value2; } } What I want to do, is have Entity Framework 5 automatically distinguish between DerivedOne and DerivedTwo, with a MyEnum value based discriminator . I should be able to do

Is Parallel.ForEach in ConcurrentBag<T> thread safe

左心房为你撑大大i 提交于 2019-12-04 02:10:12
Description of ConcurrentBag on MSDN is not clear: Bags are useful for storing objects when ordering doesn't matter, and unlike sets, bags support duplicates. ConcurrentBag is a thread-safe bag implementation, optimized for scenarios where the same thread will be both producing and consuming data stored in the bag. My question is it thread safe and if this is a good practice to use ConcurrentBag in Parallel.ForEach. For Instance: private List<XYZ> MyMethod(List<MyData> myData) { var data = new ConcurrentBag<XYZ>(); Parallel.ForEach(myData, item => { // Some data manipulation data.Add(new XYZ(/

Difference between MouseClick and DoubleClick

喜夏-厌秋 提交于 2019-12-04 01:56:47
问题 WPF, Shapes I have a custom Shape , and try to implement MouseClick and MouseDoubleClick stuff on it. By eg. I need to open a information window about MyShape OnClick and select it OnDoubleClick. The stub is the following: public class MyShape : Shape { public Point Point1, Point2; public MyShape() : base() { } protected override Geometry DefiningGeometry { get { return new LineGeometry(Point1, Point2); } } protected override void OnMouseUp(MouseButtonEventArgs e) { base.OnMouseUp(e); if (e

How to check if a generic parameter is dynamic in .NET 4.0

百般思念 提交于 2019-12-04 01:46:27
I have a class ObjectMapper<T> . Is there any way in .NET 4.0 to tell if typeof(T) is dynamic ? I want to be able to determine inside a member method whether the class was initialized as new ObjectMapper<dynamic>() vs. new ObjectMapper<SomeConcreteClass>() . You do this by checking if an instance is of type IDynamicMetaObjectProvider or you can check whether the type implements IDynamicMetaObjectProvider . There is no CLR type called dynamic . The C# compiler makes all dynamic values of type object and then calls custom binding code to figure out how to handle them. If dynamic was used, it

Elmah, convert to .Net4 vs2010, run on server 2008, does not work

拟墨画扇 提交于 2019-12-04 01:42:56
问题 So I've been using elmeh forever. I've got an app I've recently converted to MVC3 .net4, and vs2010, and it's developed on a server 2008 box (as opposed to my other apps developed on an XP box). I set up elmah normally and it does not work... I've got a reference to ELMAH.dll already, it's in my CommonDLLs folder. I add the sectiongroups <sectionGroup name="elmah"> <section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" /> <section name="errorLog"

MVC Mini Profiler includes not respecting application's path

只愿长相守 提交于 2019-12-04 01:41:55
I've got the MVC Mini Profiler set up as described on its project page , and the includes are indeed being written on the page. Problem is, my application sits at http://localhost:8080/web , and the markup written by the profiler includes looks like this: <link rel="stylesheet/less" type="text/css" href="/mini-profiler-includes.less?v=2.0.4177.17902"> <script type="text/javascript" src="/mini-profiler-includes.js?v=2.0.4177.17902"></script> <script type="text/javascript"> jQuery(function() { MiniProfiler.init({ id:'fb4dc30e-c1aa-4be6-902c-ef2812dd1fe2', renderDirection:'left' }); } ); </script

Regular expression that matches all valid format IPv6 addresses

ぃ、小莉子 提交于 2019-12-04 01:37:05
At first glance, I concede that this question looks like a duplicate of this question and any other related to it: Regular expression that matches valid IPv6 addresses That question in fact has an answer that nearly answers my question, but not fully. The code from that question which I have issues with, yet had the most success with, is as shown below: private string RemoveIPv6(string sInput) { string pattern = @"(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4