예제 #1
0
        private void CloseSolutionExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            Logger.LogDebug("Text-Editor-Control-CloseSolutionExecuted", "CloseSolutionExecuted");

            if (Solution.Current.IsModified != false && Solution.Current.ShowSaveDialog != false)
            {
                MessageBoxResult result = MessageBoxResult.Cancel;
                result = MessageBox.Show(Configurations.ConfirmSaveSolution,
                                         "Save Solution", MessageBoxButton.YesNoCancel, MessageBoxImage.Question);

                switch (result)
                {
                case MessageBoxResult.Yes:
                    if (SaveSolutionInternal() == false)
                    {
                        return;
                    }
                    Solution.CloseSolution(Solution.Current, false);
                    break;

                case MessageBoxResult.No:
                    // Proceed to discard the solution.
                    Solution.CloseSolution(Solution.Current, true);
                    break;

                case MessageBoxResult.Cancel:
                    return;     // Abort close solution.
                }
            }
            else
            {
                Solution.CloseSolution(Solution.Current, false);
            }

            ScriptTabControl.CloseAllTabs();
            ShowTabControls(false);
            OutputWindow.ClearOutput();

            InspectionViewControl.Instance.RemoveAllVariables();
            CommandManager.InvalidateRequerySuggested();
        }
예제 #2
0
        private void OpenSolutionExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            Logger.LogDebug("Text-Editor-Control-OpenSolutionExecuted", "OpenSolutionExecuted");

            // Check to see if the solution needs saving. But then we cannot do
            // this because we ALWAYS have a start-up script, so user will be
            // prompt to save the solution even if she has not done anything after
            // launching DesignScript Studio.
            //
            // if (SaveSolutionInternal() == false)
            //    return;


            if (OpenSolutionInternal() == false)
            {
                return;
            }

            ScriptTabControl.CloseAllTabs();

            int count = Solution.Current.ScriptCount;

            for (int index = 0; index < count; ++index)
            {
                string path = Solution.Current.GetScriptPathFromIndex(index);
                string name = System.IO.Path.GetFileName(path);
                ScriptTabControl.InsertNewTab(name, scrollViewer);
            }

            int activeScript = Solution.Current.ActiveScriptIndex;

            ScriptTabControl.ActivateTab(activeScript);

            HandleScriptActivation();

            // Remove and add all expressions stored in the solution.
            InspectionViewControl.Instance.PopulateVariablesFromSolution();
            CommandManager.InvalidateRequerySuggested();
        }