private void OnSaveClick() { CircleWindow cw = ((CircleWindow)mainWindow.ActiveMdiChild); if (cw == null) { return; } Save(cw); }
private void Save(CircleWindow cw, string fileName = null) { if (fileName == null) { fileName = "./" + cw.Id + ".app"; } ObjectWriter.WriteToFile <Circle>(cw.circle, fileName); cw.isSaved = true; statusStrip.filePathText.Text = Directory.GetCurrentDirectory() + "\\" + fileName; }
private void OnExitClick() { CircleWindow[] windows = new CircleWindow[circleWindows.Count]; circleWindows.Values.CopyTo(windows, 0); foreach (CircleWindow cw in windows) { cw.Close(); } if (circleWindows.Count == 0) { Environment.Exit(0); } }
private CircleWindow OpenNewCircleWindow(string fileName, string circleId, Circle circle) { CircleWindow cw = new CircleWindow(circleId, circle, fileName, true); circleWindows.Add(circleId, cw); cw.MdiParent = mainWindow; cw.Show(); cw.Closing += (sender, closingEvent) => { if (OnCircleWindowClose(cw.Id)) { closingEvent.Cancel = true; } }; return(cw); }
private CircleWindow CreateNewCircleWindow() { string circleId = string.Format("Circle_{0}", (circleWindows.Count + 1)); CircleWindow cw = new CircleWindow(circleId); circleWindows.Add(circleId, cw); cw.MdiParent = mainWindow; cw.Show(); cw.Closing += (sender, closingEvent) => { if (OnCircleWindowClose(cw.Id)) { closingEvent.Cancel = true; } }; return(cw); }
private void OnSaveAsClick() { CircleWindow cw = ((CircleWindow)mainWindow.ActiveMdiChild); if (cw == null) { return; } SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.FileName = cw.Id; saveFileDialog.DefaultExt = ".app"; saveFileDialog.Filter = "Circle app files (.app)|*.app"; if (saveFileDialog.ShowDialog() == DialogResult.OK) { Save(cw, saveFileDialog.FileName); } }
private void OnNewClick() { CircleWindow cw = CreateNewCircleWindow(); AddMenuCircleWindowData(cw.Id, OnCircleWindowClick); }