.net

Separation of GUI and logic in different threads in a Windows Form application

In a Windows Forms application I want to separate the GUI from the logic. The user requests are complex and involve communications so I don't want it to depend on the GUI thread. The structure should be something like: GUI -----> splash screen ---------> User Form --------------> ... | # ...

How can I digitally sign an email in .NET?

I'm looking for best way to send digitally signed email from .NET code. What I found so far are commercial mail components. I don't have a problem with buying those, I would just like to be sure I'm spending my money well. Any suggestions? ...

compare entities before update in Nhibernate (audit implementation )

Hi, I need to log in to database every user update on any record and need to store old and new value of any record which was changed. This audit is implemented as interceptor in nhibernate so i have method: public override bool OnFlushDirty( object entity, object id, object[] currentState, ...

Where to get NCover from?

Hi - I realise NCover has gone commercial. I am looking for teh free version. Where do i get the latest free version of NCover? The NCover website only talks about a trial version of the commercial product, not the free version. ...

Checking for a null DataRow

How would I check for a null datetime value in a DataRow? The following works with a dataReader. calEventDTO.endTime = dr.IsDBNull(9) ? null : (DateTime?) dr.GetDateTime(9); What is the equivalent when checking the following DataRow? calEventDTO.endTime = (DateTime)row["endTime"]; Sorry for the very newbee question. ...

C# How to set a specific cell style for a complete row without constantly changing the DefaultCellStyle

I have a list of objects (of type 'TrackedSet') that is data bound to a DataGridView. When a new row is added, I want to be able to change the row appearance based on a property of the data bound object. I can paint a custom background of the row in the RowPrePaint event, but I'm struggling to change the forecolor for the row. From the...

What's a good way of converting 1 or 0 to a boolean value?

I have a database with where boolean values are stored as bits (1 for true, 0 for false). What's the best way of converting these into .Net boolean values from a DataRow? Convert.ToBoolean doesn't seem to work. ...

XML serialization of interface property

I would like to XML serialize an object that has (among other) a property of type IModelObject (which is an interface). public class Example { public IModelObject Model { get; set; } } When I try to serialize an object of this class, I receive the following error: "Cannot serialize member Example.Model of type Example because it...

How to notify my JS client without polling?

Context: From my javascript web UI, I launch a long-running (several minutes) operation that is conducted on the .NET2.0 backend. The call returns immediately with operation ID while the long-running operation run parallel. The operations are not CPU intensive, but conduct slow network calls. Once the operation is completed, I want to se...

Two way communication with WCF - Should I use callbacks, or simply use two channels?

Hi, I'm trying to decide what is the most most appropriate way of handling full duplex communication between two .Net processes running on the same server or on a LAN. We have two processes that need to be able to invoke methods on each-other. Currently, we are using WCF with NamedPipe or Tcp channels, and have ProcessA register with ...

Good .NET college project topic?

I am an M.Sc. Computer Science 2nd year student. I need to do a project for my college work. I have working experince with Java, databases, J2ME etc. I have satisfacotry knowledge of .NET but I have not done any projects with it. Please suggest a good topic with .NET or J2ME that will be of post-graduation level. ...

A strange exception on WF when using SqlWorkflowPersistenceService & SqlTrackingService

I'm running a workflow runtime that contains an SqlWorkflowPersistenceService & SqlTrackingService (with IsTransactional = true) WorkflowInstance workflowInstance = _workflowRuntime.CreateWorkflow(workflowType); workflowInstance.Start(); // Assure persistence workflowInstance.Unload(); // Error occur here workflowInstance.Load(); Th...

Debugging ClickOnce deployment functions

I'm deploying a C# .NET application using ClickOnce and I have written code to update the application programatically (not using the option in the publish settings of the project). However I want to test the functionality of this code before deploying (for obvious reasons). How do I do this? The code has a check to see if the applicatio...

How to change default audio input device programatically

I am looking for a way to set/change default input device inside my application. I have several different recording devices and it is very anoying to go into the control panel and change default recording device. I was looking around and I did not find anything that could help me with the problem. Application is written in c# and it is t...

.NET: switch vs dictionary for string keys

I've got a situation where I have a business object with about 15 properties of different types. The business object also has to implement an interface which has the following method: object GetFieldValue(string FieldName); I can see 2 ways of implementing this method: Use a switch statement: switch ( FieldName ) { case "Field1"...

Range of floating point numbers in .NET?

Excerpt from a book: A float value consists of a 24-bit signed mantissa and an 8-bit signed exponent. The precision is approximately seven decimal digits. Values range from -3.402823 × 10^38 to 3.402823 × 10^38 How to calculate this range? Can someone explain the binary arithmetic? ...

Upload a file referenced via URL

I have url that point to image for example : http://cg009.k12.sd.us/images/smilefacemoving.gif instead of user will insert file i want to bind this file(image) to the c# fileupload control . so the fileupload object will hold this file(image). ...

Passing page's server controls as parameter in custom user control

Hi , I want to pass the page's server controls(especially gridviews,datalists,repeaters) as parameter to my custom server control. My purpose is to make a html to pdf export button as a custom server control.Programmer will add the my custom control to a page and select the control from the usercontrol properties which he/she wants to ma...

VB.NET and LINQ. What am I missing here?

I'm trying to get this sitemap class working. It appears to use LINQ, which I've never used, but half the fun of programming is learning new stuff! My problem is that I'm getting compile errors where the LINQ code is. VS just doesn't recognize it. I've a reference to system.data.linq, I've an imports system.data.linq, but still where...

How to detect since when a user is logged into the system with .NET (C#)?

I need to detect the logged on time of a user connected to the server by remote desktop or console in C#. I was trying to search a property in the WMI classes but I did not find any. Thanks again in advance! ...