Ejemplo n.º 1
0
        private void ParameterChanged(object sender, EventArgs e)
        {
            TextBox      tSender = (TextBox)sender;
            WorkflowItem wItem   = (WorkflowItem)lstSelectedOperations.SelectedItem;

            wItem.Parameters[tSender.Tag.ToString()] = tSender.Text;
        }
Ejemplo n.º 2
0
        private void lstSelectedOperations_SelectedIndexChanged(object sender, EventArgs e)
        {
            pnlParams.Controls.Clear();
            if (lstSelectedOperations.SelectedItem == null)
            {
                return;
            }

            WorkflowItem wItem = (WorkflowItem)lstSelectedOperations.SelectedItem;
            int          index = 0;

            foreach (var param in wItem.Parameters)
            {
                Label pLabel = new Label();
                pLabel.Text     = $"{param.Key}:";
                pLabel.Location = new Point(10, 10 + index * 25);
                pLabel.AutoSize = true;
                TextBox pTbx = new TextBox();
                pTbx.Text = currentWorkflow.Pars[lstSelectedOperations.SelectedIndex][0].ToString();

                pTbx.TextChanged += ParameterChanged;
                pTbx.Tag          = param.Key;
                pTbx.KeyDown     += AcceptParam;
                pTbx.Tag          = lstSelectedOperations.SelectedIndex;
                pTbx.Location     = new Point(pLabel.Location.X + pLabel.Width, pLabel.Location.Y);
                pTbx.Width        = 30;

                if (pnlParams.Controls.Count == 0)
                {
                    pnlParams.Controls.Add(pLabel);
                    pnlParams.Controls.Add(pTbx);
                }
                ++index;
            }
        }
Ejemplo n.º 3
0
        private void loadWorkflowToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Workflow       wkf = new Workflow();
            OpenFileDialog of  = new OpenFileDialog();

            of.InitialDirectory = WorkflowFolder;
            of.Filter           = "Workflow files (*.wkf)|*.wkf";
            if (of.ShowDialog() == DialogResult.OK)
            {
                WorkflowFolder = Path.GetDirectoryName(of.FileName);
                currentWorkflow.initWorkflow();
                lstSelectedOperations.Items.Clear();
                pnlParams.Controls.Clear();
                wkf.LoadWorkflowFile(of.FileName);
                tbxName.Text       = Path.GetFileNameWithoutExtension(of.FileName);
                tbDescription.Text = wkf.Description;
                var operations = Assembly
                                 .GetAssembly(typeof(SingleBandOperation))
                                 .GetTypes()
                                 .Where(t => t.IsSubclassOf(typeof(SingleBandOperation)))
                                 .OrderBy(t => t.Name);
                for (int j = 0; j < wkf.Methods.Count; j++)
                {
                    foreach (Type opType in operations)
                    {
                        if (wkf.Methods[j].Contains(opType.Name))
                        {
                            WorkflowItem op = new WorkflowItem(opType);
                            lstSelectedOperations.Items.Add(op);
                            break;
                        }
                    }
                }

                currentWorkflow = wkf;
                if (lstSelectedOperations.Items.Count > 0)
                {
                    lstSelectedOperations.Enabled = true;
                    bttnRun.Enabled = true;
                }
            }
        }
Ejemplo n.º 4
0
        private void btnAddOperation_Click(object sender, EventArgs e)
        {
            if (lstSelectedOperations.Items.Count > 0)
            {
                lstSelectedOperations.Enabled = true;
            }
            if (lstAvailableOperations.SelectedItem == null)
            {
                return;
            }
            if (lstAvailableOperations.SelectedItem.ToString()[0] == '=')
            {
                return;
            }

            WorkflowItem wItem = (WorkflowItem)lstAvailableOperations.SelectedItem;

            lstSelectedOperations.Items.Add(new WorkflowItem(wItem.Operation));
            currentWorkflow.Methods.Add(wItem.ToString());
            List <string> parlist = new List <string>();
            int           lsCount = int.Parse(wItem.ToString().Split(' ')[1].Trim('(').Trim(')'));

            if (lsCount == 0)
            {
                currentWorkflow.Pars.Add(new List <string>()
                {
                    ""
                });
            }
            for (int i = 0; i < lsCount; i++)
            {
                currentWorkflow.Pars.Add(new List <string>()
                {
                    ""
                });
            }
        }