.net

C#/Mono Run Server in Background

Hello, I created a Server that listens for HTTP connections all the time. It's a default Console Application and runs on a Linux Machine using Mono (2.4). The Problem is that i want this Server to move itself to the background (deamonize itself). I couldn't find a Solution on Google and mono Server.exe & is not really what i'm looking f...

How can I tell when a screen's WorkingArea changes (i.e. task bar is moved)?

I have some windows docked to edges/corners of the working area, and I need to know if/when the WorkingArea of the screen changes so I can update the position of those windows. I've attempted to tackle this before to no avail, as I recall. ...

Encapsulating a Windows.Forms.Button

I want to define a special kind of button that only allows two possible labels: "ON" and "OFF". I decided to inherit from a Windows.Forms.Button to implement this but now I don't know I how should enforce this rule. Should I just override the Text property like this? public override string Text { set { throw new InvalidO...

Nested Transaction issues within custom Windows Service

I have a custom Windows Service I recently upgraded to use TransactionScope for nested transactions. It worked fine locally on my old dev machine (XP sp3) and on a test server (Server 2003). However, it fails on my new Windows 7 machine as well as on 2008 Server. It was targeting 2.0 framework; I tried targeting 3.5 instead, but it still...

WinForms: Alternative to SplitContainer?

Are there any alternative controls someone can suggest to replace the WinForms SplitContainer? I don't like how the SplitContainer shows that weird, dotted strip when its selected and when its being dragged. I want to have the panels re-size as the user drags instead of on mouse up and not show any dotted strips when the splitter is bei...

Qt as a true multi-platform dev-env

Inspired by the maturity problems I am facing porting on Mono Mac & Linux. I am investigating the use of Qt as an alternative. I am curious to hear about your favorite Qt experiences, tips or lesser known but useful features you know of. Please, include only one experience per answer. ...

Aldon and .Net Development

I'm looking for feedback from .Net developers who have experience with Aldon as a lifecycle management platform. We're seriously considering using Aldon for lifecycle management including source control, automated builds, etc. I know there are a lot of other options out there, but ours is primary an AS/400 shop (with AS/400 programmers...

detect last record in ADO.Recordset?

If I am looping through an ADO.Recordset (with while not recordSet.EOF), is there a way to detect that I'm on the last record? ...

how to call PHP api from C# (simple examle)

So I need a wary bacik interaction example of C# client using some PHP API (A remote service being called from a C# app). I want to see a simple php API conteining 2 methos sum(a, b):c and echo(string):string and a simple C# client able to use that methods. How to do such thing? ...

Windows Forms Autosizing in .NET

My C# project contains a form. There are some controls across the top of the form and some controls across the bottom of the form, as well as a FlowLayoutPanel in the center, all of which have been placed with the Visual Studio Form Designer. During runtime, controls are dynamically added to and removed from the FlowLayoutPanel, and b...

FluentNHibernate Auto Mappings and ISet in .NET 4.0

How to set up auto mapping to map System.Collections.Generics.ISet<T> correctly? I tried implementing IHasManyConvention, but in intellisense it seems that IOneToManyCollectionInstance does not have anything for that(?) ...

How to stop .Net HttpWebRequest.GetResponse() raising an exception

Surely, surely, surely there is a way to configure the .Net HttpWebRequest object so that it does not raise an exception when HttpWebRequest.GetResponse() is called and any 300 or 400 status codes are returned? Jon Skeet does not think so, so I almost dare not even ask, but I find it hard to believe there is no way around this. 300 and ...

C# .NET: Descending comparison of a SortedDictionary?

I'm want a IDictionary<float, foo> that returns the larges values of the key first. private IDictionary<float, foo> layers = new SortedDictionary<float, foo>(new DescendingComparer<float>()); class DescendingComparer<T> : IComparer<T> where T : IComparable<T> { public int Compare(T x, T y) { return -y.CompareTo(x); ...

Is thread-safe to use the 'yield' operator inside an extension method'?

Would be thread-safe to use the yield operator inside an extension method? For example: public static IEnumerable<CartItem> GetItems( this Cart cart ) { { while( cart.hasNext() ) yield return cart.GetNextItem( ); } } ...

What influences the timing of a GC?

I know it is not possible to know when a GC occurs, but there are factors that will tell you how often/when it may occur. What factors are these? One is how many objects are created, etc. ...

C#: Windows Forms: Getting keystrokes in a panel/picturebox?

I'm making a level editor for a game using windows forms. The form has several drop down menus, text boxes, etc, where the user can type information. I want to make commands like CTRL + V or CTRL + A available for working within the game world itself, not text manipulation. The game world is represented by a PictureBox contained in a Pa...

How to define a predicate as a function argument

I want to be able to write something as void Start(some condition that might evaluate to either true or false) { //function will only really start if the predicate evaluates to true } I'd guess it must be something of the form: void Start(Predicate predicate) { } How can I check inside my Start function whenever the predicate e...

.Net: Is this correct: objSample.dispose() means objSample = null ?

Hi Just wanna to know objSample.dispose() is equal to objSample = null Indeed, can I get answer to such these questions from disassemblers? how? Thank you ...

How to create custom exception handler for custom controls or extension methods.

I am creating an extension method in C# to retrieve some value from datagridview. Here if a user gives column name that doesnot exists then i want this function to throw an exception that can be handled at the place where this function will be called. How can i achieve this. public static T Value<T>(this DataGridView dgv, int RowNo,...

How can i shorten my code for various winform calls in MDI

I have a mdi where i have several line of code like the given below. Only chage is Form object which is being opened. So I want to all this work using only single function defination. When I tries to capture sender it gives me ToolStipMenuItem here. But I want its sender to be form name so that I can open its corresponding form. priva...