.net-3.5

Linq Fake/Mock context

Let say I got the following code in my SqlUserRepository : var user = from u in NHibernateLinqContext.Linq<User>() ... What I would like is to have a similar context for my FakeuserRepository var user = from u in FakeLinqContext.Linq<User>() ... Like that, I'll be able to use the same logic in my SqlUserRespository that my FakeUser...

Showing non-default fonts in .NET FontDialog

I'm using the standard .NET FontDialog to allows users to select fonts, but it's not showing all available fonts. For example, we have installed Helvetica and that's not showing. The Helvetica is a TTF if that makes a difference. Is there any way I can get it show all available fonts? Thanks in advance. P.S. I'm using .NET 3.5 ...

Interprocess Communication / Broadcast

I have a Windows Service (implemented in C#) and I have something like a service control manager. I would like to trace messages from the service to the service control manager (which is a window forms application), but I'm not sure what's the best way for doing this. The service should broadcast the messages to all clients who are listn...

How can I create a DataTemplate for a collection?

I would like to be able to create a DataTemplate to be used when a collection is passed into a control. I am building a single control, that when passed an object, or a collection of objects, the view of the user control conforms to the template defined for the object type. for example, this is a user control I have, that switches view...

How can I figure out an unknown error in an X509Chain?

I've got a program that calls web services at customer sites, and since the web service is provided by a third party it requires SSL and I can't do anything about it. In most cases when there is an error it's because there is a self-signed certificate, so I am checking X509Chain.ChainElements.ChainElementStatus for the UntrustedRoot err...

Is it a bad idea to use params [] in method signature

Consider the following class public class PlanetKrypton { public static void CallSuperManforHelp(string helpMessage, params object[] kryptonParams) { Console.WriteLine(String.Format(helpMessage,kryptonParams)); } public static void CallSuperManforHelp(string helpMessage ,string sender,string senderZipCode) { Console.Wr...

Windows Service And Thread Programming .NET

I have developed windows service to process files whose records will be stored in database. When windows service finds a file it creates a thread and assigns each file to one thread. I have not used Thread Pool. I wanted to know when windows service is stopped, then how to identify how many threads are running and whether they are comple...

Windows Forms Deployment

Hi, I'm writing a windows forms application to be sold to small to mid-size corporations and be used by users on a LAN. To make it easier for network administrators, I'm thinking of using .Net 3.5 SP1 and have the app running from a network share. This way, client installation is minimal (I know they must have .Net 3.5 SP1 installed). ...

Where is System.Windows.Threading.DispatcherTimer?

Gotta be getting close to a long weekend.... I'm trying to create a DispatchTimer. I found some sample code but can't run it due to a missing namespace. I have the namespace, System.Windows.Threading, but in which assembly can I find it? I tried System, System.Windows... nada. Thanks! ...

Which namespace is the most underutilized, yet must-know for devs?

Which of the .NET 3.5 namespaces is the most underutilized yet contains some of the classes and methods considered "must-know" for every .NET developer? ...

MS pie chart with 2 querys

i have two queries which give two different values One query gives the freespace select sum(freesize) as freespace from freespace the next query gives totalspace select sum(NumRegions) as totalspace from fileidtofilename then usedspace= totalspace- freespace Now i want to display the usedspace region and freespace region in the p...

How to compress JavaScript and CSS using gzip compression in Asp .Net 3.5 web application?

How to compress JavaScript and CSS using gzip compression in Asp .Net 3.5 web application? Gzip compression results error in CSS menu and validators scripts. ...

Serial Port and ObjectDisposedException Safe Handle has been closed

I am receiving data from a device that's sending information over the serial port and I get this exception: "ObjectDisposedException Safe Handle has been closed". It may happen within seconds to several minutes and there doesn't seem to be a pattern. Another thing that happens is that it will stop receiving data with no exception and I...

Given 3 pts, how do I calculate the normal vector?

Given three 3D points (A,B, & C) how do I calculate the normal vector? The three points define a plane and I want the vector perpendicular to this plane. Can I get sample C# code that demonstrates this? ...

Is an IQueryable a query or just an object which can be queried?

I'm kinda confused what the IQueryable interface actually represents. The MSDN documentation for IQueryable says: "Provides functionality to evaluate queries against a specific data source." The documentation for IQueryProvider says: "Defines methods to create and execute queries that are described by an IQueryable object." The name a...

embeddable navigation engine for windows mobile

Hi, I've been working on an order management system for some time, about 1.5 years. It's written in .NET so I use .NET Compact Framework 3.5. All this time I tried different brands and versions of navigation software. In Windows Mobile (both Windows CE and Mobile) I had some problems managing 2 softwares, our application and the navigat...

String concatenation with or without .ToString()?

I have a statement where a string is assigned in the following manner: for(int i = 0; i < x; i++) { Foo.MyStringProperty = "Bar_" + i.ToString(); [...] } Are there any performance differences between i.ToString() or just plain i, as both are just converted to the (culture invariant?) string equivalent? nb. I am well aware of the ...

NAnt not running NUnit tests

I'm using NUnit 2.5 and NAnt 0.85 to compile a .NET 3.5 library. Because NAnt 0.85 doesn't support .NET 3.5 out of the box, I've added an entry for the 3.5 framework to NAnt.exe.config. 'MyLibrary' builds, but when I hit the "test" target to execute the NUnit tests, none of them seem to run. [nunit2] Tests run: 0, Failures: 0, Not run:...

.NET / Silverlight: DataContractSerializer Byte Array and Sockets: Unexpected EOF deserializing.

Hello I am currently using sockets to try and send messages between a Silverlight 3 client and a .NET3.5 service. I can set up the TCP connection fine, and send data across, but my issue comes with serialising and deserialising DataContracts. Currently we are using WCF PollingDuplex binding to do this work, but we are not happy with i...

Listview with objectdatasource Delete not working

Hello, i have one Listview in my Usercontrol & 1 objectdatasource binded with the ListView. now in objectdatasource's Deletemethod i have taken businessobject as argument but at runtime i am not getting value in my businessobject's properties... i also tried to use "Bind" instead of "eval" in ItemTemplate. but not getting any value at ...