Udostępnij za pośrednictwem


Fixing the WF FileWatcher sample

There is a FileWatcher WF activity sample that ships with the Windows SDK.   I initially thought this might be of value to me but when I tried to open the workflow I ran into the following error: “Theme properties can only be changed in the Theme Configuration Dialog.”   Very intuitive right?   

Actually it is an intuitive message, it just requires some knowledge  about how custom activities are built.   The original version of the FileWatcher Activity included some code in the designer initialization to make the icon for the Activity look cooler in the toolbox.   This code causes problems if you try to open anything using the activity (e,g, the workflow that comes with the example).

If you've run into this problem you can comment out the following code in the initialization activity (found in FileSystemEventDesigner.cs):

 protected override void Initialize(Activity activity) 
{ 
    base.Initialize(activity);     // Change the designer theme for this activity  -- This is the offending code 
    // this.DesignerTheme.BackColorStart = Color.White; 
    // this.DesignerTheme.BackColorEnd = ColorTranslator.FromHtml("#F9CB5A"); 
    // this.DesignerTheme.BackgroundStyle = System.Drawing.Drawing2D.LinearGradientMode.Vertical; 
    // this.DesignerTheme.BorderColor = ColorTranslator.FromHtml("#BF8311"); 
}

Once you comment that code out you'll be able to open the workflow and work with the designer (note that there may be other issues worth considering if you want to use this in a State Machine - the sample only uses a simple sequential workflow).

Comments

  • Anonymous
    February 22, 2008
    There is a FileWatcher custom WF activity sample that ships with the Windows SDK .   I initially