Editing custom workflows with Workflow Re-hosting - c#

I've been prototyping this Workflow editor for end users and I've based my source from [MSDN]http://msdn.microsoft.com/en-us/library/aa480213.aspx. So far, I've made the following tweaks:
I've added a new project called Workflow.Core which will house custom activities and default workflows.
The toolbox now shows custom activities that are included in Workflow.Core.
On load, the workflow designer will show a default workflow from Workflow.Core instead of an empty SequentialWorkflowActivity. Aside from defining the initial flow of activities, the default workflow contains properties that are set and modified during workflow runtime.
The problem is that WorkflowView wont let me edit the default workflow. It's like it's in read-only mode, although I can still edit its attributes. It worked fine when I was loading an instance of SequentialWorkflowActivity.
Then I tried adding the default workflow's activities to an instance of SequentialWorkflowActivity and load that instead. It worked. I was able to drag new activities onto it and make property changes. But in doing so, the referenced properties within the default workflow are no longer available.
There is an alternative: that I make and include an activity to house all properties instead of the default workflow itself. It, however, will need explaining to the client (whom I don't think will understand) why there's an omnipresent activity in all their custom workflows which does no discernible business logic.
In summary, I need to make workflow designer edit the default workflows. So if you guys have any ideas or suggestions, please let me know. I need all the help I can get.
Thanks in advance!
Carlos

Related

Collaborative Coded UI tests

I have a question about Coded UI and how to best use it together with others. We are a team(of 3) who are testing a large web application(which is hard by itself) but we also want to make all the tests in one solution and share that solution through GIT(or TFS). What is the best way of doing this?
We have tried a few things already. We tried using the default UI map, but this creates a lot of merge conflicts and the UI map class becomes long and hard to understand.
We also tried using different UI maps for every page on the site. This seemed like a good idea since we all could test different parts of the website. The problem with this was that once you created one UI map and mapped the content of that page, you could not go back to mapping against that UI map again. So if we had mapped one page and then written a few tests and then some functionality was added, we could not go back to map this. If we created a new test and mapped through this test, this mapping was added to the default UI test. I think this method would work if we could just change which UI map the code would be added to for a new test.
Any reply would be appreciated!
To record and add new methods and controls into a UI Map other than the default, right-click on the UI Map's .uitest file in solution explorer and select the "Edit with Coded UI test builder" menu entry. By contrast, if you right-click in a method within the test sources and select the "Generate code for Coded UI test" menu entry then it will write to the default UI Map; creating it without warning if it does not exist. See also this Visual Studio user voice entry http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/3378897-choosing-the-uimap-when-recording-tests
I am sure you`ve read this one: http://msdn.microsoft.com/en-us/library/ff398056.aspx
In case of my app with similar issues we`ve got rid off UI Maps and hand code everything, wrap it in methods and make is as reusable as possible.

Multiple Resources in one project

I want to create one project with different versions like
Normal
Purchased
So as per my version I want to change some detail of my project like if someone is using Normal then icon should be "Normal.png" and if my it's Purchased then all the form should have icon of "Purchased.png".
Currently what happens is I wrote a code on condition base in every form.
Is there any way from where I can avoid this?
Is there any way from which I can create a new resource file and during compiling time tool will decide which resource file to use?
I would create a static "theme" class that you can call when loading a windows form--and then pass it the current form. Depending on the current theme (in this case, "Normal" or "Purchased"), manipulate the form accordingly.
See this link for an example of changing a form's icon dynamically with code using resources.
You can also bind properties of controls to application settings -- see this link for more on that. (This wouldn't apply for the form icon, but it could help with other changes you want to make based on Normal/Purchased behavior).

Why is my workflow not showing all the steps?

I created a workflow in Microsoft Dynamics CRM 2011 which I then exported and opened the XAML file with VS 2010. It shows me this when I open it:
But there are actually many more steps in this workflow. Why can't I see them or edit them? I tried clicking Expand All at the top right, but that didn't seem to make any difference. If I look at the actual code I can see the numerous steps - but no in the design view. Any ideas why?
The activities in your screenshot are custom activities. By default all you see is this placeholder. You can however create custom activity designers and associate the activities with those. In your custom activity designer you can do anything you can do in WPF including showing the child activities.

Workflow rehosted designer

I wish I could understand how the loading of xaml files into rehosted designer works. Depends of xaml definition I get different results.
Xaml, root node in the file is Activity that cointans flowchart. Here it's enough using desinger.Load(xamlFileName) with (new DesignerMetadata).Register() after creating the designer (anyone know what kind of magic is that?) In the designer I get workflow that looks like in visual studio editor.
Xaml, root node is Flowchart itself. The same steps give me only one, bare activity in the designer. I tried wrapping workflow in activity builder according to this(I have a similar problem). There are no problems with assemblies(at least I think so), no exceptions. I can't make it work like in previous point.
Is there any difference between xaml saved in visual studio and xaml saved in rehosted designer?
ActivityXamlServices.Load sometimes returns DynamicActivity, sometimes the target workflow. What does it depend on?
Thank you for any support.
Turns out that it depends on the argument given to the rehosted designer. If I start with new Flowchart, the root node in xaml will be flowchart. When loading such file later to the designer you dont need to wrap it. If you started with ActivityBuilder you might need to use WorkflowInspectionServices to get the workflow before loading xaml.
Sometimes to show workflow properly in the designer you need to use (new DesignerMetadata).Register() from proper assembly, but its not always necessary, I'm not sure what does it depend on.

Extending existing activity designers

I am looking to create a custom activity which is essentially the same as the 'If' activity but would like to add an extra button to the designer (just above the Condition expression text box). Does anyone know if this is even possible or would I have to create a brand new custom activity (along with a new designer) with all the same functionality as the 'If' one but with my extra bits added?
Thank you for your time.
Regards,
Michael
Depends if you are rehosting the designer or want to use the functionality in VS. With a rehosted desogner there are several ways to update the UI of existing activities like using WPF adorners
See Visual Workflow Tracking for an example.

Categories

Resources