/// <summary>
        /// Checks if a file has been changed outside
        /// </summary>
        private static void CheckFileChange(ITabbedDocument document)
        {
            TabbedDocument casted = document as TabbedDocument;

            if (casted.IsEditable && casted.CheckFileChange())
            {
                if (Globals.Settings.AutoReloadModifiedFiles)
                {
                    casted.Reload(false);
                }
                else
                {
                    String dlgTitle   = TextHelper.GetString("Title.InfoDialog");
                    String dlgMessage = TextHelper.GetString("Info.FileIsModifiedOutside");
                    String formatted  = String.Format(dlgMessage, "\n", casted.FileName);
                    if (MessageBox.Show(Globals.MainForm, formatted, " " + dlgTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                    {
                        casted.Reload(false);
                    }
                }
            }
        }
示例#2
0
        /// <summary>
        /// Checks if a file has been changed outside
        /// </summary>
        private static void CheckFileChange(ITabbedDocument document)
        {
            TabbedDocument casted = document as TabbedDocument;

            if (casted.IsEditable && casted.CheckFileChange())
            {
                if (Globals.Settings.AutoReloadModifiedFiles)
                {
                    casted.RefreshFileInfo();
                    casted.Reload(false);
                }
                else
                {
                    if (YesToAll)
                    {
                        casted.RefreshFileInfo();
                        casted.Reload(false);
                        return;
                    }
                    String dlgTitle   = TextHelper.GetString("Title.InfoDialog");
                    String dlgMessage = TextHelper.GetString("Info.FileIsModifiedOutside");
                    String formatted  = String.Format(dlgMessage, "\n", casted.FileName);
                    MessageBoxManager.Cancel = TextHelper.GetString("Label.YesToAll");
                    MessageBoxManager.Register(); // Use custom labels...
                    DialogResult result = MessageBox.Show(Globals.MainForm, formatted, " " + dlgTitle, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information);
                    casted.RefreshFileInfo();     // User may have waited before responding, save info now
                    if (result == DialogResult.Yes)
                    {
                        casted.Reload(false);
                    }
                    else if (result == DialogResult.Cancel)
                    {
                        casted.Reload(false);
                        YesToAll = true;
                    }
                    MessageBoxManager.Unregister();
                }
            }
        }