예제 #1
0
        private void Open(DockState dockState = DockState.Document)
        {
            var existing = All.FirstOrDefault(i => i.Path == this.Path);

            if (existing != null)
            {
                existing.Container.Activate();
                return;
            }
            Editor = new Editor(this)
            {
                Font = Properties.Settings.Default.Font
            };
            if (ReadingFile != null)
            {
                ReadingFile.Invoke(this, EventArgs.Empty);
            }
            Application.DoEvents();
            if (Role == Roles.Main)
            {
                if (Main.SceneryPanel != null)
                {
                    Main.SceneryPanel.Dispose();
                }
                Reset();
                Main.SceneryPanel = new ProjectPanel(this);
            }
            Editor.LoadFromFile();
            (Main.WordWrapMenuItem as ToolStripMenuItem).Checked = Editor.WordWrap;
            Container = new EditorContainer(Editor, Main.DockPanel, dockState);
            Container.UpdateText();
            if (ReadingFileDone != null)
            {
                ReadingFileDone.Invoke(this, EventArgs.Empty);
            }
            Application.DoEvents();
            if (All.Count < 1)
            {
                var s = Properties.Settings.Default;
                s.LastOpenFile = Path;
                s.Save();
            }
            All.Add(this);
            Status.FileName = FileName;
        }
예제 #2
0
 private void Open(DockState dockState = DockState.Document)
 {
     var existing = All.FirstOrDefault(i => i.Path == this.Path);
     if (existing != null) {
         existing.Container.Activate();
         return;
     }
     Editor = new Editor(this) { Font = Properties.Settings.Default.Font };
     if (ReadingFile != null) ReadingFile.Invoke(this, EventArgs.Empty);
     Application.DoEvents();
     if (Role == Roles.Main) {
         if (Main.SceneryPanel != null) Main.SceneryPanel.Dispose();
         Reset();
         Main.SceneryPanel = new ProjectPanel(this);
     }
     Editor.LoadFromFile();
     (Main.WordWrapMenuItem as ToolStripMenuItem).Checked = Editor.WordWrap;
     Container = new EditorContainer(Editor, Main.DockPanel, dockState);
     Container.UpdateText();
     if (ReadingFileDone != null) ReadingFileDone.Invoke(this, EventArgs.Empty);
     Application.DoEvents();
     if (All.Count < 1) {
         var s = Properties.Settings.Default;
         s.LastOpenFile = Path;
         s.Save();
     }
     All.Add(this);
     Status.FileName = FileName;
 }