コード例 #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);
            }
        }
コード例 #2
0
ファイル: Window.cs プロジェクト: fakoor/ERTMSFormalSpecs
        /// <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;
            }
        }
コード例 #3
0
ファイル: Window.cs プロジェクト: JamesOakey/ERTMSFormalSpecs
        /// <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;
            }
        }
コード例 #4
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);
            }
        }