.net-4.0

Set button content on button click trigger in xaml

戏子无情 提交于 2019-12-04 06:57:40
I would like to set button content using trigger in XAML without writing code behind: Every time button is clicked, content should be changed: Something like button clicked first time, button content = "Hi", Second time clicked, button content = "Bye", Third time clicked, button content = "Hi" again. <Button x:Name="btn" Content="Hi"> <Button.Triggers> <EventTrigger RoutedEvent="Button.Click"> <BeginStoryboard> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.Target="{x:Reference btn}" Storyboard.TargetProperty="Content"> <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Bye"/> <

SqlProfileProvider - can you use Profile.GetProfile() in a project?

99封情书 提交于 2019-12-04 06:48:55
问题 I am attempting to use the SqlProfileProvider in an application and can't seem to use it the way I want to. I would like to be able to simply call up a profile like this: Profile p = Profile.GetProfile("naspinski"); p.Organization = "new_org"; but I can't seem to find the correct way to use the GetProfile() that I seem to see scattered around the net. Is there a way to grab, read and modify profiles? I am using it in MVC 3 and will not be actually logging in as the specific user, this will be

OpenFileDialog.ShowDialog() throws an exception?

余生颓废 提交于 2019-12-04 06:42:26
问题 I am trying to show a dialog from one of my WPF view model commands however when i call ShowDialog() it throws a System.ArgumentException , I was wondering if anyone could give me a hint as to why? Here is my code: Public ReadOnly Property OpenParser As ICommand Get Return New RelayCommand(Sub(param As Object) OpenParserExecute(DirectCast(param, Frame))) End Get End Property Public Sub OpenParserExecute(ByVal mFrame As Frame) SaveParserExecute() Dim mOpenDialog As OpenFileDialog = OpenDialog

Can't add .NET 4.0 Assembly Reference In MonoDevelop 2.4.1

丶灬走出姿态 提交于 2019-12-04 06:42:13
I've installed MonoDevelop 2.4.1 With Mono 2.8.1. My trouble is that i can't add assembly reference to assembly compiled for .NET 4.0 (on same MonoDevelop IDE). What am i do. References -> Edit References -> .NET Assembly -> Browse to file & select it Than MD displays an error that an assembly that i'm trying to add isn't .NET assembly. I've set profile to .NET 4.0 everywhere. Reflector disassembles my assembly fine so it's ok. My OS is Windows 7 What's wrong? UPD: Posted a bug to Novell. Here it is https://bugzilla.novell.com/show_bug.cgi?id=659894 When i do "C:\Program Files\Mono-2.8.1\bin

Structuremap in Singleton returning multiple instances

淺唱寂寞╮ 提交于 2019-12-04 06:27:05
I have registered 5 derived classes for the same interface using named instances. All these classes are registered as Singleton For<IBaseInterface>().Singleton().Use<DerivedClass1>().Named("Derived1"); For<IBaseInterface>().Singleton().Use<DerivedClass2>().Named("Derived2"); For<IBaseInterface>().Singleton().Use<DerivedClass3>().Named("Derived3"); There is a static class which resolves the instance based on input. However I observed that every call to ObjectFactory.GetInstance returns new instances on every request instead of a Singleton. There are no threads in the application as well. Any

Request.UrlReferrer is NULL for HTTPS

喜夏-厌秋 提交于 2019-12-04 06:26:43
I am using "Request.UrlReferrer.AbsoluteUri" in my project to get the URL where my application is hosted. I am able to get the URL, if I am redirected from "http" host, but I am getting null, if I am redirected from "https" host. how can I get "UrlReferrer AbsoluteUri" of both "http and https"? Check the actual http data using a https-aware inspector like fiddler. Many browsers simply don't send the referrer when communicating over https, in which case there is simply no way to get it . If you own the origin site, you could add something into the query-string as a substitute, but that's about

Construct Task from WaitHandle.Wait

ぐ巨炮叔叔 提交于 2019-12-04 06:10:51
I chose to return Task<T> and Task from my objects methods to provide easy consumation by the gui. Some of the methods simply wait for mutex of other kind of waithandles . Is there a way to construct Task from WaitHandle.Wait() so that I don't have to block one treadpool thread for that. There is a way to do this: you can subscribe to WaitHandle using ThreadPool.RegisterWaitForSingleObject method and wrap it via TaskCompletionSource class: public static class WaitHandleEx { public static Task ToTask(this WaitHandle waitHandle) { var tcs = new TaskCompletionSource<object>(); // Registering

Force protobuf-net to ignore IEnumerable/ICollection interfaces

故事扮演 提交于 2019-12-04 06:06:48
How can I get v2 of protobuf-net to ignore the fact that my class implements ICollection, IEnumerable, etc? For this particular scenario, I only want the fields I have flagged as [ProtoMember] to be serialized. I am currently in the process of converting from using protobuf-net v1 to using v2. I have a particular structure which is now serializing incorrectly because of the change. It looks something like the following: [ProtoContract] public class FileTree : ICollection<FilePath>, IEnumerable<FilePath>, IEnumerable, INotifyCollectionChanged, INotifyPropertyChanged { private FileTreeNode _Root

Which Table/Grid Control in WPF?

馋奶兔 提交于 2019-12-04 06:05:53
I am looking to display tabular data (tv channels), but with options such as DataGrid/UniformGrid/Table with FlowDocument/etc. I cannot figure out what would be the best option. The main issues is that the cells aren't uniform in size as it varies based on length of time, and I would like to put padding between them as well. Additionally, I need to only be able to display a portion of the table, and allow them to scroll Up/Down/Right to view the rest. What would be the best WPF Control Option for this? Here is a small illustration of what I am going for. The white square in the upper left is

Why is the Json.NET Parser automatically localizing the dates it's parsing?

限于喜欢 提交于 2019-12-04 05:31:25
问题 I'm running into problems with the Json.NET Parser. According to the documentation, simply using ToString() with no special converters should leave the Json unaltered. My Json string, however, is getting modified is having its date automatically localized, and it's causing all sorts of problems for me. For example, when I feed it the following string: { "_type": "Basic", "id": "44902a0f-7842-3a2d-83bf-a874ce0b47a1", "description": "TestBasicDescription", "participation": 1.000000000000000,