.net

How can I implement this one line XAML programmatically in WPF code?

Hi, How can I implement this one line XAML programmatically in code? (as I'm needing to create the radio buttons on the fly, but what them to having bindings) <RadioButton IsChecked="{Binding Path=Mode, Converter={StaticResource enumBooleanConverter}, ConverterParameter=Proxy}">Proxy</RadioButton> I've got it to here (see below) so ...

What important difference exists between Monitor.TryEnter(object) And Monitor.TryEnter(object, ref bool)?

It seems that these code snippets ought to behave identically: 1: Monitor.TryEnter(object) if (Monitor.TryEnter(lockObject)) { try { DoSomething(); } finally { Monitor.Exit(lockObject); } } 2: Monitor.TryEnter(object, ref bool) - introduced in .NET 4.0 bool lockAcquired; try { Monitor.TryE...

C#: ArgumentException - XYZ.DLL does not contain any UserControl types

I have moved my development PC to another location, and without any changes to the source I now get the above exception. What could the be problem? I am using C# in VS2005. ...

Is it possible to achieve binary compatibility in .NET library?

I have a .NET library visible in COM, and it's called from a vb6 application. If I add some methods and release a new version (but don't erase or change signatures of existing methods), I would like being able to just install it in the production machine, and have it working. However, it seems that such approach doesn't work; I need to ...

Trace SQLite queries (.NET & NHibernate)

I'm using System.Data.SQLite with NHibernate & Fluent NHibernate. I encountered some strange bug and I would like to log all queries executed on the SQLite database. I already know about the ShowSQL NHibernate configuration option but I would like to log directly from SQLite. I found out about sqlite3_trace() but how to use it from .Ne...

Silverlight performance design tips

What's your top 3 Silverlight performance design tips? Thanks ...

The underlying connection was closed error

Is anyone familiar with this issue, I seem to get it every now and then in my web service client: The underlying connection was closed: An unexpected error occurred on a receive. Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. at System.Net.HttpWebRequest.GetRequestStr...

Does Linq to Entities throw SqlExceptions?

Hi! I'm using linq to entities, and my entity model is sitting on top of MSSQL database. I'm wondering if linq to entities throws SqlExceptions or not. In other words, will the below code catch exception successfully if there was a problem connecting to the database? If it doesn't, what's the best way to handle exceptions when using lin...

Programatically uninstall Windows Service from .NET

After searching the web for information, I have managed to create a service which, depending on the command line, can install or uninstall itself, or just run as an application. However, the uninstalling code isn't working correctly. The related code: Private Function UnInstallService(ByVal args As String(), ByRef errMsg As String) As...

ASP.NET - Trapping client disconnections on long running HTTP requests

Hi all, I have a long poll HTTP request using ASP.NET 4, MVC 2 and AsyncController. If a user closes their browser and kills the HTTP connection without the request completing, I'd like to know about it and completely clean up after them. If I don't, the open and incomplete requests just sit there and eventually IIS stops accepting new ...

Word Mail Merge for ASP.NET server

Need to do a mail merge for ASP.NET application. Considered just programatically using word directly but this has liscening implications and is not recommended (http://support.microsoft.com/kb/257757) So was looking into openXML / Word Automation Services. But not sure if can easily achieve a mail merge via this? ...

Loading web pages from msbuild

As the last step of my msbuild script I have to load a web page from the server I have just released and make sure it contains the correct version (it is enough to just check if the version is contained textually). What is the easiest way to do it in msbuild? ...

LinQ to collection a basic question.

This may be too simple.Please help. List<Line> listLines = new List<Line>(); foreach (Point p in currentPointsLines) { Line l = new Line(); l.Tag = p; l.X1 = AnotherList[(int)p.X].CenterX; //AnotherList is of type Rectangle l.Y1 = AnotherList[(int)p.X].CenterY; l.X...

2 dimensional array, calculating maximum value

Hey everyone, I'm trying to get the maximum value in a line in an 2d array. For example is this greyscale image. For me it's no problem to calculate the horizontal and vertical maximum grey value. However, I don't have a clue how to calculate an angled line (green line) from this 2d array. Anyone can help me out with this. ...

Serving Up Word Document From SIlverlight

I have a silverlight app. I want it to serve up a word document through it. The document will not exist anywhere physically, but will be coming into my silverlight app via a webservice call. Is this possible? ...

UIElement in layered fashion

Technology : Silverlight Platform : Windows Phone 7 foreach(Rectangle rec in listrect) { Layoutroot.Children.Add(rec); } Done some mouse move capture events and made these rectangles draggable. Each child element is added to the layout in some layered fashion I guess,where the first rectangle goes to the bottom layer next on top of th...

Invoking constructor throws ArrayTypeMismatchException exception

I generated a hierarchy of classes from a xsd set of files. Say the class, that contains instances of other classes is Place and the place has Address, Categories, Tags and so on. When trying to instantiate a new Tags object in a for loop, I get ArrayTypeMismatchException: Attempted to access an element as a type incompatible w...

Can DeflateStream or GZipStream be used to deflate an uncompressed file?

I'm trying to implement file compression to an application. The application has been around for a while, so it needs to be able to read uncompressed documents written by previous versions. I expected that DeflateStream would be able to process an uncompressed file, but for GZipStream I get the "The magic number in GZip header is not co...

Binding ObservableCollection<Foo> to ObservableCollection<object>

I have a collection ObservableCollection<Foo>, and I want to bind this to a property in a custom controller of type ObservableCollection<object>. However, the bound value never reaches the PropertyCallback, and is hence never set. Is there a clever way to achieve this binding? I could create an IValueConverter that converts from Observ...

Make an FxCop project output an XML file (it does not output anything useful) when run with fxcopcmd.exe

Hi! When not using an FxCop project, this works: "c:\Program Files\Microsoft FxCop 1.35\fxcopcmd.exe" /file:SiteSeeker.Core\bin\Release\SiteSeeker.Core.dll /file:SiteSeeker.CoreTest\bin\Release\SiteSeeker.CoreTest.dll /file:SiteSeeker.Example\bin\SiteSeeker.Example.dll /file:SiteSeeker.Web.WebForms\bin\Release\SiteSeeker.Web.WebForms.d...