Ejemplo n.º 1
0
        private void OnTextCanvasGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
        {
            if (textCore.ReadOnlyState == false)
            {
                List <int> scriptsToClose = new List <int>();
                textCore.CheckForExternalModifications(ref scriptsToClose);
                if (scriptsToClose.Count > 0)
                {
                    foreach (int index in scriptsToClose)
                    {
                        ScriptTabControl.CloseTab(index);
                        textCore.CloseScript(index);
                    }

                    // IDE-644 Crash on file reload if existing open file renamed in explorer.
                    // If at the end of all these there's no script left, clean up script display.
                    if (Solution.Current.ScriptCount <= 0)
                    {
                        ShowTabControls(false);
                        CheckTabControlVisibility(true);
                    }
                    else
                    {
                        // Repaint text canvas...
                        HandleScriptActivation();
                    }
                }
            }
        }
        public bool EnsureScriptsSaved()
        {
            int numberOfTabs = ScriptTabControl.TabCount;

            for (int i = 0; i < numberOfTabs; i++)
            {
                ScriptTabControl.ActivateTab(0);
                HandleScriptActivation();
                if (textEditorControl.ScriptTabClosingCallback())
                {
                    ScriptTabControl.CloseTab(0);
                    textCore.CloseScript(0);
                }
                else
                {
                    return(false);
                }
            }

            return(true);
        }