コード例 #1
0
        private void CreateIfCondition(object sender, EventArgs e, IfrmCommandEditor parentEditor, ICommandControls commandControls)
        {
            var automationCommands = new List <AutomationCommand>()
            {
                CommandsHelper.ConvertToAutomationCommand(commandControls.GetCommandType("BeginIfCommand"))
            };
            IfrmCommandEditor editor = commandControls.CreateCommandEditorForm(automationCommands, null);

            editor.SelectedCommand     = commandControls.CreateBeginIfCommand();
            editor.ScriptEngineContext = parentEditor.ScriptEngineContext;
            editor.TypeContext         = parentEditor.TypeContext;

            if (((Form)editor).ShowDialog() == DialogResult.OK)
            {
                //get data
                var configuredCommand = editor.SelectedCommand;
                var displayText       = configuredCommand.GetDisplayValue();
                var serializedData    = JsonConvert.SerializeObject(configuredCommand);
                parentEditor.ScriptEngineContext = editor.ScriptEngineContext;
                parentEditor.TypeContext         = editor.TypeContext;

                //add to list
                v_IfConditionsTable.Rows.Add(displayText, serializedData);
            }
        }