private static ActivityBuilder StartUpdate(string name) { // Create the XamlXmlReaderSettings. XamlXmlReaderSettings readerSettings = new XamlXmlReaderSettings() { // In the XAML the "local" namespace referes to artifacts that come from // the same project as the XAML. When loading XAML if the currently executing // assembly is not the same assembly that was referred to as "local" in the XAML // LocalAssembly must be set to the assembly containing the artifacts. // Assembly.LoadFile requires an absolute path so convert this relative path // to an absolute path. LocalAssembly = Assembly.LoadFile( Path.GetFullPath(Path.Combine(mapPath, "NumberGuessWorkflowActivities_v1.dll"))) }; string path = Path.Combine(definitionPath, name); XamlXmlReader xamlReader = new XamlXmlReader(path, readerSettings); // Load the workflow definition into an ActivityBuilder. ActivityBuilder wf = XamlServices.Load( ActivityXamlServices.CreateBuilderReader(xamlReader)) as ActivityBuilder; // PrepareForUpdate makes a copy of the workflow definition in the // ActivityBuilder that is used for comparison when the update // map is created. DynamicUpdateServices.PrepareForUpdate(wf); return(wf); }
/// <summary> /// Mark workflow definition file to updtae it latter /// </summary> /// <param name="fileName"></param> public static void MarkToUpdate(String fileName) { ActivityBuilder wf = LoadActivityBuilder(fileName); DynamicUpdateServices.PrepareForUpdate(wf); SaveActivityBuilder(wf, fileName); }
private static DynamicUpdateMap CreateUpdateMap() { Activity workflowDefinition = GetOriginalWorkflow(); DynamicUpdateServices.PrepareForUpdate(workflowDefinition); // Now update the workflow - add in a new activity Sequence seq = workflowDefinition as Sequence; seq.Activities.Add(new WriteLine { Text = "Second version of workflow" }); // And then after all the changes, create the map return(DynamicUpdateServices.CreateUpdateMap(workflowDefinition)); }
private void cmdWorkflowUpdate_Click(object sender, RoutedEventArgs e) { OriginalWF = LoadActivityBuilder(txtWorkflowFile.Text); //Load original workflow to update DynamicUpdateServices.PrepareForUpdate(OriginalWF); //Prepare the workflow for update SaveActivityBuilder(OriginalWF, txtWorkflowFile.Text); //Save the prepared workflow }