.net

WPF MVVM Get Parent from VIEW MODEL

In a MVVM WPF application. How do you set a second windows parent from the ViewModel? example: view1 viewModel1 viewModel1's command calls: var view2 = new view2 view2.Owner = <----This is the problem area. How do I get view1 as the owner here from the viewModel? view2.Show() EDIT: See accepted answer below, then read the follo...

How to Synchronize Windows Service Access to SQL Server Database on Startup?

I have a WCF service that is running as a windows service. As soon as the WCF service starts it will try to connect to the DB and do some initialization processing. I'm having an issue when I restart my machine (the wcf service is set to start automatically), the service would get an exception as too sql is busy. So it seems like the s...

configure remote logon script

I have a c# code that connects remotely to a winServer2008 machine (with a local user of that machine). How do I configure via automated code the logon script that will be executed as soon as the connection is established ? ...

Convert UNIX timestamp to .NET DateTime ticks in unmanaged code (without using .NET)

I need to "construct" .NET DateTime values in Python/C++. How can I compute the number of ticks stored by DateTime starting from a UNIX timestamp? A solution involving Win32 API calls it's ok (I believe FILETIME functions could help). ...

How to deal with arrays of data in cookies

Hi all, I want to store data in a cookie and I am not exactly sure how I will go about it. The data is the UserName, and Password values for the users that are logging into a website, e.g. sometime like this UserName = bob, Password=Passw0rd1 UserName = harry, Password=BLANK UserName = george, Password=R0jjd6s What this means ...

Making a call to a .NET 4 library from 3.5

Hi, I have the need to make a call to the System.Xaml library in .NET 4.0. Is it possible to make a call to this library if your project is targeted to 3.5? ...

How to clear a cookie programatically?

Hi All, I am using silverlight unit tests to test an important part of our site. Is it possible to clear cookies before each unit test runs? The problem is that if I do this, HtmlPage.Document.Cookies = ""; It doesn't work. If the cookie already was this, key = value I can do this, HtmlPage.Document.Cookies = "key="; It kind o...

How to force a workflow to terminate?

How can i abruptly terminate a workflow in a middle of an activity interrupting the flow sequence? ...

why does vb.net not support multiple inheritance?

I've seen some discussion on why c# does not implement multiple inheritance but very little as to why it isn't supported in vb. I understand that both c# and vb are compiled down to intermediary language and so they both need to share similar restrictions. The lack of multiple inheritance in VB seems to have been given as one reason fo...

.NET: XDocument missing XDeclaration?

When I write out this to the console, the output is missing the XDeclaration content. What gives? var map = new XDocument( new XDeclaration("1.0", "UTF-8", null), new XElement(SiteMap.Namespace + "urlset") ); Console.Write(map.ToString()); How do I get the XML for map including the <?xm...

Is using YIELD a read-only way to return a collection?

I'm writing an interface which has a collection property which I want to be read only. I don't want users of the interface to be able to modify the collection. The typical suggestion I've found for creating a read only collection property is to set the type of the property to IEnumerable like this: private List<string> _mylist; public I...

ListView wont release focus in .NET CF 3.5

I have a form with a ComboBox and a ListView, when I press the down key on the Dpad focus moves from ComboBox to the items in the listView. But then I cant get out of the ListView and focus on the ComboBox again, I can only go up and down in the ListView items, how do I let the user go back to the ComboBox? ...

How do I store an array of a particular type into my settings file?

For some reason, I can't seem to store an array of my class into the settings. Here's the code: var newLink = new Link(); Properties.Settings.Default.Links = new ArrayList(); Properties.Settings.Default.Links.Add(newLink); Properties.Settings.Default.Save(); In my Settings.Designer.cs I...

put rich text box in .net

i want to put this control that i write this message in in .net is this rich text box and is this control has Databind ...

How do I make a serialization class for this?

I have something like this (sorry for the bad names) <?xml version="1.0" encoding="utf-8" ?> <root xmlns="http://www.domain.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.domain.com Schema.xsd"> <product></product> <SomeHighLevelElement> <anotherElment> ...

.NET platform web hosting

What should I do to host on my own machine a .NET web application(ASP.NET, Silverlight) with support Sql Server and services(RIA, WCF)? What should I install and configure so others can interact with my application via the internet ? It's some administration API which I can install on a PC and by which I can upload my app like in profe...

Visual Studio loading the right (x86 or x64) dll!

Hi, I'm working on visual studio in an x86. I would like to build my application for both x32 and x64. But i need to use the sqlite .net connector wich has a dll for x86 apps and another dll for x64 apps. How do i configure my visual studio to load a reference when my configuration is x64 and another when my configuration is x86? Thanks...

Windows 7 catch sleep/suspend messages

I'm wondering if it's possible to catch Windows 7 Sleep/Suspend Messages. http://stackoverflow.com/questions/727154/cant-catch-sleep-suspend-messages-winxp ...

What is the most basic class that inherits ICollection<T>

I need a generic collection class which I can add to, and enumerate over. Since ICollection<T> inherits from IEnumerable<T>, the class really just needs to inherit from ICollection<T>. Is there a simple generic class in the BCL that just inherits ICollection<T> like a generic version of CollectionBase? If not, then what class comes clo...

What's the reason both Image and Bitmap classes don't implement a custom equality/hashcode logic?

From MSDN documentation, it seems as both GetHashCode() and Equals() haven't been overriden in Bitmap. Neither have them been overriden in Image. So both classes are using the Object's version of them just compares references. I wasn't too convinced so I decided to fire up Reflector to check it out. It seems MSDN is correct in that matte...