/// <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();
     }
 }
 /// <summary>
 /// Adds the category.
 /// </summary>
 /// <param name="items">The items.</param>
 /// <remarks></remarks>
 public void AddCategory(ToolboxCategoryItems items)
 {
     foreach (var i in items)
     {
         _control.Categories.Add(i);
     }
 }
        public void LoadToolboxItems(string fileName, ToolboxCategoryItems container, bool resetContainer)
        {
            if (string.IsNullOrEmpty(fileName))
            {
                throw FxTrace.Exception.AsError(new ArgumentNullException("fileName"));
            }

            if (null == container)
            {
                throw FxTrace.Exception.AsError(new ArgumentNullException("container"));
            }

            if (resetContainer)
            {
                container.Clear();
            }

            using (StreamReader reader = File.OpenText(fileName))
            {
                string entry = null;
                ToolboxCategory category = null;
                while (null != (entry = reader.ReadLine()))
                {
                    entry = entry.Trim();
                    if (entry.Length > 1 && (entry[0] != ';' && entry[0] != '#'))
                    {
                        if (entry.StartsWith("[", StringComparison.CurrentCulture) && entry.EndsWith("]", StringComparison.CurrentCulture))
                        {
                            string categoryName = entry.Substring(1, entry.Length - 2);
                            category = GetCategoryItem(container, categoryName);
                        }
                        else
                        {
                            if (null == category)
                            {
                                category = GetCategoryItem(container, DefaultCategory);
                            }
                            string[] toolDefinition = entry.Split(';');

                            string toolName = null;
                            string assembly = null;
                            string displayName = null;
                            string bitmap = null;

                            if (GetToolAssemblyAndName(toolDefinition, ref toolName, ref assembly))
                            {
                                GetBitmap(toolDefinition, ref bitmap);
                                GetDisplayName(toolDefinition, ref displayName);
                                category.Add(new ToolboxItemWrapper(toolName, assembly, bitmap, displayName));
                            }
                            else
                            {
                                throw FxTrace.Exception.AsError(new ArgumentOutOfRangeException(FormatExceptionText));
                            }
                        }
                    }
                }
            }
        }
        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);
        }
        /// <summary>
        /// Builds the send activity box.
        /// </summary>
        /// <param name="it">It.</param>
        /// <remarks></remarks>
        private void BuildSendActivityBox(DiscoItem it, ToolboxCategoryItems items)
        {
            var cat = new ToolboxCategory(it.Contract);
            var ops = MetadataHelper
                      .GetOperationDescriptions(it.Endpoint + "/mex")
                      .First()
                      .DeclaringContract
                      .Operations;
            var httpEndpoint = MetadataHelper
                               .GetEndpoints(it.Endpoint + "/mex").FirstOrDefault(x => x.Address.Uri.Scheme == Uri.UriSchemeHttp);

            AddOperationsToCategory(httpEndpoint, ops, cat);
            items.Add(cat);
        }
Exemple #6
0
        public static ToolboxCategoryItems loadUserbox()
        {
            MySQLConnection DBConn = new MySQLConnection(new MySQLConnectionString(Configuration.getDBIp(), "workflow", Configuration.getDBUsername(), Configuration.getDBPassword()).AsString);

            if (DBConn != null)
            {
                try
                {
                    DBConn.Open();
                    string       sql1   = "set names gb2312";
                    MySQLCommand DBComm = new MySQLCommand(sql1, DBConn); //設定下達 command
                    DBComm.ExecuteNonQuery();
                    DBComm.Dispose();
                    string           sql           = "select * from tb_user";
                    MySQLDataAdapter mda           = new MySQLDataAdapter(sql, DBConn);
                    DataTable        UserDataTable = new DataTable();
                    mda.Fill(UserDataTable);
                    DBConn.Close();
                    loadSystemIcon();

                    ToolboxCategoryItems toolboxCategoryItems = new ToolboxCategoryItems();
                    ToolboxCategory      users = new System.Activities.Presentation.Toolbox.ToolboxCategory("系统工作人员");

                    foreach (DataRow dr in UserDataTable.Rows)
                    {
                        //byte[] temp = Encoding.Default.GetBytes(dr["User_Name"].ToString());
                        //temp = System.Text.Encoding.Convert(Encoding.GetEncoding("utf8"), Encoding.GetEncoding("gb2312"), temp);
                        //string username = Encoding.Default.GetString(temp);
                        //ToolboxItemWrapper User = new ToolboxItemWrapper(typeof(Wxwinter.BPM.WFDesigner.User), username);
                        ToolboxItemWrapper User = new ToolboxItemWrapper(typeof(Wxwinter.BPM.WFDesigner.User), dr["User_Name"].ToString());
                        users.Add(User);
                    }
                    toolboxCategoryItems.Add(users);
                    parentWindow.statusInfo.Text = "";
                    return(toolboxCategoryItems);
                }
                catch (Exception e)
                {
                    parentWindow.statusInfo.Text = "数据库连接失败,请检查网络设置和数据库连接配置";
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
        /// <summary>
        /// Creates the disco categories.
        /// </summary>
        /// <param name="items">The items.</param>
        /// <remarks></remarks>
        private void CreateDiscoCategories(ToolboxCategoryItems items)
        {
            var disco = DiscoPortal
                        .Disco
                        .GetAllEndpointAddresses()
                        .Where(x => x.Endpoint.Contains("http"))
                        .ToArray();

            foreach (var it in disco)
            {
                try
                {
                    BuildSendActivityBox(it, items);
                }
                catch (Exception)
                {
                }
            }
            ;
        }
Exemple #8
0
        public static ToolboxCategoryItems loadTemplatebox()
        {
            MySQLConnection DBConn = new MySQLConnection(new MySQLConnectionString(Configuration.getDBIp(), "template", Configuration.getDBUsername(), Configuration.getDBPassword()).AsString);
            if (DBConn != null)
            {
                try
                {
                    DBConn.Open();
                    string sql = "select * from template";
                    MySQLDataAdapter mda = new MySQLDataAdapter(sql, DBConn);
                    MySQLCommand mcd = new MySQLCommand(sql, DBConn);
                    mcd.ExecuteNonQuery();
                    DataTable TemplateDataTable = new DataTable();
                    mda.Fill(TemplateDataTable);
                    DBConn.Close();
                    loadSystemIcon();

                    ToolboxCategoryItems toolboxCategoryItems = new ToolboxCategoryItems();
                    ToolboxCategory templates = new System.Activities.Presentation.Toolbox.ToolboxCategory("表单模板");

                    foreach (DataRow dr in TemplateDataTable.Rows)
                    {
                        ToolboxItemWrapper Template = new ToolboxItemWrapper(typeof(Wxwinter.BPM.WFDesigner.Template), dr["NAME"].ToString());
                        templates.Add(Template);
                    }
                    toolboxCategoryItems.Add(templates);
                    parentWindow.statusInfo.Text = "";
                    return toolboxCategoryItems;
                }
                catch (Exception e)
                {
                    parentWindow.statusInfo.Text = "数据库连接失败,请检查网络设置和数据库连接配置";
                    return null;
                }
                
            }
            else
            {
                return null;
            }
        }
Exemple #9
0
        public static ToolboxCategoryItems loadTemplatebox()
        {
            MySQLConnection DBConn = new MySQLConnection(new MySQLConnectionString(Configuration.getDBIp(), "template", Configuration.getDBUsername(), Configuration.getDBPassword()).AsString);

            if (DBConn != null)
            {
                try
                {
                    DBConn.Open();
                    string           sql = "select * from template";
                    MySQLDataAdapter mda = new MySQLDataAdapter(sql, DBConn);
                    MySQLCommand     mcd = new MySQLCommand(sql, DBConn);
                    mcd.ExecuteNonQuery();
                    DataTable TemplateDataTable = new DataTable();
                    mda.Fill(TemplateDataTable);
                    DBConn.Close();
                    loadSystemIcon();

                    ToolboxCategoryItems toolboxCategoryItems = new ToolboxCategoryItems();
                    ToolboxCategory      templates            = new System.Activities.Presentation.Toolbox.ToolboxCategory("表单模板");

                    foreach (DataRow dr in TemplateDataTable.Rows)
                    {
                        ToolboxItemWrapper Template = new ToolboxItemWrapper(typeof(Wxwinter.BPM.WFDesigner.Template), dr["NAME"].ToString());
                        templates.Add(Template);
                    }
                    toolboxCategoryItems.Add(templates);
                    parentWindow.statusInfo.Text = "";
                    return(toolboxCategoryItems);
                }
                catch (Exception e)
                {
                    parentWindow.statusInfo.Text = "数据库连接失败,请检查网络设置和数据库连接配置";
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
 ToolboxCategory GetCategoryItem(ToolboxCategoryItems container, string categoryName)
 {
     foreach (ToolboxCategory category in container)
     {
         if (0 == string.Compare(category.CategoryName, categoryName, true, CultureInfo.CurrentUICulture))
         {
             return category;
         }
     }
     ToolboxCategory newCategory = new ToolboxCategory(categoryName);
     container.Add(newCategory);
     return newCategory;
 }
 public ToolboxControl()
 {
     var callback = new NotifyCollectionChangedEventHandler(this.OnCategoryCollectionChanged);
     this.categories = new ToolboxCategoryItems(callback);
 }
Exemple #12
0
        public static ToolboxCategoryItems loadToolbox()
        {
            loadSystemIcon();

            ToolboxCategoryItems toolboxCategoryItems = new ToolboxCategoryItems();

            //流程图
            ToolboxItemWrapper flowchar = new ToolboxItemWrapper(typeof(System.Activities.Statements.Flowchart), "Flowchart");
            ToolboxItemWrapper flowDecision = new ToolboxItemWrapper(typeof(System.Activities.Statements.FlowDecision), "FlowDecision");
            ToolboxItemWrapper flowSwitch = new ToolboxItemWrapper(typeof(System.Activities.Statements.FlowSwitch<string>), "FlowSwitch");

            ToolboxCategory wf4Flowchar = new System.Activities.Presentation.Toolbox.ToolboxCategory("流程图");

            wf4Flowchar.Add(flowchar);
            wf4Flowchar.Add(flowDecision);
            wf4Flowchar.Add(flowSwitch);

            toolboxCategoryItems.Add(wf4Flowchar);

            //状态机

            ToolboxItemWrapper stateMachineWithInitialStateFactory = new ToolboxItemWrapper(typeof(Machine.Design.ToolboxItems.StateMachineWithInitialStateFactory), "状态机流程");
            ToolboxItemWrapper state = new ToolboxItemWrapper(typeof(Machine.State), "节点");
            ToolboxCategory stateMachineActivity = new System.Activities.Presentation.Toolbox.ToolboxCategory("状态机");

            stateMachineActivity.Add(stateMachineWithInitialStateFactory);
            stateMachineActivity.Add(state);

            toolboxCategoryItems.Add(stateMachineActivity);

            //WF4.0 Activity
            ToolboxItemWrapper writeLine = new ToolboxItemWrapper(typeof(System.Activities.Statements.WriteLine), "WriteLine");
            ToolboxItemWrapper sequence = new ToolboxItemWrapper(typeof(System.Activities.Statements.Sequence), "Sequence");
            ToolboxItemWrapper Assign = new ToolboxItemWrapper(typeof(System.Activities.Statements.Assign), "Assign");
            ToolboxItemWrapper Delay = new ToolboxItemWrapper(typeof(System.Activities.Statements.Delay), "Delay");
            ToolboxItemWrapper If = new ToolboxItemWrapper(typeof(System.Activities.Statements.If), "If");
            ToolboxItemWrapper ForEach = new ToolboxItemWrapper(typeof(System.Activities.Statements.ForEach<string>), "ForEach");
            ToolboxItemWrapper Switch = new ToolboxItemWrapper(typeof(System.Activities.Statements.Switch<string>), "Switch");
            ToolboxItemWrapper While = new ToolboxItemWrapper(typeof(System.Activities.Statements.While), "While");
            ToolboxItemWrapper DoWhile = new ToolboxItemWrapper(typeof(System.Activities.Statements.DoWhile), "DoWhile");
            ToolboxItemWrapper Parallel = new ToolboxItemWrapper(typeof(System.Activities.Statements.Parallel), "Parallel");
            ToolboxItemWrapper Pick = new ToolboxItemWrapper(typeof(System.Activities.Statements.Pick), "Pick");
            ToolboxItemWrapper PickBranch = new ToolboxItemWrapper(typeof(System.Activities.Statements.PickBranch), "PickBranch");

            ToolboxCategory wf4Activity = new System.Activities.Presentation.Toolbox.ToolboxCategory("Activity");

            wf4Activity.Add(writeLine);
            wf4Activity.Add(sequence);
            wf4Activity.Add(Assign);
            wf4Activity.Add(Delay);
            wf4Activity.Add(If);
            wf4Activity.Add(ForEach);
            wf4Activity.Add(Switch);
            wf4Activity.Add(While);
            wf4Activity.Add(DoWhile);
            wf4Activity.Add(Parallel);
            wf4Activity.Add(Pick);
            wf4Activity.Add(PickBranch);

            toolboxCategoryItems.Add(wf4Activity);

            //文档活动
            //ToolboxItemWrapper StartActivity = new ToolboxItemWrapper(typeof(StartActivity), "开始活动");
            ToolboxItemWrapper DocActivity = new ToolboxItemWrapper(typeof(DocActivity), "文档审批");
            ToolboxItemWrapper EndActivity = new ToolboxItemWrapper(typeof(EndActivity), "结束活动");
            ToolboxCategory DocActivitys = new System.Activities.Presentation.Toolbox.ToolboxCategory("文档活动");
            //DocActivitys.Add(StartActivity);
            DocActivitys.Add(DocActivity);
            DocActivitys.Add(EndActivity);

            toolboxCategoryItems.Add(DocActivitys);

            return toolboxCategoryItems;
        }
Exemple #13
0
        public static ToolboxCategoryItems loadToolbox()
        {
            loadSystemIcon();

            ToolboxCategoryItems toolboxCategoryItems = new ToolboxCategoryItems();

            //流程图
            ToolboxItemWrapper flowchar     = new ToolboxItemWrapper(typeof(System.Activities.Statements.Flowchart), "Flowchart");
            ToolboxItemWrapper flowDecision = new ToolboxItemWrapper(typeof(System.Activities.Statements.FlowDecision), "FlowDecision");
            ToolboxItemWrapper flowSwitch   = new ToolboxItemWrapper(typeof(System.Activities.Statements.FlowSwitch <string>), "FlowSwitch");

            ToolboxCategory wf4Flowchar = new System.Activities.Presentation.Toolbox.ToolboxCategory("流程图");

            wf4Flowchar.Add(flowchar);
            wf4Flowchar.Add(flowDecision);
            wf4Flowchar.Add(flowSwitch);

            toolboxCategoryItems.Add(wf4Flowchar);

            //状态机

            ToolboxItemWrapper stateMachineWithInitialStateFactory = new ToolboxItemWrapper(typeof(Machine.Design.ToolboxItems.StateMachineWithInitialStateFactory), "状态机流程");
            ToolboxItemWrapper state = new ToolboxItemWrapper(typeof(Machine.State), "节点");
            ToolboxCategory    stateMachineActivity = new System.Activities.Presentation.Toolbox.ToolboxCategory("状态机");

            stateMachineActivity.Add(stateMachineWithInitialStateFactory);
            stateMachineActivity.Add(state);

            toolboxCategoryItems.Add(stateMachineActivity);



            //WF4.0 Activity
            ToolboxItemWrapper writeLine  = new ToolboxItemWrapper(typeof(System.Activities.Statements.WriteLine), "WriteLine");
            ToolboxItemWrapper sequence   = new ToolboxItemWrapper(typeof(System.Activities.Statements.Sequence), "Sequence");
            ToolboxItemWrapper Assign     = new ToolboxItemWrapper(typeof(System.Activities.Statements.Assign), "Assign");
            ToolboxItemWrapper Delay      = new ToolboxItemWrapper(typeof(System.Activities.Statements.Delay), "Delay");
            ToolboxItemWrapper If         = new ToolboxItemWrapper(typeof(System.Activities.Statements.If), "If");
            ToolboxItemWrapper ForEach    = new ToolboxItemWrapper(typeof(System.Activities.Statements.ForEach <string>), "ForEach");
            ToolboxItemWrapper Switch     = new ToolboxItemWrapper(typeof(System.Activities.Statements.Switch <string>), "Switch");
            ToolboxItemWrapper While      = new ToolboxItemWrapper(typeof(System.Activities.Statements.While), "While");
            ToolboxItemWrapper DoWhile    = new ToolboxItemWrapper(typeof(System.Activities.Statements.DoWhile), "DoWhile");
            ToolboxItemWrapper Parallel   = new ToolboxItemWrapper(typeof(System.Activities.Statements.Parallel), "Parallel");
            ToolboxItemWrapper Pick       = new ToolboxItemWrapper(typeof(System.Activities.Statements.Pick), "Pick");
            ToolboxItemWrapper PickBranch = new ToolboxItemWrapper(typeof(System.Activities.Statements.PickBranch), "PickBranch");


            ToolboxCategory wf4Activity = new System.Activities.Presentation.Toolbox.ToolboxCategory("Activity");

            wf4Activity.Add(writeLine);
            wf4Activity.Add(sequence);
            wf4Activity.Add(Assign);
            wf4Activity.Add(Delay);
            wf4Activity.Add(If);
            wf4Activity.Add(ForEach);
            wf4Activity.Add(Switch);
            wf4Activity.Add(While);
            wf4Activity.Add(DoWhile);
            wf4Activity.Add(Parallel);
            wf4Activity.Add(Pick);
            wf4Activity.Add(PickBranch);

            toolboxCategoryItems.Add(wf4Activity);


            //文档活动
            //ToolboxItemWrapper StartActivity = new ToolboxItemWrapper(typeof(StartActivity), "开始活动");
            ToolboxItemWrapper DocActivity  = new ToolboxItemWrapper(typeof(DocActivity), "文档审批");
            ToolboxItemWrapper EndActivity  = new ToolboxItemWrapper(typeof(EndActivity), "结束活动");
            ToolboxCategory    DocActivitys = new System.Activities.Presentation.Toolbox.ToolboxCategory("文档活动");

            //DocActivitys.Add(StartActivity);
            DocActivitys.Add(DocActivity);
            DocActivitys.Add(EndActivity);

            toolboxCategoryItems.Add(DocActivitys);

            return(toolboxCategoryItems);
        }
Exemple #14
0
        public static ToolboxCategoryItems loadToolbox()
        {
            loadSystemIcon();

            ToolboxCategoryItems toolboxCategoryItems = new ToolboxCategoryItems();

            //流程图
   /*         ToolboxItemWrapper flowchar = new ToolboxItemWrapper(typeof(System.Activities.Statements.Flowchart), "Flowchart");
            ToolboxItemWrapper flowDecision = new ToolboxItemWrapper(typeof(System.Activities.Statements.FlowDecision), "FlowDecision");
            ToolboxItemWrapper flowSwitch = new ToolboxItemWrapper(typeof(System.Activities.Statements.FlowSwitch<string>), "FlowSwitch");
            
            ToolboxCategory wf4Flowchar = new System.Activities.Presentation.Toolbox.ToolboxCategory("流程图");

            wf4Flowchar.Add(flowchar);
            wf4Flowchar.Add(flowDecision);
            wf4Flowchar.Add(flowSwitch);

            toolboxCategoryItems.Add(wf4Flowchar);

            //状态机

            ToolboxItemWrapper stateMachineWithInitialStateFactory = new ToolboxItemWrapper(typeof(Wxwinter.BPM.Machine.Design.ToolboxItems.StateMachineWithInitialStateFactory), "状态机流程");
            ToolboxItemWrapper state = new ToolboxItemWrapper(typeof(Wxwinter.BPM.Machine.State), "节点");
            ToolboxCategory stateMachineActivity = new System.Activities.Presentation.Toolbox.ToolboxCategory("状态机");

            stateMachineActivity.Add(stateMachineWithInitialStateFactory);
            stateMachineActivity.Add(state);

            */



            //WF4.0 Activity
            
            ToolboxItemWrapper writeLine = new ToolboxItemWrapper(typeof(System.Activities.Statements.WriteLine), "控制台输出");
            ToolboxItemWrapper sequence = new ToolboxItemWrapper(typeof(System.Activities.Statements.Sequence), "Sequence");
            ToolboxItemWrapper Assign = new ToolboxItemWrapper(typeof(System.Activities.Statements.Assign), "Assign");
            ToolboxItemWrapper Delay = new ToolboxItemWrapper(typeof(System.Activities.Statements.Delay), "Delay");
            ToolboxItemWrapper If = new ToolboxItemWrapper(typeof(System.Activities.Statements.If), "If");
            ToolboxItemWrapper ForEach = new ToolboxItemWrapper(typeof(System.Activities.Statements.ForEach<string>), "ForEach");
            ToolboxItemWrapper Switch = new ToolboxItemWrapper(typeof(System.Activities.Statements.Switch<string>), "Switch");
            ToolboxItemWrapper While = new ToolboxItemWrapper(typeof(System.Activities.Statements.While), "While");
            ToolboxItemWrapper DoWhile = new ToolboxItemWrapper(typeof(System.Activities.Statements.DoWhile), "DoWhile");
            ToolboxItemWrapper Parallel = new ToolboxItemWrapper(typeof(System.Activities.Statements.Parallel), "Parallel");
            ToolboxItemWrapper Pick = new ToolboxItemWrapper(typeof(System.Activities.Statements.Pick), "Pick");
            ToolboxItemWrapper PickBranch = new ToolboxItemWrapper(typeof(System.Activities.Statements.PickBranch), "PickBranch");


            ToolboxCategory wf4Activity = new System.Activities.Presentation.Toolbox.ToolboxCategory("Activity");
            
            wf4Activity.Add(writeLine);
            wf4Activity.Add(sequence);
            wf4Activity.Add(Assign);
            wf4Activity.Add(Delay);
            wf4Activity.Add(If);
            wf4Activity.Add(ForEach);
            wf4Activity.Add(Switch);
            wf4Activity.Add(While);
            wf4Activity.Add(DoWhile);
            wf4Activity.Add(Parallel);
            wf4Activity.Add(Pick);
            wf4Activity.Add(PickBranch);

            //toolboxCategoryItems.Add(wf4Activity);
           
            ToolboxItemWrapper CustomParallel = new ToolboxItemWrapper(typeof(Wxwinter.BPM.WFDesigner.CustomActivities.ParallelActivity), "并行活动");
            ToolboxItemWrapper CustomSequence = new ToolboxItemWrapper(typeof(Wxwinter.BPM.WFDesigner.CustomActivities.SequenceActivity), "串行活动");
            ToolboxItemWrapper CustomIf = new ToolboxItemWrapper(typeof(Wxwinter.BPM.WFDesigner.CustomActivities.IfActivity), "If活动");
            ToolboxItemWrapper CustomWhile = new ToolboxItemWrapper(typeof(Wxwinter.BPM.WFDesigner.CustomActivities.WhileActivity), "While循环活动");
            ToolboxItemWrapper CustomException = new ToolboxItemWrapper(typeof(Wxwinter.BPM.WFDesigner.CustomActivities.ExceptionActivity), "异常处理");
            ToolboxItemWrapper CustomEquivalent = new ToolboxItemWrapper(typeof(Wxwinter.BPM.WFDesigner.CustomActivities.Equivalent), "等价替换");
            
            ToolboxCategory CustomActivities = new System.Activities.Presentation.Toolbox.ToolboxCategory("自定义设计器");
            
            CustomActivities.Add(CustomParallel);
            CustomActivities.Add(CustomSequence);
           //CustomActivities.Add(CustomWhile);
           CustomActivities.Add(CustomIf);
           //CustomActivities.Add(CustomException);
           //CustomActivities.Add(CustomEquivalent);

       

            ToolboxItemWrapper 发起审核活动 = new ToolboxItemWrapper(typeof(Wxwinter.BPM.WFDesigner.发起审核活动), "表单流转活动");
         
            ToolboxItemWrapper Template = new ToolboxItemWrapper(typeof(Wxwinter.BPM.WFDesigner.Template), "流转表单模板");
            ToolboxItemWrapper Participant = new ToolboxItemWrapper(typeof(Wxwinter.BPM.WFDesigner.User), "参与者");
            ToolboxItemWrapper EndNode = new ToolboxItemWrapper(typeof(Wxwinter.BPM.WFDesigner.EndNode), "结束节点");
            

            CustomActivities.Add(发起审核活动);
            CustomActivities.Add(Template);
            CustomActivities.Add(Participant);
            CustomActivities.Add(EndNode);
            toolboxCategoryItems.Add(CustomActivities);


            return toolboxCategoryItems;

        }
Exemple #15
0
        public static ToolboxCategoryItems loadUserbox()
        {
            MySQLConnection DBConn = new MySQLConnection(new MySQLConnectionString(Configuration.getDBIp(), "workflow", Configuration.getDBUsername(), Configuration.getDBPassword()).AsString);
            if (DBConn != null)
            {
                try
                {
                    DBConn.Open();
                    string sql1 = "set names gb2312";
                    MySQLCommand DBComm = new MySQLCommand(sql1, DBConn); //設定下達 command
                    DBComm.ExecuteNonQuery();
                    DBComm.Dispose();
                    string sql = "select * from tb_user";
                    MySQLDataAdapter mda = new MySQLDataAdapter(sql, DBConn);
                    DataTable UserDataTable = new DataTable();
                    mda.Fill(UserDataTable);
                    DBConn.Close();
                    loadSystemIcon();

                    ToolboxCategoryItems toolboxCategoryItems = new ToolboxCategoryItems();
                    ToolboxCategory users = new System.Activities.Presentation.Toolbox.ToolboxCategory("系统工作人员");

                    foreach (DataRow dr in UserDataTable.Rows)
                    {
                        //byte[] temp = Encoding.Default.GetBytes(dr["User_Name"].ToString());
                        //temp = System.Text.Encoding.Convert(Encoding.GetEncoding("utf8"), Encoding.GetEncoding("gb2312"), temp);
                        //string username = Encoding.Default.GetString(temp);
                        //ToolboxItemWrapper User = new ToolboxItemWrapper(typeof(Wxwinter.BPM.WFDesigner.User), username);
                        ToolboxItemWrapper User = new ToolboxItemWrapper(typeof(Wxwinter.BPM.WFDesigner.User), dr["User_Name"].ToString());
                        users.Add(User);
                    }
                    toolboxCategoryItems.Add(users);
                    parentWindow.statusInfo.Text = "";
                    return toolboxCategoryItems;
                }
                catch (Exception e)
                {
                    parentWindow.statusInfo.Text = "数据库连接失败,请检查网络设置和数据库连接配置";
                    return null;
                }

            }
            else
            {
                return null;
            }
        }
Exemple #16
0
        public static ToolboxCategoryItems loadToolbox()
        {
            loadSystemIcon();

            ToolboxCategoryItems toolboxCategoryItems = new ToolboxCategoryItems();

            //流程图

            /*         ToolboxItemWrapper flowchar = new ToolboxItemWrapper(typeof(System.Activities.Statements.Flowchart), "Flowchart");
             *       ToolboxItemWrapper flowDecision = new ToolboxItemWrapper(typeof(System.Activities.Statements.FlowDecision), "FlowDecision");
             *       ToolboxItemWrapper flowSwitch = new ToolboxItemWrapper(typeof(System.Activities.Statements.FlowSwitch<string>), "FlowSwitch");
             *
             *       ToolboxCategory wf4Flowchar = new System.Activities.Presentation.Toolbox.ToolboxCategory("流程图");
             *
             *       wf4Flowchar.Add(flowchar);
             *       wf4Flowchar.Add(flowDecision);
             *       wf4Flowchar.Add(flowSwitch);
             *
             *       toolboxCategoryItems.Add(wf4Flowchar);
             *
             *       //状态机
             *
             *       ToolboxItemWrapper stateMachineWithInitialStateFactory = new ToolboxItemWrapper(typeof(Wxwinter.BPM.Machine.Design.ToolboxItems.StateMachineWithInitialStateFactory), "状态机流程");
             *       ToolboxItemWrapper state = new ToolboxItemWrapper(typeof(Wxwinter.BPM.Machine.State), "节点");
             *       ToolboxCategory stateMachineActivity = new System.Activities.Presentation.Toolbox.ToolboxCategory("状态机");
             *
             *       stateMachineActivity.Add(stateMachineWithInitialStateFactory);
             *       stateMachineActivity.Add(state);
             *
             */



            //WF4.0 Activity

            ToolboxItemWrapper writeLine  = new ToolboxItemWrapper(typeof(System.Activities.Statements.WriteLine), "控制台输出");
            ToolboxItemWrapper sequence   = new ToolboxItemWrapper(typeof(System.Activities.Statements.Sequence), "Sequence");
            ToolboxItemWrapper Assign     = new ToolboxItemWrapper(typeof(System.Activities.Statements.Assign), "Assign");
            ToolboxItemWrapper Delay      = new ToolboxItemWrapper(typeof(System.Activities.Statements.Delay), "Delay");
            ToolboxItemWrapper If         = new ToolboxItemWrapper(typeof(System.Activities.Statements.If), "If");
            ToolboxItemWrapper ForEach    = new ToolboxItemWrapper(typeof(System.Activities.Statements.ForEach <string>), "ForEach");
            ToolboxItemWrapper Switch     = new ToolboxItemWrapper(typeof(System.Activities.Statements.Switch <string>), "Switch");
            ToolboxItemWrapper While      = new ToolboxItemWrapper(typeof(System.Activities.Statements.While), "While");
            ToolboxItemWrapper DoWhile    = new ToolboxItemWrapper(typeof(System.Activities.Statements.DoWhile), "DoWhile");
            ToolboxItemWrapper Parallel   = new ToolboxItemWrapper(typeof(System.Activities.Statements.Parallel), "Parallel");
            ToolboxItemWrapper Pick       = new ToolboxItemWrapper(typeof(System.Activities.Statements.Pick), "Pick");
            ToolboxItemWrapper PickBranch = new ToolboxItemWrapper(typeof(System.Activities.Statements.PickBranch), "PickBranch");


            ToolboxCategory wf4Activity = new System.Activities.Presentation.Toolbox.ToolboxCategory("Activity");

            wf4Activity.Add(writeLine);
            wf4Activity.Add(sequence);
            wf4Activity.Add(Assign);
            wf4Activity.Add(Delay);
            wf4Activity.Add(If);
            wf4Activity.Add(ForEach);
            wf4Activity.Add(Switch);
            wf4Activity.Add(While);
            wf4Activity.Add(DoWhile);
            wf4Activity.Add(Parallel);
            wf4Activity.Add(Pick);
            wf4Activity.Add(PickBranch);

            //toolboxCategoryItems.Add(wf4Activity);

            ToolboxItemWrapper CustomParallel   = new ToolboxItemWrapper(typeof(Wxwinter.BPM.WFDesigner.CustomActivities.ParallelActivity), "并行活动");
            ToolboxItemWrapper CustomSequence   = new ToolboxItemWrapper(typeof(Wxwinter.BPM.WFDesigner.CustomActivities.SequenceActivity), "串行活动");
            ToolboxItemWrapper CustomIf         = new ToolboxItemWrapper(typeof(Wxwinter.BPM.WFDesigner.CustomActivities.IfActivity), "If活动");
            ToolboxItemWrapper CustomWhile      = new ToolboxItemWrapper(typeof(Wxwinter.BPM.WFDesigner.CustomActivities.WhileActivity), "While循环活动");
            ToolboxItemWrapper CustomException  = new ToolboxItemWrapper(typeof(Wxwinter.BPM.WFDesigner.CustomActivities.ExceptionActivity), "异常处理");
            ToolboxItemWrapper CustomEquivalent = new ToolboxItemWrapper(typeof(Wxwinter.BPM.WFDesigner.CustomActivities.Equivalent), "等价替换");

            ToolboxCategory CustomActivities = new System.Activities.Presentation.Toolbox.ToolboxCategory("自定义设计器");

            CustomActivities.Add(CustomParallel);
            CustomActivities.Add(CustomSequence);
            //CustomActivities.Add(CustomWhile);
            CustomActivities.Add(CustomIf);
            //CustomActivities.Add(CustomException);
            //CustomActivities.Add(CustomEquivalent);



            ToolboxItemWrapper 发起审核活动 = new ToolboxItemWrapper(typeof(Wxwinter.BPM.WFDesigner.发起审核活动), "表单流转活动");

            ToolboxItemWrapper Template    = new ToolboxItemWrapper(typeof(Wxwinter.BPM.WFDesigner.Template), "流转表单模板");
            ToolboxItemWrapper Participant = new ToolboxItemWrapper(typeof(Wxwinter.BPM.WFDesigner.User), "参与者");
            ToolboxItemWrapper EndNode     = new ToolboxItemWrapper(typeof(Wxwinter.BPM.WFDesigner.EndNode), "结束节点");


            CustomActivities.Add(发起审核活动);
            CustomActivities.Add(Template);
            CustomActivities.Add(Participant);
            CustomActivities.Add(EndNode);
            toolboxCategoryItems.Add(CustomActivities);


            return(toolboxCategoryItems);
        }