Exemple #1
0
        internal void openToolStripButton_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = openFileDialog.ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
                foreach (string filename in openFileDialog.FileNames)
                {
                    try
                    {
                        if (System.IO.Path.GetExtension(filename).ToLower() == ".scnx")
                        {
                            ScenarioControl newScenarioControl = new ScenarioControl();
                            TestScenario    loadedScenario     = TestScenario.Load(filename);
                            newScenarioControl.FillTree(loadedScenario);
                            tabbedDocumentControl.Items.Add(System.IO.Path.GetFileNameWithoutExtension(filename), newScenarioControl);
                            tabbedDocumentControl.SelectedControl = tabbedDocumentControl.Items[tabbedDocumentControl.Items.Count - 1];
                        }
                        else if (System.IO.Path.GetExtension(filename).ToLower() == ".qlog")
                        {
                            LogViewerControl logViewerControl = new LogViewerControl();
                            logViewerControl.Filename = filename;
                            tabbedDocumentControl.Items.Add("Log - " + System.IO.Path.GetFileNameWithoutExtension(filename), logViewerControl);
                            tabbedDocumentControl.SelectedControl = tabbedDocumentControl.Items[tabbedDocumentControl.Items.Count - 1];
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Could not load '" + filename + "'\n" + ex.Message, "Error While Loading");
                    }
                }
            }
        }
Exemple #2
0
 internal void LoadScenario(string filename)
 {
     try
     {
         if (System.IO.Path.GetExtension(filename).ToLower() == ".scnx")
         {
             ScenarioControl newScenarioControl = new ScenarioControl();
             TestScenario    loadedScenario     = TestScenario.Load(filename);
             newScenarioControl.FillTree(loadedScenario);
             tabbedDocumentControl.Items.Add(System.IO.Path.GetFileNameWithoutExtension(filename), newScenarioControl);
             tabbedDocumentControl.SelectedControl = tabbedDocumentControl.Items[tabbedDocumentControl.Items.Count - 1];
         }
         else if (System.IO.Path.GetExtension(filename).ToLower() == ".qlog")
         {
             LogViewerControl logViewerControl = new LogViewerControl();
             logViewerControl.Filename = filename;
             tabbedDocumentControl.Items.Add("Log - " + System.IO.Path.GetFileNameWithoutExtension(filename), logViewerControl);
             tabbedDocumentControl.SelectedControl = tabbedDocumentControl.Items[tabbedDocumentControl.Items.Count - 1];
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Could not load '" + filename + "'\n" + ex.Message, "Error While Loading");
     }
 }
Exemple #3
0
 internal void SaveItem(ScenarioControl control)
 {
     if (control != null && control.TestScenario != null)
     {
         //control.SetNodeIDs();
         if (control.TestScenario.Filename == "Unknown Scenario.scn")
         {
             DialogResult dr = saveFileDialog.ShowDialog();
             if (dr == DialogResult.OK)
             {
                 if (!string.IsNullOrEmpty(saveFileDialog.FileName))
                 {
                     control.TestScenario.Filename = saveFileDialog.FileName;
                     control.TestScenario.Save();
                     tabbedDocumentControl.ItemTitles[control] = System.IO.Path.GetFileNameWithoutExtension(saveFileDialog.FileName);
                 }
             }
         }
         else
         {
             control.TestScenario.Save();
             tabbedDocumentControl.ItemTitles[control] = tabbedDocumentControl.ItemTitles[control].TrimStart('*');
         }
     }
 }
Exemple #4
0
        internal void newToolStripButton_Click(object sender, EventArgs e)
        {
            ScenarioControl newScenarioControl = new ScenarioControl();
            TestScenario    newTestScenario    = new TestScenario();

            newScenarioControl.FillTree(newTestScenario);
            tabbedDocumentControl.Items.Add("Unknown Scenario", newScenarioControl);
        }
Exemple #5
0
        internal void redoToolStripButton_Click(object sender, EventArgs e)
        {
            ScenarioControl currentScenarioControl = tabbedDocumentControl.SelectedControl as ScenarioControl;

            if (currentScenarioControl != null)
            {
                currentScenarioControl.MenuRedoClicked(this, EventArgs.Empty);
            }
        }
Exemple #6
0
        private void selectPurpleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ScenarioControl sc = executionContainer.dockManager.tabbedScenarioControl.tabbedDocumentControl.SelectedControl as ScenarioControl;

            if (sc != null)
            {
                sc.CheckNodeByColor(Color.Purple, selectPurpleToolStripMenuItem.Checked);
            }
        }
Exemple #7
0
        private void toggleBreakpointToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ScenarioControl sc = executionContainer.dockManager.tabbedScenarioControl.tabbedDocumentControl.SelectedControl as ScenarioControl;

            if (sc != null && sc.TestScenario != null)
            {
                sc.SetBPToolStripMenuItem_Click(null, EventArgs.Empty);
            }
        }
Exemple #8
0
        private void findToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ScenarioControl sc = executionContainer.dockManager.tabbedScenarioControl.tabbedDocumentControl.SelectedControl as ScenarioControl;

            if (sc != null)
            {
                SubForms.FindForm form = new QAliber.Builder.Presentation.SubForms.FindForm(sc);
                form.Show();
            }
        }
Exemple #9
0
        private void scenarioControl_ScenarioChanged(object sender, ScenarioChangedEventArgs e)
        {
            ScenarioControl s = sender as ScenarioControl;

            if (s != null)
            {
                string title = tabbedDocumentControl.ItemTitles[s];
                if (!string.IsNullOrEmpty(title) && !title.StartsWith("*"))
                {
                    tabbedDocumentControl.ItemTitles[s] = "*" + title;
                }
            }
        }
Exemple #10
0
        internal void saveToolStripButton_Click(object sender, EventArgs e)
        {
            try
            {
                ScenarioControl currentScenarioControl = tabbedDocumentControl.SelectedControl as ScenarioControl;

                SaveItem(currentScenarioControl);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Could not save!\n" + ex.Message, "Error While Saving");
            }
        }
Exemple #11
0
 internal void saveAllToolStripButton_Click(object sender, EventArgs e)
 {
     foreach (Control c in tabbedDocumentControl.Items)
     {
         ScenarioControl sc = c as ScenarioControl;
         if (sc != null)
         {
             try
             {
                 SaveItem(sc);
             }
             catch (Exception ex)
             {
                 MessageBox.Show("Could not save '" + sc.TestScenario.Filename + "'\n" + ex.Message, "Error While Saving");
             }
         }
     }
 }
Exemple #12
0
 private void AfterDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
 {
     if (e.Node != null && e.Node.Nodes.Count == 0)
     {
         TestCase testcase = e.Node.Tag as TestCase;
         if (testcase != null)
         {
             MainForm form = FindForm() as MainForm;
             if (form != null)
             {
                 ScenarioControl sc = form.executionContainer.dockManager.tabbedScenarioControl.tabbedDocumentControl.SelectedControl as ScenarioControl;
                 if (sc != null)
                 {
                     sc.AddTestCaseAfterCurrentNode(testcase);
                 }
             }
         }
     }
 }
Exemple #13
0
        internal void SaveAsItem()
        {
            ScenarioControl control = tabbedDocumentControl.SelectedControl as ScenarioControl;

            if (control != null && control.TestScenario != null)
            {
                //control.SetNodeIDs();

                DialogResult dr = saveFileDialog.ShowDialog();
                if (dr == DialogResult.OK)
                {
                    if (!string.IsNullOrEmpty(saveFileDialog.FileName))
                    {
                        control.TestScenario.Filename = saveFileDialog.FileName;
                        control.TestScenario.Save();
                        tabbedDocumentControl.ItemTitles[control] = System.IO.Path.GetFileNameWithoutExtension(saveFileDialog.FileName);
                    }
                }
            }
        }
Exemple #14
0
 internal void CloseItem(object sender, EventArgs e)
 {
     try
     {
         ScenarioControl currentScenarioControl = tabbedDocumentControl.SelectedControl as ScenarioControl;
         if (currentScenarioControl != null)
         {
             tabbedDocumentControl.Items.Remove(currentScenarioControl);
         }
         else
         {
             LogViewerControl currentLogViewControl = tabbedDocumentControl.SelectedControl as LogViewerControl;
             if (currentLogViewControl != null)
             {
                 tabbedDocumentControl.Items.Remove(currentLogViewControl);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Could not close!\n" + ex.Message, "Error While Closing");
     }
 }
Exemple #15
0
        private void tabbedDocumentControl_BeforeDocumentRemovedByUser(Darwen.Windows.Forms.Controls.TabbedDocuments.TabbedDocumentControl documentControl, Control control)
        {
            ScenarioControl sc = control as ScenarioControl;

            if (sc != null)
            {
                if (tabbedDocumentControl.ItemTitles[control].StartsWith("*"))
                {
                    DialogResult dr = MessageBox.Show("Do you want to save the file before closing ?", "Save ?", MessageBoxButtons.YesNo);
                    switch (dr)
                    {
                    case DialogResult.No:
                        break;

                    case DialogResult.Yes:
                        SaveItem(sc);
                        break;

                    default:
                        break;
                    }
                }
            }
        }