private void cmdSaveUpdateMap_Click(object sender, RoutedEventArgs e)
      {
          DeltaWF   = LoadActivityBuilder(txtWorkflowSnapshot.Text);
          updateMap = DynamicUpdateServices.CreateUpdateMap(DeltaWF);

          SaveUpdateMap(updateMap, txtWorkflowSnapshot.Text);
      }
Пример #2
0
        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);
        }
        /// <summary>
        /// Load update map from updated defintion and save it to file *.map
        /// </summary>
        /// <param name="fileName"></param>
        public static void SaveUpdateMap(String fileName)
        {
            ActivityBuilder  wf  = LoadActivityBuilder(fileName);
            DynamicUpdateMap map = DynamicUpdateServices.CreateUpdateMap(wf);

            String path = System.IO.Path.ChangeExtension(fileName, "map");
            DataContractSerializer serialize = new DataContractSerializer(typeof(DynamicUpdateMap));

            using (FileStream fs = File.Open(path, FileMode.Create))
            {
                serialize.WriteObject(fs, map);
            }
        }
Пример #5
0
        private static void CreateUpdateMaps(ActivityBuilder wf, string name)
        {
            // Create the UpdateMap.
            DynamicUpdateMap map = DynamicUpdateServices.CreateUpdateMap(wf);

            // Serialize it to a file.
            string path = Path.Combine(mapPath, name);
            DataContractSerializer sz = new DataContractSerializer(typeof(DynamicUpdateMap));

            using (FileStream fs = System.IO.File.Open(path, FileMode.Create))
            {
                sz.WriteObject(fs, map);
            }
        }
Пример #6
0
        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
 }