Codeine .Net RSS 2.0
# Friday, 15 February 2008

    Well, I've designated 2008 as the Year of Dave, but unfortunately it may be beginning to fade away. After a few beers with Levi and Nick the goal of the Year of Dave was to do at least one somewhat crazy thing each month. The month of January didn't go too bad as I bought my own pinball machine, which you can see here, and I have gotten plenty of use out of it, but so far the rest of the year has been a bit of a lame duck. The Year of Dave is supposed to be full of fun and excitement, but the major flaw of my plan has been ideas for executing throughout the year. So here's my question to you (all six of you) - if you were single, without any kids and doing alright financially what would you do? This is a totally serious question. I'm sure every one of you has sat around and uttered the phrase "If I wasn't married and didn't have kids I would…" Finish that sentence in the comments below to give me some ideas; otherwise the Year of Dave is definitely going to be an ultimate failure. Even better send all your buddies a link to this post and tell them there's this crazy guy on the Internet who bought his own pinball machine and is looking for other crazy crap to do this year and he needs some more ideas, or post a link to this post on your blog. (It's really easy, you do CTRL+C and then CTRL+V for you lazy readers.) If you have a good idea, I'll buy you a beer. If you have a great idea then you'll start to see some pretty interesting pictures on my blog! If you don't have any ideas then you must be one of those weird people that are actually content with your life. (Which means I don't like you, so stop wasting my bandwidth!)

Friday, 15 February 2008 20:45:11 (Central Standard Time, UTC-06:00)  #    Comments [7] - Trackback - Save to del.icio.us - Digg This! - Follow me on Twitter
Year of Dave
# Saturday, 26 January 2008

    Yesterday afternoon a new addition was added to my family that I had been expecting for some time. As with most new fathers I expect to be sleep deprived for a while. Thankfully this new family member doesn't require me to change any diapers and I can turn it off or trade it in at anytime. Just one of the few pluses of being a S.I.N.K.

 

    

 

Saturday, 26 January 2008 11:33:12 (Central Standard Time, UTC-06:00)  #    Comments [2] - Trackback - Save to del.icio.us - Digg This! - Follow me on Twitter

# Sunday, 20 January 2008

    So far I have went over how to create a basic workflow activity that evaluates a regular expression against a string and I have also covered creating the validation class for the activity. The next thing I want to cover are some basics to enhancing the designer experience of the workflow activity allowing you to override the default visual display in the designer for a custom activity. Based on the default designer class our RegEx activity appears as follows:

    

    The first thing that needs to be done is to add a new class to the project called RegExDesigner.cs.

    

 

    Next we need to make our new class inherit from the ActivityDesigner class. To do this we will also need to import the namespace System.Workflow.ComponentModel.Design, which means your code should now appear as follows:

    using System.Workflow.ComponentModel.Design;

 

namespace FloFactory.Activities.Util.Logic

{

    public class RegExDesigner : ActivityDesigner

    {

    }

}

 

 

    There are a lot of functions that you can override, but the main function that we are going to work with is the Initialize function which will allow us to override the appearance of our activity in the designer. This first thing that I am going to do is add a nice image to the activity. Assuming you already have an image that you want to use as a resource in your project you add the image to the activity's design view by doing the following:

 

protected override void Initialize(System.Workflow.ComponentModel.Activity activity)

{

base.Initialize(activity);

Bitmap WorkFlowImage = Properties.Resources.workflow;

 

Image = WorkFlowImage;

 

}

 

    The other thing I would like to do is change the text that appears in the activity. This will be the default text that shows up until the user of our activity sets the name property. This is easily done by setting the Text property in the Initialize function. After doing this the code should appear as follows:

 

    protected override void Initialize(System.Workflow.ComponentModel.Activity activity)

{

base.Initialize(activity);

Bitmap WorkFlowImage = Properties.Resources.workflow;

 

Image = WorkFlowImage;

 

//Set the Text That appears

Text = "FloFactory RegEx";

 

}

 

 

    Now we need to associate the designer class with our activity. We do this by going to the top of the RegEx.cs class and add the following attribute:

    [Designer(typeof(RegExDesigner), typeof(IDesigner))]

    public partial class RegEx: BaseActivity

    {

        …

}

 

 

 

    After adding this code to the Initialize function and adding the attribute if we now look at the RegEx activity we will see that our image has replaced the default image that appeared when the original designer class was applied to the RegEx activity. Also, the default text that was defined appears in the center of the activity.

 

 

    As you can see we have easily modified the image and the text that appears in the designer for our RegEx activity. In a future post I will cover modifying the appearance of the activity by changing its size and colors so as to create a more custom look and feel for the activity.

 

    

 

 

 

Sunday, 20 January 2008 20:38:13 (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback - Save to del.icio.us - Digg This! - Follow me on Twitter
.Net 3.0 | Development | Windows Workflow

Navigation
Archive
<2008 March>
SunMonTueWedThuFriSat
2425262728291
2345678
9101112131415
16171819202122
23242526272829
303112345
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2024
David A. Osborn
Sign In
Statistics
Total Posts: 70
This Year: 0
This Month: 0
This Week: 0
Comments: 33
Themes
Pick a theme:
All Content © 2024, David A. Osborn
DasBlog theme 'Business' created by Christoph De Baene (delarou)