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

            editor.SelectedCommand = new BeginWhileCommand();
            editor.ScriptContext   = parentEditor.ScriptContext;
            editor.TypeContext     = parentEditor.TypeContext;

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

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

            commandControls.AddIntellisenseListBoxToCommandForm();
        }
コード例 #2
0
        public void ShowRecorder(object sender, EventArgs e, IfrmCommandEditor editor, ICommandControls commandControls)
        {
            //create recorder
            IfrmWebElementRecorder newElementRecorder = commandControls.CreateWebElementRecorderForm(editor.HTMLElementRecorderURL);

            newElementRecorder.ScriptContext = editor.ScriptContext;
            newElementRecorder.CheckBox_StopOnClick(true);
            //show form
            ((Form)newElementRecorder).ShowDialog();

            editor.HTMLElementRecorderURL = newElementRecorder.StartURL;

            try
            {
                if (newElementRecorder.SearchParameters != null)
                {
                    v_SeleniumSearchParameters.Rows.Clear();

                    foreach (DataRow rw in newElementRecorder.SearchParameters.Rows)
                    {
                        v_SeleniumSearchParameters.ImportRow(rw);
                    }
                }
            }
            catch (Exception)
            {
                //Search parameter not found
            }

            commandControls.AddIntellisenseListBoxToCommandForm();
        }
コード例 #3
0
        private void WhileConditionHelper_CellContentClick(object sender, DataGridViewCellEventArgs e, IfrmCommandEditor parentEditor, ICommandControls commandControls)
        {
            var senderGrid = (DataGridView)sender;

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0)
            {
                var buttonSelected = senderGrid.Rows[e.RowIndex].Cells[e.ColumnIndex] as DataGridViewButtonCell;
                var selectedRow    = v_WhileConditionsTable.Rows[e.RowIndex];

                if (buttonSelected.Value.ToString() == "Edit")
                {
                    //launch editor
                    var statement    = selectedRow["Statement"];
                    var commandData  = selectedRow["CommandData"].ToString();
                    var whileCommand = JsonConvert.DeserializeObject <BeginWhileCommand>(commandData);

                    var automationCommands = new List <AutomationCommand>()
                    {
                        CommandsHelper.ConvertToAutomationCommand(typeof(BeginWhileCommand))
                    };
                    IfrmCommandEditor editor = commandControls.CreateCommandEditorForm(automationCommands, null);
                    editor.SelectedCommand      = new BeginWhileCommand();
                    editor.SelectedCommand      = whileCommand;
                    editor.EditingCommand       = whileCommand;
                    editor.OriginalCommand      = whileCommand;
                    editor.CreationModeInstance = CreationMode.Edit;
                    editor.ScriptContext        = parentEditor.ScriptContext;
                    editor.TypeContext          = parentEditor.TypeContext;

                    if (((Form)editor).ShowDialog() == DialogResult.OK)
                    {
                        var editedCommand  = editor.SelectedCommand as BeginWhileCommand;
                        var displayText    = editedCommand.GetDisplayValue();
                        var serializedData = JsonConvert.SerializeObject(editedCommand);

                        selectedRow["Statement"]   = displayText;
                        selectedRow["CommandData"] = serializedData;
                    }

                    commandControls.AddIntellisenseListBoxToCommandForm();
                }
                else if (buttonSelected.Value.ToString() == "Delete")
                {
                    //delete
                    v_WhileConditionsTable.Rows.Remove(selectedRow);
                }
                else
                {
                    throw new NotImplementedException("Requested Action is not implemented.");
                }
            }
        }