Esempio n. 1
0
        /// <summary>
        ///     Handles a double click event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TimeLineControl_DoubleClick(object sender, EventArgs e)
        {
            ModelEvent evt = GetEventUnderMouse();

            VariableUpdate variableUpdate = evt as VariableUpdate;

            if (variableUpdate != null)
            {
                ExplanationPart explain        = variableUpdate.Explanation;
                ExplainBox      explainTextBox = new ExplainBox();
                explainTextBox.SetExplanation(explain);
                GuiUtils.MdiWindow.AddChildWindow(explainTextBox);
            }

            RuleFired rulefired = evt as RuleFired;

            if (rulefired != null)
            {
                ExplanationPart explain        = rulefired.Explanation;
                ExplainBox      explainTextBox = new ExplainBox();
                explainTextBox.SetExplanation(explain);
                GuiUtils.MdiWindow.AddChildWindow(explainTextBox);
            }

            Expect expect = evt as Expect;

            if (expect != null)
            {
                Expectation expectation = expect.Expectation;

                if (expectation != null)
                {
                    ExplanationPart explanation = expect.Explanation;
                    if (explanation == null)
                    {
                        explanation = expectation.Explain;
                    }

                    ExplainBox explainTextBox = new ExplainBox();
                    explainTextBox.SetExplanation(explanation);
                    GuiUtils.MdiWindow.AddChildWindow(explainTextBox);
                }
            }

            ModelInterpretationFailure modelInterpretationFailure = evt as ModelInterpretationFailure;

            if (modelInterpretationFailure != null)
            {
                ExplainBox explainTextBox = new ExplainBox();
                explainTextBox.SetExplanation(modelInterpretationFailure.Explanation);
                GuiUtils.MdiWindow.AddChildWindow(explainTextBox);
            }
        }
Esempio n. 2
0
        /// <summary>
        ///     Handles a double click event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void watchDataGridView_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                HandlingDoubleClick = true;

                List <WatchedExpression> watches = (List <WatchedExpression>)watchDataGridView.DataSource;

                // Open a editor to edit the cell contents
                WatchedExpression selected = SelectedWatch;
                if (selected != null)
                {
                    DataGridViewCell selectedCell = watchDataGridView.SelectedCells[0];
                    if (selectedCell.ColumnIndex == 0)
                    {
                        EditorView.Window form = new EditorView.Window {
                            AutoComplete = true
                        };
                        TextChangeHandler handler = new TextChangeHandler(Instance, selected,
                                                                          selectedCell.OwningColumn.Name);
                        form.setChangeHandler(handler);
                        form.ShowDialog();

                        watchDataGridView.DataSource = null;
                        watchDataGridView.DataSource = watches;
                        EnsureEmptyRoom();
                        Refresh();
                    }
                    else if (selectedCell.ColumnIndex == 1)
                    {
                        ExplainBox explainTextBox = new ExplainBox();
                        explainTextBox.SetExplanation(selected.ExpressionTree.Explain());
                        GuiUtils.MdiWindow.AddChildWindow(explainTextBox);
                    }
                }
            }
            finally
            {
                HandlingDoubleClick = false;
            }
        }
Esempio n. 3
0
        /// <summary>
        ///     Handles a double click event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void watchDataGridView_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                HandlingDoubleClick = true;

                List<WatchedExpression> watches = (List<WatchedExpression>) watchDataGridView.DataSource;

                // Open a editor to edit the cell contents
                WatchedExpression selected = SelectedWatch;
                if (selected != null)
                {
                    DataGridViewCell selectedCell = watchDataGridView.SelectedCells[0];
                    if (selectedCell.ColumnIndex == 0)
                    {
                        EditorView.Window form = new EditorView.Window {AutoComplete = true};
                        TextChangeHandler handler = new TextChangeHandler(Instance, selected,
                            selectedCell.OwningColumn.Name);
                        form.setChangeHandler(handler);
                        form.ShowDialog();

                        watchDataGridView.DataSource = null;
                        watchDataGridView.DataSource = watches;
                        EnsureEmptyRoom();
                        Refresh();
                    }
                    else if (selectedCell.ColumnIndex == 1)
                    {
                        ExplainBox explainTextBox = new ExplainBox();
                        explainTextBox.SetExplanation(selected.ExpressionTree.Explain());
                        GuiUtils.MdiWindow.AddChildWindow(explainTextBox);
                    }
                }
            }
            finally
            {
                HandlingDoubleClick = false;
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Click!
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EventControl_Click(object sender, EventArgs e)
        {
            if (ModelEvent is RuleFired)
            {
                if (TimeLine.Window.MDIWindow.DataDictionaryWindow != null)
                {
                    RuleFired ruleFired = ModelEvent as RuleFired;
                    TimeLine.Window.MDIWindow.DataDictionaryWindow.TreeView.Select(ruleFired.RuleCondition);
                }
            }
            else if (ModelEvent is VariableUpdate)
            {
                VariableUpdate variableUpdate = ModelEvent as VariableUpdate;

                if (isDoubleClick())
                {
                    if (variableUpdate != null)
                    {
                        DataDictionary.Interpreter.ExplanationPart explain = variableUpdate.Explanation;
                        ExplainBox explainTextBox = new ExplainBox();
                        explainTextBox.setExplanation(explain);
                        MDIWindow.AddChildWindow(explainTextBox);
                    }
                }

                BaseTreeNode treeNode = null;

                if (TimeLine.Window.MDIWindow.DataDictionaryWindow != null)
                {
                    treeNode = TimeLine.Window.MDIWindow.DataDictionaryWindow.TreeView.Select(variableUpdate.Action);
                }
                if (treeNode == null)
                {
                    if (TimeLine.Window.MDIWindow.TestWindow != null)
                    {
                        TimeLine.Window.MDIWindow.TestWindow.TreeView.Select(variableUpdate.Action);
                    }
                }
            }
            else if (ModelEvent is Expect)
            {
                if (isDoubleClick())
                {
                    DataDictionary.Tests.Expectation expectation = getExpectation();

                    if (expectation != null)
                    {
                        DataDictionary.Interpreter.ExplanationPart explain = expectation.ExpressionTree.Explain();
                        ExplainBox explainTextBox = new ExplainBox();
                        explainTextBox.setExplanation(explain);
                        MDIWindow.AddChildWindow(explainTextBox);
                    }
                }

                if (TimeLine.Window.MDIWindow.TestWindow != null)
                {
                    TimeLine.Window.MDIWindow.TestWindow.TreeView.Select((ModelEvent as Expect).Expectation);
                }
            }

            lastClick = DateTime.Now;
        }
        /// <summary>
        ///     Handles a double click event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TimeLineControl_DoubleClick(object sender, EventArgs e)
        {
            ModelEvent evt = GetEventUnderMouse();

            VariableUpdate variableUpdate = evt as VariableUpdate;
            if (variableUpdate != null)
            {
                ExplanationPart explain = variableUpdate.Explanation;
                ExplainBox explainTextBox = new ExplainBox();
                explainTextBox.SetExplanation(explain);
                GuiUtils.MdiWindow.AddChildWindow(explainTextBox);
            }

            RuleFired rulefired = evt as RuleFired;
            if (rulefired != null)
            {
                ExplanationPart explain = rulefired.Explanation;
                ExplainBox explainTextBox = new ExplainBox();
                explainTextBox.SetExplanation(explain);
                GuiUtils.MdiWindow.AddChildWindow(explainTextBox);
            }

            Expect expect = evt as Expect;
            if (expect != null)
            {
                Expectation expectation = expect.Expectation;

                if (expectation != null)
                {
                    ExplanationPart explanation = expect.Explanation;
                    if (explanation == null)
                    {
                        explanation = expectation.Explain;
                    }

                    ExplainBox explainTextBox = new ExplainBox();
                    explainTextBox.SetExplanation(explanation);
                    GuiUtils.MdiWindow.AddChildWindow(explainTextBox);
                }
            }

            ModelInterpretationFailure modelInterpretationFailure = evt as ModelInterpretationFailure;
            if (modelInterpretationFailure != null)
            {
                ExplainBox explainTextBox = new ExplainBox();
                explainTextBox.SetExplanation(modelInterpretationFailure.Explanation);
                GuiUtils.MdiWindow.AddChildWindow(explainTextBox);
            }
        }
        /// <summary>
        /// Click!
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EventControl_Click(object sender, EventArgs e)
        {
            if (ModelEvent is RuleFired)
            {
                if (TimeLine.Window.MDIWindow.DataDictionaryWindow != null)
                {
                    RuleFired ruleFired = ModelEvent as RuleFired;
                    TimeLine.Window.MDIWindow.DataDictionaryWindow.TreeView.Select(ruleFired.RuleCondition);
                }
            }
            else if (ModelEvent is VariableUpdate)
            {
                VariableUpdate variableUpdate = ModelEvent as VariableUpdate;

                if (isDoubleClick())
                {
                    if (variableUpdate != null)
                    {
                        DataDictionary.Interpreter.ExplanationPart explain = variableUpdate.Explanation;
                        ExplainBox explainTextBox = new ExplainBox();
                        explainTextBox.setExplanation(explain);
                        MDIWindow.AddChildWindow(explainTextBox);
                    }
                }

                BaseTreeNode treeNode = null;

                if (TimeLine.Window.MDIWindow.DataDictionaryWindow != null)
                {
                    treeNode = TimeLine.Window.MDIWindow.DataDictionaryWindow.TreeView.Select(variableUpdate.Action);
                }
                if (treeNode == null)
                {
                    if (TimeLine.Window.MDIWindow.TestWindow != null)
                    {
                        TimeLine.Window.MDIWindow.TestWindow.TreeView.Select(variableUpdate.Action);
                    }
                }
            }
            else if (ModelEvent is Expect)
            {
                if (isDoubleClick())
                {
                    DataDictionary.Tests.Expectation expectation = getExpectation();

                    if (expectation != null)
                    {
                        DataDictionary.Interpreter.ExplanationPart explain = expectation.ExpressionTree.Explain();
                        ExplainBox explainTextBox = new ExplainBox();
                        explainTextBox.setExplanation(explain);
                        MDIWindow.AddChildWindow(explainTextBox);
                    }
                }

                if (TimeLine.Window.MDIWindow.TestWindow != null)
                {
                    TimeLine.Window.MDIWindow.TestWindow.TreeView.Select((ModelEvent as Expect).Expectation);
                }
            }

            lastClick = DateTime.Now;
        }