How to programmatically include a file in my project?

It worked for my just adding the it to the ProjectFolder, and also add the folder programmatically like this. var p = new Microsoft.Build.Evaluation.Project(@”C:\projects\BabDb\test\test.csproj”); p.AddItem(“Folder”, @”C:\projects\BabDb\test\test2″); p.AddItem(“Compile”, @”C:\projects\BabDb\test\test2\Class1.cs”); p.Save();

Looking for clean WinForms MVC tutorial for C# [closed]

Derick Bailey (via Los Techies) has blogged some fantastic articles (and complete demo source code) for his implementation of MVP in a WinForms app with a couple of other good patterns added to the mix (Application Controller, Event Aggregator). The work is inspired by Jeremy D Miller’s series of articles titled ‘Build Your Own CAB’

SaveFileDialog setting default path and file type?

The SaveFileDialog control won’t do any saving at all. All it does is providing you a convenient interface to actually display Windows’ default file save dialog. Set the property InitialDirectory to the drive you’d like it to show some other default. Just think of other computers that might have a different layout. By default windows … Read more

Order of events ‘Form.Load’, ‘Form.Shown’ and ‘Form.Activated’ in Windows Forms

See the Windows Forms Events Lifecycle: Move: This event occurs when the form is moved. Although by default, when a form is instantiated and launched, the user does not move it, yet this event is triggered before the Load event occurs. Load: This event occurs before a form is displayed for the first time. VisibleChanged: … Read more

How to simulate Windows shutdown for debugging?

There is a tool named Restart Manager (rmtool.exe) in the Microsoft’s Logo Testing Tools for Windows, which can be used to send shutdown and restart messages to a process. Logo testing tools can be downloaded here: http://download.microsoft.com/download/d/2/5/d2522ce4-a441-459d-8302-be8f3321823c/LogoToolsv1.0.msi Then you can simulate shutdown for your process: rmtool.exe -p [PID] -S where [PID] is the process ID. … Read more