public void New() { var diagramForm = new DiagramForm(); diagramForm.Show(); diagramForm.Focus(); }
public AppContext(string filepath) { Context = this; if (Settings.Default.RecentFileList == null) { Settings.Default.RecentFileList = new StringCollection(); Settings.Default.Save(); } var diagramForm = new DiagramForm(); MainForm = diagramForm; diagramForm.Show(); if (string.IsNullOrEmpty(filepath)) { LoadLastFile(diagramForm); } else { try { diagramForm.OpenFileByPath(filepath); } catch (Exception exception) { MessageBox.Show(string.Format("{0}:{1}{2}", DesignerResources.FileCouldntBeOpened, Environment.NewLine, exception.Message), DesignerResources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); } } diagramForm.Focus(); }
public PrintPreviewForm(DiagramForm diagramForm) { InitializeComponent(); _diagramForm = diagramForm; CreateButtons(); UpdateMarginFields(); RefreshDocument(); }
public AppContext() { Context = this; if (Settings.Default.RecentFileList == null) { Settings.Default.RecentFileList = new StringCollection(); Settings.Default.Save(); } var diagramForm = new DiagramForm(); MainForm = diagramForm; diagramForm.Show(); LoadLastFile(diagramForm); diagramForm.Focus(); }
private void DiagramFormKeyUp(object sender, KeyEventArgs e) { if (!e.Control) { return; } if (e.KeyCode == Keys.P) { _fileForm.InitPrint(); _fileForm.ShowDialog(); } else if (e.KeyCode == Keys.N) { var diagramForm = new DiagramForm(); diagramForm.Show(); } else if (e.KeyCode == Keys.O) { _fileForm.InitOpen(); _fileForm.ShowDialog(); } else if (e.KeyCode == Keys.S && e.Shift) { SaveAs(); } else if (e.KeyCode == Keys.S) { Save(); } else if (e.KeyCode == Keys.OemMinus) { Designer.Document.Zoom -= 0.1f; } else if (e.KeyCode == Keys.Oemplus) { Designer.Document.Zoom += 0.1f; } }
public void LoadLastFile(DiagramForm diagramForm) { if (!Settings.Default.AutoLoadLastFile || Settings.Default.RecentFileList.Count == 0) return; var recentFiles = new string[Settings.Default.RecentFileList.Count]; Settings.Default.RecentFileList.CopyTo(recentFiles, 0); foreach (var file in recentFiles) { var filepath = file; if (!Path.IsPathRooted(filepath)) filepath = Path.Combine(WaveletStudio.Utils.AssemblyDirectory, filepath); if (!File.Exists(filepath)) continue; try { diagramForm.OpenFileByPath(filepath); break; } catch (Exception) { continue; } } }
public FileForm(DiagramForm diagramForm) { InitializeComponent(); _diagramForm = diagramForm; UpdateFields(); }