예제 #1
0
        private void DefaultClicked(object sender, EventArgs e)
        {
            ToolStripMenuItem menu = (ToolStripMenuItem)sender;
            Type stepType          = (Type)menu.Tag;

            IStep             instance   = (IStep)Activator.CreateInstance(stepType);
            frmStepProperties properties = new frmStepProperties();

            properties.Step           = instance;
            properties.Defaults       = defaults.FirstOrDefault(kvp => kvp.Key == stepType.FullName).Value;;
            properties.FormClosed    += DefaultPropertiesClosed;
            properties.SkipValidation = true;
            properties.Show();
        }
예제 #2
0
        private void DefaultPropertiesClosed(object sender, FormClosedEventArgs e)
        {
            frmStepProperties properties = (frmStepProperties)sender;

            Type stepType = properties.Step.GetType();

            defaults[stepType.FullName] = new Dictionary <string, object>();

            foreach (PropertyInfo property in stepType.GetProperties().Where(p => p.GetCustomAttribute <DoNotSetAttribute>() == null))
            {
                defaults[stepType.FullName][property.Name] = property.GetValue(properties.Step);
            }

            OnChangeMade();
        }
예제 #3
0
        private void mnuProperties_Click(object sender, EventArgs e)
        {
            TreeNode selectedNode = lstSteps.SelectedNode;

            if (!(selectedNode is StepTreeNode))
            {
                selectedNode = selectedNode.Parent;
            }

            StepTreeNode stepNode = (StepTreeNode)selectedNode;

            frmStepProperties properties = new frmStepProperties();

            properties.Step        = stepNode.Step;
            properties.FormClosed += new FormClosedEventHandler((form, args) => { stepNode.RefreshText(); OnChangeMade(); });
            properties.Show();
        }
예제 #4
0
        private void AddStepClicked(object sender, EventArgs e)
        {
            ToolStripMenuItem item = (ToolStripMenuItem)sender;
            Type  stepType         = (Type)item.Tag;
            IStep instance         = (IStep)Activator.CreateInstance(stepType);

            StepTreeNode node = new StepTreeNode();

            node.Step = instance;
            lstSteps.Nodes.Add(node);
            lstSteps.SelectedNode = node;

            OnChangeMade();

            frmStepProperties properties = new frmStepProperties();

            properties.Step        = instance;
            properties.Defaults    = defaults.FirstOrDefault(kvp => kvp.Key == stepType.FullName).Value;
            properties.FormClosed += new FormClosedEventHandler((form, args) => { node.RefreshText(); OnChangeMade(); });
            properties.Show();
        }