Setting Default Values for Workflow Dependency Properties
When setting default values for dependency properties in Workflow Foundation there are two steps:
- Pass a PropertyMetadata object containing the default value to the DependencyProperty constructor (Line 8). This defaults the value of the property to the passed value.
- Apply the DefaultValue attribute to the property (Line 14). This provides the default value to the PropertyGrid which allows functionality such as the property appearing bold if the value is different to the default and the right-click Reset option to set the property back to the default.
For example:
1: Private Const DefaultPort As Integer = 25 2: 3: Public Shared PortProperty As DependencyProperty = _ 4: DependencyProperty.Register( _ 5: "Port", _ 6: GetType(Integer), _ 7: GetType(SendEmail), _ 8: New PropertyMetadata(DefaultPort) _ 9: ) 10: 11: <Description("Port")> _ 12: <Category("Input")> _ 13: <Browsable(True)> _ 14: <DefaultValue(DefaultPort)> _ 15: <DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)> _ 16: Public Property Port() As Integer 17: Get 18: Return (CType((MyBase.GetValue(SendEmail.PortProperty)), Integer)) 19: End Get 20: Set(ByVal Value As Integer) 21: MyBase.SetValue(SendEmail.PortProperty, Value) 22: End Set 23: End Property
Workflow Tracking Events Not Available Until Workflow Completes
I was using Workflow Foundation as part of an internal process recently and I couldn’t work out why the tracking events generated by the SqlTrackingService weren’t being written to the tracking database until the workflow completed or was terminated.
The issue was that the SqlTrackingService is transactional by default and the transaction isn’t committed until the workflow completes or is terminated. This can be changed by setting the IsTransactional property to False before adding the service to the WorkflowRuntime’s services collection.
http://msmvps.com/blogs/theproblemsolver/archive/2006/09/28/Tracking-in-Workflow-Foundation.aspx
Stop Visual Studio 2008 from Running Built-In WCF Service Host
I was working on a project recently where I had a solution with a project that self-hosted a WCF service and another project containing the service itself.
When running the solution with self-hosted project as the startup Visual Studio would also run the built-in WCF service host resulting in a clash for URLs/ports.
The solution is in the WCF Options tab in the service’s project properties. If you clear the Start WCF Service Host When Debugging Another Project In The Same Solution checkbox Visual Studio won’t run the built-in WCF service host unless the service project is the start-up project.
Synchronising Music with Windows Home Server
I’ve enabled media sharing on my Windows Home Server so that I can listen to music through my XBox 360 in the lounge room but I also want to be able to listen to music from my laptop when I’m at work.
Although my laptop is backed up to my Windows Home Server nightly music needs to be stored in the Music share on the Windows Home Server for it to be shared.
So what I did was set up a scheduled task that synchronises the contents of my Music directory to the Windows Home Server Music share. I used trusty old robocopy to do this:
robocopy C:\Users\<username>\Music \\<homeserver>\Music /MIR /XF Thumbs.db desktop.ini /R:3
The /MIR switch tells robocopy to do a bi-directional synchronisation.
The /XF Thumbs.db desktop.ini switch tells robocopy not to synchronise the Thumbs.db or desktop.ini files.
The /R:3 switch tells robocopy to only retry copies 3 times instead of the default 1 million times.
Authenticating to Windows Home Server
I’ve set up a Windows Home Server at home and one issue I’ve been having is that even though the username and password that I use to login to my laptop matches the username and password I set up on the Windows Home Server I was being prompted to login.
I’ve concluded that this is occurring because my laptop (and username) is a member of my employer’s domain.
The solution to this seems to be:
- Go into the User Accounts control panel (on my laptop).
- Click Manage Your Network Passwords.
- Add an entry for the Windows Home Server.
Disable System Beep in VMWare
If you use VMWare regularly then you have no doubt suffered from system beeps from you virtual machines, here is how to disable it:
Disabling Safari Update
Users of iTunes are being bombarded by the Apple Software Updater asking to install the Safari browser, not only does it ask you once but it asks you over and over again.
Here is a registry fix which will disable this update:
http://blogs.msdn.com/mthree/archive/2008/04/19/safari-update-041908.aspx
Windows Update Annoyance
One annoyance with Windows Update when installing a large number of updates on a server is updates that prompt you for input. A few times now I’ve kicked off a large update (for example, the one I’m doing now has 42 updates), you let it run, come back and the 3rd update is asking for input!
Calculating Total Size of a Directory Using LINQ
Dim totalSize As Decimal = (Aggregate file In New System.IO.DirectoryInfo(“c:\dev\”).GetFiles(“*.*”, IO.SearchOption.AllDirectories) Into Sum(file.Length)) / 1024 / 1024
Schemas for Work Item Type Definitions
I’m doing a lot of work with Work Item Type Definitions and for those that don’t know the Visual Studio SDK includes schemas for these that can be used in Visual Studio (and other XML editors) to provide Intellisense capabilities.
Rob Caron blogs about this here. For those that don’t want to download the whole SDK he also provides a direct download of just the schemas.
