Combining WinForms and Windows Presentation Foundation in a single form

One of the neat features of Windows Presentation Foundation (WPF) is that you can combine WinForms and WPF in a single form. That is pretty neat but the two are very different so there are a number of limitations and gotchas you need to be aware of.   If you know about them I suggest you read the blog post by Scott Berry titled Gotchas For Working With Windows Forms/WPF Interop at http://blogs.msdn.com/scoberry/archive/2006/09/01/735844.aspx.   Enjoy!           Maurice de Beijer www.TheProblemSolver.nl  

Developer Express Refactor is a seriously cool tool!

I just love Refactor   Some of my favorite refactoring options are: Move Type to FileSometimes I am just plain lazy and create a new type in the same source file as an already existing one. Only later I need to clean up and move it to a separate file. I used to do so with cut and paste but no longer Rename LocalRenaming a local variable, or a field for that matter, becomes a breeze. And best of all you don’t need to go to the declaration, you can do it at any place the variable is used.Optimize Namespace … Continue reading Developer Express Refactor is a seriously cool tool!

Visual Studio 2003 and Windows Vista

Are you still developing software using Visual Studio 2003 (or 2002 for that matter) and planning an upgrade to Windows Vista later this year? Well you might want to reconsider your plans! Why? Well Microsoft has no plans for supporting either on Vista. Kind of funny really because they will support Visual Basic 6, both the runtime and IDE, on Vista.   So what does this mean for the average software developer?   Well I am sure most of you are in a similar situation as I am in myself. That is do most of my work in VS2005 but occasionally … Continue reading Visual Studio 2003 and Windows Vista

Tracking in Workflow Foundation

If you are tracking the progress of events in a workflow using a SqlTrackingService object you might have noticed you aren’t seeing any events in the database until the workflow is either finished or unloaded. In fact you won’t get to see any event until the WorkflowPersisted event has fired. The reason for this is that the default for the SqlTrackingService is to be transactional. Even though the docs claim the default for the SqlTrackingService.IsTransactional is false in fact it is true. This results in the records being written to the database but you won’t see them when querying because … Continue reading Tracking in Workflow Foundation

Daylight saving time and other time zone related information

Sometimes you need to know just that little bit more about the time zone a user is in. You might need to know the time difference between their local time and UTC, whether they are in daylight saving time or when the daylight saving period starts and ends.  Well the TimeZone type is our friend. The TimeZone.CurrentTimeZone will give you all sorts of information like if daylight saving time is in effect, the IsDaylightSavingTime() function, or offset from UTC, the GetUtcOffset() function.  Additionally the GetDaylightChanges() functin will give you more detail about when the daylight saving period starts and ends … Continue reading Daylight saving time and other time zone related information

Reflection is slow!

But than again you probably knew that already if you have done any work with reflection. But Stephen Erisman got creative with the problem and tried generating dynamic IL at runtime to solve the problem. And guess what it works and not a bit faster but a lot   So if you find yourself doing a lot of the following: PropertyInfo pi = someObject.GetType().GetProperty(“SomeProperty”); object value = pi.GetValue(someObject, null); you really should take a look at his article at the Code Project and try it. In my case the performance boost was almost 100 fold!   Thanks to Scott Hanselman’s show … Continue reading Reflection is slow!

Red Gate – ANTS Profiler

If you are using the Red Gate – ANTS Profiler I suggest you check their web site as they have recently released version 2.7 and it’s a free maintenance release.  And if you aren't using ANTS yet and need a profiler I suggest you go to their site and download the trial version and give it a try. I have been using it for some time now and think it’s a great tool   These are the fixes according to their website: Vista compatibility, UI tweaks, engineering for larger code bases and bug fixes The timings for recursive methods are … Continue reading Red Gate – ANTS Profiler

Workflow Foundation and tracing

I think Windows Workflow Foundation is one of the more interesting features in WinFx, oops the .NET 3.0 framework. But figuring out what to do can be a challenge. Fortunately they added a number of trace switches to allow you to track what the components are doing. Add the following to the app.config file to see what is going on:   <system.diagnostics>   <switches>     <addname=“System.Workflow LogToTraceListeners“value=“1“ />       <addname=“System.Workflow.Runtime.Hosting“value=“Verbose“ />     <addname=“System.Workflow.Runtime“value=“Verbose“ />     <addname=“System.Workflow.Runtime.Tracking“value=“Verbose“ />     <addname=“System.Workflow.Activities“value=“Verbose“ />     <addname=“System.Workflow.Activities.Rules“value=“Verbose“ />   </switches> </system.diagnostics>   Valid value are: Off No messages … Continue reading Workflow Foundation and tracing

WinForms Event Tracer

One of the problems facing a WinForms developer is choosing which event handler to pick when he wants to handle a certain event. Now this sounds easy, you might say: I want to do something when the user click on the form so I add an event handler to the form Click event. And in this case that works just fine but suppose you want to do something when a user tabs from one TextBox to the next. In this case a number of events are raised.   To help the developer pick the right event I have started developing … Continue reading WinForms Event Tracer

Installing Visual Studio 2005 Extensions for Windows Workflow Foundation RC5(EN) is failing

It you are trying to install the Workflow extensions for Visual Studio as per Pail Andrews instructions on http://blogs.msdn.com/pandrew/archive/2006/09/07/745701.aspx you might run into the same problems as I have. The problem occurs while trying to install Visual Studio 2005 extensions for Windows Workflow Foundation (Visual Studio 2005 Extensions for Windows Workflow Foundation RC5(EN).exe) after installing the Visual Studio “Orcas” CTP (vsextwfx.msi). The problem I was having is that the last installer seems to restart the previous one and offers a change/repair/reinstall option, clearly not what I needed. The solution was suggested by Bill McCarthy and that fixed the problem.   … Continue reading Installing Visual Studio 2005 Extensions for Windows Workflow Foundation RC5(EN) is failing