Example #1
0
        private CodeActivityData GetCodeActivityDataByID(string codeactivityid)
        {
            CodeActivityData assemblySelected = null;

            foreach (AssemblyData assemblyData in assemblyList)
            {
                if (assemblyData.codeActivityList != null)
                {
                    foreach (CodeActivityData codeActivity in assemblyData.codeActivityList)
                    {
                        if (codeActivity.codeActivityid.Equals(codeactivityid))
                        {
                            assemblySelected = codeActivity;
                            break;
                        }
                    }
                    if (assemblySelected != null)
                    {
                        break;
                    }
                }
            }

            return(assemblySelected);
        }
Example #2
0
        private void TxtCodeActivity_Click(object sender, EventArgs e)
        {
            if (assemblyList == null)
            {
                return;
            }

            LinkLabel        lblCodeActivity      = sender as LinkLabel;
            string           codeactivityid       = lblCodeActivity.Name.Substring(3);
            AssemblyData     assemblySelected     = GetAssemblyDataByWorkflowID(codeactivityid);
            CodeActivityData codeactivitySelected = GetCodeActivityDataByID(codeactivityid);

            ShowCodeActivityInfo(codeactivitySelected);
        }
Example #3
0
        private void ShowCodeActivity(CodeActivityData codeActivity, int x, int y)
        {
            LinkLabel lblCodeActivity = new LinkLabel();

            lblCodeActivity.Name         = "id_" + codeActivity.codeActivityid;
            lblCodeActivity.Font         = new Font("Verdana", 9, FontStyle.Regular);
            lblCodeActivity.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline;
            lblCodeActivity.AutoSize     = true;
            lblCodeActivity.Margin       = new Padding(10, 5, 10, 5);
            lblCodeActivity.Location     = new Point(x, y);
            lblCodeActivity.ForeColor    = codeActivityColor;
            lblCodeActivity.LinkColor    = codeActivityColor;

            lblCodeActivity.Click += TxtCodeActivity_Click;

            lblCodeActivity.Text = codeActivity.name;

            panelAssemblies.Controls.Add(lblCodeActivity);
        }
Example #4
0
        private void FillAssemblies()
        {
            if (assemblyList == null)
            {
                assemblyList = new List <AssemblyData>();
            }
            else
            {
                assemblyList.Clear();
            }

            String consultaFetch = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
                                          <entity name='plugintype'>
                                            <attribute name='plugintypeid' />
                                            <attribute name='name' />
                                            <attribute name='typename' />
                                            <attribute name='createdon' />
                                            <attribute name='modifiedon' />
                                            <attribute name='createdby' />
                                            <attribute name='modifiedby' />
                                            <attribute name='version' />
                                            <attribute name='pluginassemblyid' />
                                            <attribute name='customworkflowactivityinfo' />
                                            <attribute name='assemblyname' />
                                            <order attribute='assemblyname' descending='true' />
                                            <filter type='and'>
                                              <condition attribute='isworkflowactivity' operator='eq' value='1' />
                                            </filter>
                                            <link-entity name='pluginassembly' from='pluginassemblyid' to='pluginassemblyid' link-type='inner' alias='al'>
                                              <filter type='and'>
                                                <condition attribute='sourcetype' operator='eq' value='0' />
                                              </filter>
                                            </link-entity>
                                          </entity>
                                        </fetch>
                                        ";

            EntityCollection resultado = service.RetrieveMultiple(new FetchExpression(consultaFetch));

            if (resultado != null)
            {
                foreach (Entity entidad in resultado.Entities)
                {
                    if (entidad.Contains("assemblyname") && entidad.Attributes["assemblyname"] != null)
                    {
                        string pluginassemblyid = entidad.Attributes["pluginassemblyid"].ToString();
                        string assemblyname     = entidad.Attributes["assemblyname"].ToString();

                        CodeActivityData codeActivity = new CodeActivityData();

                        codeActivity.codeActivityid = entidad.Attributes["plugintypeid"].ToString().ToLower();
                        codeActivity.name           = entidad.Attributes["name"].ToString();
                        codeActivity.typename       = entidad.Attributes["typename"].ToString();
                        codeActivity.createdon      = (DateTime)entidad.Attributes["createdon"];
                        codeActivity.modifiedon     = (DateTime)entidad.Attributes["modifiedon"];
                        codeActivity.createdby      = ((EntityReference)entidad.Attributes["createdby"]).Name;
                        codeActivity.modifiedby     = ((EntityReference)entidad.Attributes["modifiedby"]).Name;
                        codeActivity.version        = entidad.Attributes["version"].ToString();

                        if (entidad.Attributes.Contains("customworkflowactivityinfo") && entidad.Attributes["customworkflowactivityinfo"] != null)
                        {
                            codeActivity.customworkflowactivityinfo = entidad.Attributes["customworkflowactivityinfo"].ToString();
                        }

                        AssemblyData assemblyData_finded = GetAssemblyDataByName(assemblyname);

                        if (assemblyData_finded == null)
                        {
                            AssemblyData assemblyData_new = new AssemblyData(-1, assemblyname, pluginassemblyid);
                            assemblyData_new.codeActivityList = new List <CodeActivityData>();
                            assemblyData_new.codeActivityList.Add(codeActivity);
                            assemblyList.Add(assemblyData_new);
                        }
                        else
                        {
                            assemblyData_finded.codeActivityList.Add(codeActivity);
                        }
                    }
                }

                // Ordenar las entidades por nombre
                GFG gg = new GFG();
                assemblyList.Sort(gg);
            }
        }
Example #5
0
        private void ShowCodeActivityInfo(CodeActivityData codeActivitySelected)
        {
            int y = MARGIN_TOP;

            panelProcessInfo.Controls.Clear();

            #region Code Activity data

            System.Windows.Forms.Label txtCodeActivityName = new System.Windows.Forms.Label();
            txtCodeActivityName.Text      = codeActivitySelected.name;
            txtCodeActivityName.Font      = new Font("Verdana", 10, FontStyle.Bold);
            txtCodeActivityName.AutoSize  = true;
            txtCodeActivityName.Location  = new Point(MARGIN_LEFT, y);
            txtCodeActivityName.ForeColor = codeActivityColor;

            panelProcessInfo.Controls.Add(txtCodeActivityName);

            y += LINES_SPACE;
            y += LINES_SPACE;
            System.Windows.Forms.Label txtCodeActivityCreatedOn = new System.Windows.Forms.Label();
            txtCodeActivityCreatedOn.Text      = "Created on " + codeActivitySelected.createdon.ToString() + " by " + codeActivitySelected.createdby.ToString();
            txtCodeActivityCreatedOn.Font      = new Font("Verdana", 9, FontStyle.Regular);
            txtCodeActivityCreatedOn.AutoSize  = true;
            txtCodeActivityCreatedOn.Location  = new Point(MARGIN_LEFT, y);
            txtCodeActivityCreatedOn.ForeColor = codeActivityColor;
            panelProcessInfo.Controls.Add(txtCodeActivityCreatedOn);

            y += LINES_SPACE;
            System.Windows.Forms.Label txtCodeActivityModifiedOn = new System.Windows.Forms.Label();
            txtCodeActivityModifiedOn.Text      = "Modified on " + codeActivitySelected.modifiedon.ToString() + " by " + codeActivitySelected.modifiedby.ToString();
            txtCodeActivityModifiedOn.Font      = new Font("Verdana", 9, FontStyle.Regular);
            txtCodeActivityModifiedOn.AutoSize  = true;
            txtCodeActivityModifiedOn.Location  = new Point(MARGIN_LEFT, y);
            txtCodeActivityModifiedOn.ForeColor = codeActivityColor;
            panelProcessInfo.Controls.Add(txtCodeActivityModifiedOn);

            #endregion Code Activity data

            #region Fill the Argument list

            if (codeActivitySelected.inArgumentList == null)
            {
                XmlDocument xDoc = new XmlDocument();

                codeActivitySelected.inArgumentList = new List <string>();
                try
                {
                    xDoc.LoadXml(codeActivitySelected.customworkflowactivityinfo);

                    // Inputs
                    XmlNodeList Inputs = xDoc.GetElementsByTagName("Inputs");

                    foreach (XmlElement node in Inputs)
                    {
                        XmlNodeList xLista = node.GetElementsByTagName("Name");

                        foreach (XmlElement nodo in xLista)
                        {
                            codeActivitySelected.inArgumentList.Add(nodo.InnerText);
                        }
                    }
                }
                catch { }

                codeActivitySelected.outArgumentList = new List <string>();
                try
                {
                    // Outputs
                    XmlNodeList Outputs = xDoc.GetElementsByTagName("Outputs");

                    foreach (XmlElement node in Outputs)
                    {
                        XmlNodeList xLista = node.GetElementsByTagName("Name");

                        foreach (XmlElement nodo in xLista)
                        {
                            codeActivitySelected.outArgumentList.Add(nodo.InnerText);
                        }
                    }
                }
                catch { }
            }

            #endregion Fill the Argument list

            #region Write the Argument list

            if (codeActivitySelected.inArgumentList != null && codeActivitySelected.outArgumentList != null)
            {
                if (codeActivitySelected.inArgumentList.Count > 0)
                {
                    // Input params
                    StringBuilder inputParams = new StringBuilder();

                    inputParams.AppendLine("Input arguments:");

                    foreach (string argument in codeActivitySelected.inArgumentList)
                    {
                        string argumentLine = "     • " + argument;
                        inputParams.AppendLine(argumentLine);
                    }


                    y += LINES_SPACE;
                    System.Windows.Forms.Label txtInputParams = new System.Windows.Forms.Label();
                    txtInputParams.Text      = inputParams.ToString();
                    txtInputParams.Font      = new Font("Verdana", 9, FontStyle.Regular);
                    txtInputParams.AutoSize  = true;
                    txtInputParams.Margin    = new Padding(20, 0, 10, 0);
                    txtInputParams.Location  = new Point(MARGIN_LEFT, y);
                    txtInputParams.ForeColor = codeActivityColor;
                    panelProcessInfo.Controls.Add(txtInputParams);

                    y += txtInputParams.Height;
                }

                if (codeActivitySelected.inArgumentList.Count > 0)
                {
                    // Output params
                    StringBuilder outputParams = new StringBuilder();

                    outputParams.AppendLine("Output arguments:");

                    foreach (string argument in codeActivitySelected.outArgumentList)
                    {
                        string argumentLine = "     • " + argument;
                        outputParams.AppendLine(argumentLine);
                    }

                    y += LINES_SPACE;
                    System.Windows.Forms.Label txtOutputParams = new System.Windows.Forms.Label();
                    txtOutputParams.Text      = outputParams.ToString();
                    txtOutputParams.Font      = new Font("Verdana", 9, FontStyle.Regular);
                    txtOutputParams.AutoSize  = true;
                    txtOutputParams.Margin    = new Padding(20, 0, 10, 0);
                    txtOutputParams.Location  = new Point(MARGIN_LEFT, y);
                    txtOutputParams.ForeColor = codeActivityColor;
                    panelProcessInfo.Controls.Add(txtOutputParams);

                    y += txtOutputParams.Height;
                }
            }

            #endregion Write the Argument list

            #region Fill the Workflow list

            if (codeActivitySelected.workflowsList == null)
            {
                foreach (WorkflowData workflow in workflowList)
                {
                    if (workflow.xaml.Contains(codeActivitySelected.name.ToLower()))
                    {
                        if (codeActivitySelected.workflowsList == null)
                        {
                            codeActivitySelected.workflowsList = new List <WorkflowData>();
                        }
                        codeActivitySelected.workflowsList.Add(workflow);
                    }
                }
            }

            #endregion Fill the Workflow list

            #region Write the workflows info

            y += LINES_SPACE;

            if (codeActivitySelected.workflowsList != null && codeActivitySelected.workflowsList.Count > 0)
            {
                System.Windows.Forms.Label txtDependences = new System.Windows.Forms.Label();
                txtDependences.Text      = "Dependences:";
                txtDependences.Font      = new Font("Verdana", 9, FontStyle.Underline);
                txtDependences.AutoSize  = true;
                txtDependences.Location  = new Point(MARGIN_LEFT, y);
                txtDependences.ForeColor = workflowColor;
                panelProcessInfo.Controls.Add(txtDependences);

                y += LINES_SPACE;

                foreach (var workflow in codeActivitySelected.workflowsList)
                {
                    Panel workflowBox = workflow.CreateWorkflowBox(MARGIN_LEFT * 2, y);
                    workflowBox.Click += WorkflowBox_Click;
                    foreach (var child in workflowBox.Controls)
                    {
                        if (child is TextBox)
                        {
                            ((TextBox)child).Click += WorkflowBox_Click;
                        }
                    }

                    panelProcessInfo.Controls.Add(workflowBox);
                    y += workflowBox.Height + LINES_SPACE;
                }
            }
            else
            {
                System.Windows.Forms.Label txtDependences = new System.Windows.Forms.Label();
                txtDependences.Text      = "There are no dependencies";
                txtDependences.Font      = new Font("Verdana", 9, FontStyle.Underline);
                txtDependences.AutoSize  = true;
                txtDependences.Location  = new Point(MARGIN_LEFT, y);
                txtDependences.ForeColor = workflowColor;
                panelProcessInfo.Controls.Add(txtDependences);
            }


            #endregion  Write the workflows info


            #region leave more space in the right side and below

            int x = 200;

            y += LINES_SPACE;
            y += LINES_SPACE;

            System.Windows.Forms.Label txtSpaceBelow = new System.Windows.Forms.Label();
            txtSpaceBelow.Text     = ".";
            txtSpaceBelow.Font     = new Font("Verdana", 8, FontStyle.Regular);
            txtSpaceBelow.AutoSize = true;
            txtSpaceBelow.Margin   = new Padding(10, 0, 10, 0);

            txtSpaceBelow.Location  = new Point(x, y);
            txtSpaceBelow.ForeColor = Color.White;

            panelProcessInfo.Controls.Add(txtSpaceBelow);
            #endregion leave more space below
        }