示例#1
0
        private ToolboxCategory CreateToolboxCategory(String categoryName, List <Type> activities, Boolean isStandard)
        {
            ToolboxCategory tc = new ToolboxCategory(categoryName);

            foreach (Type activity in activities)
            {
                if (!loadedToolboxActivities.Contains(activity))
                {
                    //cleanup the name of generic activities
                    String   name;
                    String[] nameChunks = activity.Name.Split('`');
                    if (nameChunks.Length == 1)
                    {
                        name = activity.Name;
                    }
                    else
                    {
                        name = String.Format("{0}<>", nameChunks[0]);
                    }
                    ToolboxItemWrapper tiw = new ToolboxItemWrapper(
                        activity.FullName, activity.Assembly.FullName,
                        null, name);
                    tc.Add(tiw);
                    if (isStandard)
                    {
                        loadedToolboxActivities.Add(activity);
                    }
                }
            }
            return(tc);
        }
        private void AddCategoryToToolbox(string categoryName, List <Type> activities)
        {
            foreach (Type activityType in activities)
            {
                if (this.IsValidToolboxActivity(activityType))
                {
                    ToolboxCategory category = this.GetToolboxCategory(categoryName);

                    if (!this.loadedToolboxActivities[category].Contains(activityType.FullName))
                    {
                        string   displayName;
                        string[] splitName = activityType.Name.Split('`');
                        if (splitName.Length == 1)
                        {
                            displayName = activityType.Name;
                        }
                        else
                        {
                            displayName = string.Format("{0}<>", splitName[0]);
                        }

                        this.loadedToolboxActivities[category].Add(activityType.FullName);
                        category.Add(new ToolboxItemWrapper(activityType.FullName, activityType.Assembly.FullName, null, displayName));
                    }
                }
            }
        }
示例#3
0
        /// <summary>
        /// Builds the WF toolbox.
        /// </summary>
        /// <returns></returns>
        private ToolboxControl BuildToolbox()
        {
            ToolboxControl toolbox = new ToolboxControl();

            // Load emgu .NET types
            var emguCategory = new ToolboxCategory("Image Pipeline Activities");

            foreach (var activity in GetActivityTypes(typeof(EmguWF.Activities.RegisterMetadata).Assembly))
            {
                emguCategory.Add(new ToolboxItemWrapper(activity, GetFriendlyName(activity)));
            }

            (new EmguWF.Activities.RegisterMetadata()).Register();
            toolbox.Categories.Add(emguCategory);

            // Add standard types
            foreach (var activityList in _standardActivities)
            {
                var category = new ToolboxCategory(activityList.Key);
                foreach (var activity in activityList.Value)
                {
                    category.Add(new ToolboxItemWrapper(activity, GetFriendlyName(activity)));
                }
                toolbox.Categories.Add(category);
            }

            return(toolbox);
        }
示例#4
0
        /// <summary>
        /// Creates the predefined activities category.
        /// </summary>
        /// <returns></returns>
        /// <remarks></remarks>
        private ToolboxCategory CreatePredefinedActivitiesCategory()
        {
            Assembly assy = Assembly.GetAssembly(typeof(Sequence));
            var      cat  = new ToolboxCategory("Predefined Activities");

            Type[] types = assy
                           .GetTypes()
                           .Where(t => (t.IsSubclassOf(typeof(Activity)) && (!t.IsAbstract) && (!t.ContainsGenericParameters)))
                           .ToArray();

            foreach (var t in types)
            {
                try
                {
                    var inst = (Activity)Activator.CreateInstance(t);
                    if (t.IsVisible)
                    {
                        var wrp = new ToolboxItemWrapper(t, inst.DisplayName);

                        cat.Add(wrp);;
                    }
                }
                catch
                { }
            }
            ;
            return(cat);
        }
示例#5
0
        private void FrmToolbox_Load(object sender, EventArgs e)
        {
            try
            {
                myToolbox.Categories.Clear();
                XmlDocument objXmlDoc = DynamicCtrl.GetToolboxItemsConfigFile();
                if (objXmlDoc == null)
                {
                    return;
                }

                XmlNodeList categoryNodes = objXmlDoc.SelectNodes("ToolBox/Category");
                for (int ix = 0; ix < categoryNodes.Count; ix++)
                {
                    ToolboxCategory category = new ToolboxCategory();
                    category.Name       = categoryNodes[ix].Attributes["Name"].Value;
                    category.ImageIndex = DataConvert.GetInt32(categoryNodes[ix].Attributes["ImageIndex"].Value);
                    category.IsOpen     = true;
                    myToolbox.Categories.Add(category);
                    XmlNodeList toolitemNodes = categoryNodes[ix].SelectNodes("ToolItem");
                    for (int iy = 0; iy < toolitemNodes.Count; iy++)
                    {
                        ToolboxItem toolitem = new ToolboxItem();
                        toolitem.Name       = toolitemNodes[iy].Attributes["Name"].Value;
                        toolitem.ImageIndex = DataConvert.GetInt32(toolitemNodes[iy].Attributes["ImageIndex"].Value);
                        toolitem.ClassName  = toolitemNodes[iy].Attributes["ClassName"].Value;
                        category.Items.Add(toolitem);
                    }
                }
            }
            catch (Exception ex)
            {
                Program.ShowMessageBox("FrmToolbox", ex);
            }
        }
        // Get the filled Toolbox
        public static ToolboxControl GetToolboxControl()
        {
            // Create the ToolBoxControl.
            ToolboxControl ctrl = new ToolboxControl();

            foreach (var item in _source)
            {
                ctrl.Categories.Add(item);
            }

            // Create a category.
            ToolboxCategory category = new ToolboxCategory("category1");

            // Create Toolbox items.
            ToolboxItemWrapper tool1 =
                new ToolboxItemWrapper("System.Activities.Statements.Assign",
                                       typeof(Assign).Assembly.FullName, null, "Assign");

            ToolboxItemWrapper tool2 = new ToolboxItemWrapper("System.Activities.Statements.Sequence",
                                                              typeof(Sequence).Assembly.FullName, null, "Sequence");

            // Add the Toolbox items to the category.
            category.Add(tool1);
            category.Add(tool2);

            // Add the category to the ToolBox control.
            ctrl.Categories.Add(category);
            return(ctrl);
        }
示例#7
0
        private ToolboxControl GetToolboxControl()
        {
            // Create the ToolBoxControl.
            ToolboxControl ctrl = new ToolboxControl();

            // Create a category.
            ToolboxCategory category  = new ToolboxCategory("Available");
            ToolboxCategory category2 = new ToolboxCategory("Custom");
            // Create Toolbox items.
            ToolboxItemWrapper tool1 =
                new ToolboxItemWrapper("System.Activities.Statements.Assign",
                                       typeof(Assign).Assembly.FullName, null, "Assign");

            ToolboxItemWrapper tool2 = new ToolboxItemWrapper("System.Activities.Statements.Sequence",
                                                              typeof(Sequence).Assembly.FullName, null, "Sequence");

            ToolboxItemWrapper tool3 = new ToolboxItemWrapper("System.Activities.Statements.WriteLine",
                                                              typeof(WriteLine).Assembly.FullName, null, "WriteLine");

            ToolboxItemWrapper tool4 = new ToolboxItemWrapper("ConDep.activities.CopyFileActivity",
                                                              typeof(CopyFileActivity).Assembly.FullName, null, "CopyFile");


            // Add the Toolbox items to the category.
            category.Add(tool1);
            category.Add(tool2);
            category.Add(tool3);
            category2.Add(tool4);

            // Add the category to the ToolBox control.
            ctrl.Categories.Add(category);
            ctrl.Categories.Add(category2);
            return(ctrl);
        }
示例#8
0
        private void Initialize()
        {
            // Initialize tools.
            ToolboxCategory cryptography = new ToolboxCategory("Cryptography", true);

            cryptography.SubItems.Add(new ToolboxItem(PackIconMaterialKind.LockCheckOutline, "Resource Encrypter", nameof(ResourceEncrypterPage), true, 700, 900));
            cryptography.SubItems.Add(new ToolboxItem(PackIconMaterialKind.LockOpenCheckOutline, "Resource Decrypter", nameof(ResourceDecrypterPage), true, 700, 900));

            ToolboxCategory data = new ToolboxCategory("Data", true);

            data.SubItems.Add(new ToolboxItem(PackIconMaterialKind.FolderPoundOutline, "Hash Comparer", nameof(HashComparerPage), false, 550, 210));
            data.SubItems.Add(new ToolboxItem(PackIconMaterialKind.TimelineTextOutline, "Text Comparer", nameof(TextComparerPage), false, 550, 210));

            ToolboxCategory saveData = new ToolboxCategory("Save Data", true);

            saveData.SubItems.Add(new ToolboxItem(PackIconMaterialKind.ContentSaveEditOutline, "Save Data Manager", nameof(SaveDataManagerPage), true));

            ToolboxCategory script = new ToolboxCategory("Script", true);

            script.SubItems.Add(new ToolboxItem(PackIconMaterialKind.FileImportOutline, "Script Importer", nameof(ScriptImporterPage), true, 700, 840));
            script.SubItems.Add(new ToolboxItem(PackIconMaterialKind.FileExportOutline, "Script Exporter", nameof(ScriptExporterPage), true, 700, 840));
            script.SubItems.Add(new ToolboxItem(PackIconMaterialKind.Translate, "Script Translator", nameof(ScriptTranslatorPage), true, 700, 860));
            script.SubItems.Add(new ToolboxItem(PackIconMaterialKind.SwapHorizontalVariant, "Script Migration Manager", nameof(ScriptMigrationManagerPage), false, 700, 320));

            _nodes.Add(cryptography);
            _nodes.Add(data);
            _nodes.Add(saveData);
            _nodes.Add(script);
        }
示例#9
0
 public void InitializeSnippets()
 {
     if (toolbox.Categories.Count > 0)
     {
         return;
     }
     try
     {
         if (dag == null)
         {
             dag = new DynamicActivityGenerator("Snippets", Interfaces.Extensions.ProjectsDirectory);
         }
         var cs = new Dictionary <string, ToolboxCategory>();
         foreach (var s in Plugins.Snippets)
         {
             try
             {
                 if (!cs.ContainsKey(s.Category))
                 {
                     cs.Add(s.Category, new ToolboxCategory(s.Category));
                 }
                 ToolboxCategory cat = cs[s.Category];
                 var             t   = dag.AppendSubWorkflowTemplate(s.Name, s.Xaml);
                 cat.Add(new ToolboxItemWrapper(t, s.Name));
             }
             catch (Exception ex)
             {
                 Log.Error(ex.ToString());
             }
         }
         try
         {
             dag.Save();
         }
         catch (Exception ex)
         {
             Log.Error(ex.ToString());
         }
         if (cs == null || cs.Count == 0)
         {
             Console.WriteLine("No snippets!");
         }
         foreach (var c in cs)
         {
             try
             {
                 toolbox.Categories.Add(c.Value);
             }
             catch (Exception ex)
             {
                 Log.Error(ex.ToString());
             }
         }
     }
     catch (Exception ex)
     {
         Log.Error(ex, "");
         MessageBox.Show("InitializeSnippets: " + ex.Message);
     }
 }
示例#10
0
        private ToolboxControl GetToolboxControl()
        {
            // Create the ToolBoxControl.
            ToolboxControl ctrl = new ToolboxControl();

            // Create a category.
            ToolboxCategory category = new ToolboxCategory("Standard");

            // Create Toolbox items.
            ToolboxItemWrapper tool1 =
                new ToolboxItemWrapper("System.Activities.Statements.Assign",
                                       typeof(Assign).Assembly.FullName, null, "Assign");

            ToolboxItemWrapper tool2 = new ToolboxItemWrapper("System.Activities.Statements.Sequence",
                                                              typeof(Sequence).Assembly.FullName, null, "Sequence");

            ToolboxItemWrapper tool3 = new ToolboxItemWrapper("System.Activities.Statements.WriteLine",
                                                              typeof(WriteLine).Assembly.FullName, null, "WriteLine");

            ToolboxItemWrapper tool4 = new ToolboxItemWrapper("System.Activities.Statements.WriteLine",
                                                              typeof(WriteLine).Assembly.FullName, null, "MessageBox");



            // Add the Toolbox items to the category.
            category.Add(tool1);
            category.Add(tool2);
            category.Add(tool3);
            // Add the category to the ToolBox control.
            ctrl.Categories.Add(category);
            return(ctrl);
        }
示例#11
0
 /// <summary>
 /// Gets the toolbox control.
 /// </summary>
 /// <param name="getToolBoxControlCompleted">The get tool box control completed.</param>
 /// <remarks></remarks>
 private void GetToolboxControlAsync(Action <ToolboxCategoryItems> getToolBoxControlCompleted = null)
 {
     using (var wrk = new BackgroundWorker())
     {
         ToolboxCategoryItems lst = new ToolboxCategoryItems();
         wrk.DoWork += (s, e) =>
         {
             ToolboxCategory catPredef = CreatePredefinedActivitiesCategory();
             lst.Add(catPredef);
             ToolboxCategory catService = CreateServiceModelActivitiesCategory();
             lst.Add(catService);
             CreateDiscoCategories(lst); // Auto discovery proves to be very very hard
             // CreateContractCategories(lst); // Lets assumne that Pms.*.Contract assemblies are readily available
         };
         wrk.RunWorkerCompleted += (s, e) =>
         {
             wrk.Dispose();
             if (getToolBoxControlCompleted != null)
             {
                 getToolBoxControlCompleted(lst);
             }
         };
         wrk.RunWorkerAsync();
     }
 }
示例#12
0
        private void AutoAddActivitiesToToolbox()
        {
            ModelService            ms                 = wd.Context.Services.GetService <ModelService>();
            IEnumerable <ModelItem> activities         = ms.Find(ms.Root, typeof(Activity));
            List <String>           namespacesToIgnore = new List <string>
            {
                "Microsoft.VisualBasic.Activities",
                "System.Activities.Expressions"
            };
            HashSet <Type> activitiesToAdd = new HashSet <Type>();

            foreach (ModelItem item in activities)
            {
                if (!loadedToolboxActivities.Contains(item.ItemType))
                {
                    if (!namespacesToIgnore.Contains(item.ItemType.Namespace))
                    {
                        if (!activitiesToAdd.Contains(item.ItemType))
                        {
                            activitiesToAdd.Add(item.ItemType);
                        }
                    }
                }
                RemoveAutoAddedToolboxCategory();
                if (activitiesToAdd.Count > 0)
                {
                    ToolboxCategory autoCat = CreateToolboxCategory(
                        "Auto", activitiesToAdd.ToList <Type>(), false);
                    CreateAutoAddedToolboxCategory(autoCat);
                }
            }
        }
        public static ToolboxCategoryItems LoadToolbox()
        {
            LoadSystemIcon();

            ToolboxCategoryItems toolboxCategoryItems = new ToolboxCategoryItems();


            ToolboxCategory categoryControlFlow = new ToolboxCategory("控制流")
            {
                new ToolboxItemWrapper(typeof(DoWhile), "DoWhile"),
                new ToolboxItemWrapper(typeof(ForEach <>), "ForEach<T>"),
                new ToolboxItemWrapper(typeof(If), "If"),
                new ToolboxItemWrapper(typeof(Parallel), "Parallel"),
                new ToolboxItemWrapper(typeof(ParallelForEach <>), "ParallelForEach<T>"),
                new ToolboxItemWrapper(typeof(Pick), "Pick"),
                new ToolboxItemWrapper(typeof(PickBranch), "PickBranch"),
                new ToolboxItemWrapper(typeof(Sequence), "Sequence"),
                new ToolboxItemWrapper(typeof(Switch <>), "Switch<T>"),
                new ToolboxItemWrapper(typeof(While), "While")
            };

            toolboxCategoryItems.Add(categoryControlFlow);


            ToolboxCategory categoryFlowChart = new ToolboxCategory("流程图")
            {
                new ToolboxItemWrapper(typeof(Flowchart), "Flowchart"),
                new ToolboxItemWrapper(typeof(FlowDecision), "FlowDecision"),
                new ToolboxItemWrapper(typeof(FlowSwitch <>), "FlowSwitch<T>"),

                new ToolboxItemWrapper(typeof(FlowSwitch <string>), "FlowSwitch<string>"),
                new ToolboxItemWrapper(typeof(FlowSwitch <double>), "FlowSwitch<double>")
            };

            toolboxCategoryItems.Add(categoryFlowChart);


            ToolboxCategory categoryPrimitives = new ToolboxCategory("基元")
            {
                new ToolboxItemWrapper(typeof(Assign), "Assign"),
                new ToolboxItemWrapper(typeof(Delay), "Delay"),
                new ToolboxItemWrapper(typeof(InvokeMethod), "InvokeMethod"),
                new ToolboxItemWrapper(typeof(WriteLine), "WriteLine")
            };

            toolboxCategoryItems.Add(categoryPrimitives);

            ToolboxCategory categoryCustomActivities = new ToolboxCategory("自定义活动")
            {
                new ToolboxItemWrapper(typeof(Artificial), "人工活动"),
                new ToolboxItemWrapper(typeof(Terminator), "流程结束"),
                //new ToolboxItemWrapper(typeof(BackToActor), "退回到发起人"),
                //new ToolboxItemWrapper(typeof(Countersignature),"会签专用活动")
            };

            toolboxCategoryItems.Add(categoryCustomActivities);

            return(toolboxCategoryItems);
        }
示例#14
0
        protected override void OnExecute(object parameter)
        {
            var c = new ToolboxCategory();

            c.CreatedCancelled += C_CreatedCancelled;
            c.Created          += C_Created;
            _service.AddCategory(c);
        }
示例#15
0
 private void RemoveAutoAddedToolboxCategory()
 {
     if (autoAddedCategory != null)
     {
         toolboxControl.Categories.Remove(autoAddedCategory);
         autoAddedCategory = null;
     }
 }
示例#16
0
        /// <summary>
        /// ToolboxStateMachine
        /// </summary>
        /// <returns></returns>
        internal static ToolboxCategory GetToolboxStateMachine()
        {
            ToolboxCategory category = new ToolboxCategory(Properties.Resources.ToolboxStateMachine);

            category.Add(new ToolboxItemWrapper(typeof(System.Activities.Statements.StateMachine)));
            category.Add(new ToolboxItemWrapper(typeof(System.Activities.Statements.State)));
            category.Add(new ToolboxItemWrapper(typeof(System.Activities.Core.Presentation.FinalState)));
            return(category);
        }
示例#17
0
        /// <summary>
        /// ErrorHandling
        /// </summary>
        /// <returns></returns>
        internal static ToolboxCategory GetToolboxErrorHandling()
        {
            ToolboxCategory category = new ToolboxCategory(Properties.Resources.ToolboxErrorHandling);

            category.Add(new ToolboxItemWrapper(typeof(System.Activities.Statements.Rethrow)));
            category.Add(new ToolboxItemWrapper(typeof(System.Activities.Statements.Throw)));
            category.Add(new ToolboxItemWrapper(typeof(System.Activities.Statements.TryCatch)));
            return(category);
        }
示例#18
0
        /// <summary>
        /// ToolboxFlowchart
        /// </summary>
        /// <returns></returns>
        internal static ToolboxCategory GetToolboxFlowchart()
        {
            ToolboxCategory category = new ToolboxCategory(Properties.Resources.ToolboxFlowchart);

            category.Add(new ToolboxItemWrapper(typeof(System.Activities.Statements.Flowchart)));
            category.Add(new ToolboxItemWrapper(typeof(System.Activities.Statements.FlowDecision)));
            category.Add(new ToolboxItemWrapper(typeof(System.Activities.Statements.FlowSwitch <>)));
            return(category);
        }
示例#19
0
        /// <summary>
        /// ToolboxRuntime
        /// </summary>
        /// <returns></returns>
        internal static ToolboxCategory GetToolboxRuntime()
        {
            ToolboxCategory category = new ToolboxCategory(Properties.Resources.ToolboxRuntime);

            category.Add(new ToolboxItemWrapper(typeof(System.Activities.Statements.Persist)));
            category.Add(new ToolboxItemWrapper(typeof(System.Activities.Statements.TerminateWorkflow)));
            category.Add(new ToolboxItemWrapper(typeof(System.Activities.Statements.NoPersistScope)));
            return(category);
        }
示例#20
0
        private ToolboxControl CreateToolbox()
        {
            Dictionary <String, List <Type> > activitiesToInclude = new Dictionary <String, List <Type> >();

            activitiesToInclude.Add("Basic", new List <Type>
            {
                typeof(Sequence),
                typeof(If),
                typeof(While),
                typeof(Assign),
                typeof(WriteLine)
            });
            activitiesToInclude.Add("Flowchart", new List <Type>
            {
                typeof(Flowchart),
                typeof(FlowDecision),
                typeof(FlowSwitch <>)
            });
            activitiesToInclude.Add("Collections", new List <Type>
            {
                typeof(ForEachWithBodyFactory <>),
                typeof(ParallelForEachWithBodyFactory <>),
                typeof(ExistsInCollection <>),
                typeof(AddToCollection <>),
                typeof(RemoveFromCollection <>),
                typeof(ClearCollection <>),
            });
            activitiesToInclude.Add("Error Handling", new List <Type>
            {
                typeof(TryCatch),
                typeof(Throw),
                typeof(TransactionScope)
            });
            ToolboxControl tb = new ToolboxControl();

            foreach (var category in activitiesToInclude)
            {
                ToolboxCategory cat = CreateToolboxCategory(
                    category.Key, category.Value, true);
                tb.Categories.Add(cat);

                if (cat.CategoryName == "Flowchart")
                {
                    flowchartCategory = cat;
                    foreach (var tool in cat.Tools)
                    {
                        if (tool.Type == typeof(FlowDecision) ||
                            tool.Type == typeof(FlowSwitch <>))
                        {
                            flowchartActivities.Add(tool);
                        }
                    }
                }
            }
            return(tb);
        }
示例#21
0
        public void AddCategory(IToolboxCategory category, bool suppressRefresh = false)
        {
            var index = _stateProvider.ItemsSource.Count;

            if (ToolboxCategory.IsDefaultCategory(_stateProvider.ItemsSource.LastOrDefault()))
            {
                index--;
            }
            InsertCategory(index, category);
        }
        /// <summary>
        /// Ajout d'une catégorie à la toolbox
        /// </summary>
        /// <param name="categoryName"></param>
        /// <param name="assemblies"></param>
        private void AddToToolbox(String categoryName, params Assembly[] assemblies)
        {
            ToolboxCategory category = GetToolBoxCategory(categoryName, assemblies);

            if (category == null)
            {
                return;
            }
            _toolbox.Categories.Add(category);
        }
示例#23
0
        /// <summary>
        /// ToolboxCollection
        /// </summary>
        /// <returns></returns>
        internal static ToolboxCategory GetToolboxCollection()
        {
            ToolboxCategory category = new ToolboxCategory(Properties.Resources.ToolboxCollection);

            category.Add(new ToolboxItemWrapper(typeof(System.Activities.Statements.AddToCollection <>)));
            category.Add(new ToolboxItemWrapper(typeof(System.Activities.Statements.ClearCollection <>)));
            category.Add(new ToolboxItemWrapper(typeof(System.Activities.Statements.ExistsInCollection <>)));
            category.Add(new ToolboxItemWrapper(typeof(System.Activities.Statements.RemoveFromCollection <>)));
            return(category);
        }
示例#24
0
 private void AddCategoryToToolbox(string categoryName, Type activityType, string displayName)
 {
     if (this.IsValidToolboxActivity(activityType))
     {
         ToolboxCategory    category = this.GetToolboxCategory(categoryName);
         ToolboxItemWrapper toolbox  = new ToolboxItemWrapper(activityType.FullName, activityType.Assembly.FullName, null, displayName);
         toolbox.BitmapName = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources", displayName.Replace("<>", "") + ".png");
         category.Add(toolbox);
     }
 }
示例#25
0
        /// <summary>
        /// ToolboxTransaction
        /// </summary>
        /// <returns></returns>
        internal static ToolboxCategory GetToolboxTransaction()
        {
            ToolboxCategory category = new ToolboxCategory(Properties.Resources.ToolboxTransaction);

            category.Add(new ToolboxItemWrapper(typeof(System.Activities.Statements.CancellationScope)));
            category.Add(new ToolboxItemWrapper(typeof(System.Activities.Statements.CompensableActivity)));
            category.Add(new ToolboxItemWrapper(typeof(System.Activities.Statements.Compensate)));
            category.Add(new ToolboxItemWrapper(typeof(System.Activities.Statements.Confirm)));
            category.Add(new ToolboxItemWrapper(typeof(System.Activities.Statements.TransactionScope)));
            return(category);
        }
示例#26
0
        /// <summary>
        /// ToolboxPrimitives
        /// </summary>
        /// <returns></returns>
        internal static ToolboxCategory GetToolboxPrimitives()
        {
            ToolboxCategory category = new ToolboxCategory(Properties.Resources.ToolboxPrimitives);

            category.Add(new ToolboxItemWrapper(typeof(System.Activities.Statements.Assign)));
            category.Add(new ToolboxItemWrapper(typeof(System.Activities.Statements.Delay)));
            category.Add(new ToolboxItemWrapper(typeof(System.Activities.Statements.InvokeDelegate)));
            category.Add(new ToolboxItemWrapper(typeof(System.Activities.Statements.InvokeMethod)));
            category.Add(new ToolboxItemWrapper(typeof(System.Activities.Statements.WriteLine)));
            return(category);
        }
示例#27
0
 protected override void OnExecute(object parameter)
 {
     if (!(_toolbox.SelectedNode is IToolboxCategory category))
     {
         return;
     }
     if (ToolboxCategory.IsDefaultCategory(category))
     {
         return;
     }
     _service.RemoveCategory(category);
 }
示例#28
0
        private ToolboxControl GetToolboxControl()
        {
            ToolboxControl ctrl = new ToolboxControl();

            foreach (var categoryDefinition in CustomActivityDefinitions.Categories)
            {
                var category = new ToolboxCategory(categoryDefinition.Name);
                foreach (var toolDefinition in categoryDefinition.ActivityTypes)
                {
                    ToolboxItemWrapper tool;
                    if (string.IsNullOrEmpty(toolDefinition.DisplayName))
                    {
                        tool = new ToolboxItemWrapper(toolDefinition.ActivityType);
                    }
                    else
                    {
                        tool = new ToolboxItemWrapper(toolDefinition.ActivityType, toolDefinition.DisplayName);
                    }
                    category.Add(tool);
                }
                ctrl.Categories.Add(category);
            }

            foreach (var categoryDefinition in NativeActivityDefintions.Categories)
            {
                var category = new ToolboxCategory(categoryDefinition.Name);
                foreach (var toolDefinition in categoryDefinition.ActivityTypes)
                {
                    ToolboxItemWrapper tool;
                    if (string.IsNullOrEmpty(toolDefinition.DisplayName))
                    {
                        tool = new ToolboxItemWrapper(toolDefinition.ActivityType);
                    }
                    else
                    {
                        tool = new ToolboxItemWrapper(toolDefinition.ActivityType, toolDefinition.DisplayName);
                    }
                    category.Add(tool);
                }

                ctrl.Categories.Add(category);
            }

            //After converting the native activity icons to local resources, this is not needed anymore.  Keeping the code here because I know I'm going to want this as referenced code
            //Collapse all categories.  This speeds up loading significantly.
            //ctrl.CategoryItemStyle =
            //  new System.Windows.Style(typeof(TreeViewItem))
            //  {
            //    Setters = { new Setter(TreeViewItem.IsExpandedProperty, false) }
            //  };

            return(ctrl);
        }
示例#29
0
        /// <summary>
        /// ToolboxMessaging
        /// </summary>
        /// <returns></returns>
        internal static ToolboxCategory GetToolboxMessaging()
        {
            ToolboxCategory category = new ToolboxCategory(Properties.Resources.ToolboxMessaging);

            category.Add(new ToolboxItemWrapper(typeof(System.ServiceModel.Activities.CorrelationScope)));
            category.Add(new ToolboxItemWrapper(typeof(System.ServiceModel.Activities.InitializeCorrelation)));
            category.Add(new ToolboxItemWrapper(typeof(System.ServiceModel.Activities.Receive)));
            category.Add(new ToolboxItemWrapper(typeof(System.ServiceModel.Activities.Presentation.Factories.ReceiveAndSendReplyFactory)));
            category.Add(new ToolboxItemWrapper(typeof(System.ServiceModel.Activities.Send)));
            category.Add(new ToolboxItemWrapper(typeof(System.ServiceModel.Activities.Presentation.Factories.SendAndReceiveReplyFactory)));
            category.Add(new ToolboxItemWrapper(typeof(System.ServiceModel.Activities.TransactedReceiveScope)));
            return(category);
        }
示例#30
0
        public ToolboxControl InitializeSnippets()
        {
            try
            {
                var Toolbox = new ToolboxControl();
                var cs      = new Dictionary <string, ToolboxCategory>();
                foreach (var s in Plugins.Snippets)
                {
                    try
                    {
                        if (!cs.ContainsKey(s.Category))
                        {
                            cs.Add(s.Category, new ToolboxCategory(s.Category));
                        }
                        ToolboxCategory cat = cs[s.Category];
                        var             t   = dag.AppendSubWorkflowTemplate(s.Name, s.Xaml);
                        cat.Add(new ToolboxItemWrapper(t, s.Name));
                    }
                    catch (Exception ex)
                    {
                        Log.Error(ex.ToString());
                    }
                }
                try
                {
                    dag.Save();
                }
                catch (Exception)
                {
                }
                foreach (var c in cs)
                {
                    try
                    {
                        Toolbox.Categories.Add(c.Value);
                    }
                    catch (Exception ex)
                    {
                        Log.Error(ex.ToString());
                    }
                }

                return(Toolbox);
            }
            catch (Exception ex)
            {
                Log.Error(ex, "");
                MessageBox.Show("InitializeSnippets: " + ex.Message);
                return(null);
            }
        }