private void DisplayNewDiagram() { // Find a unique name for the new Diagram int N = 0; string newName; bool found; do { ++N; newName = string.Format("Diagram {0}", N); // Search name in list of diagrams found = false; foreach (Diagram d in project.Repository.GetDiagrams()) { if (d.Name.Equals(newName, StringComparison.InvariantCultureIgnoreCase)) { found = true; break; } } } while (found); Diagram diagram = new Diagram(newName); InsertDiagramCommand cmd = new InsertDiagramCommand(diagram); project.ExecuteCommand(cmd); UpdateDiagramCombo(); diagramComboBox.Text = newName; }
/// <ToBeCompleted></ToBeCompleted> public Diagram CreateDiagram(string name) { if (name == null) throw new ArgumentNullException("name"); AssertProjectIsOpen(); // Create new diagram Diagram diagram = new Diagram(name); diagram.Width = 1000; diagram.Height = 1000; ICommand cmd = new InsertDiagramCommand(diagram); project.ExecuteCommand(cmd); return diagram; }
private void newDiagramToolStripMenuItem_Click(object sender, EventArgs e) { Diagram diagram = new Diagram(string.Format("Diagram {0}", displayTabControl.TabPages.Count + 1)); diagram.Title = diagram.Name; ICommand cmd = new InsertDiagramCommand(diagram); project.ExecuteCommand(cmd); CreateDisplayForDiagram(diagram); showDiagramSettingsToolStripMenuItem_Click(this, EventArgs.Empty); }
private void DisplayNewDiagram() { // Find a unique name for the new Diagram int N = 0; string newName; bool found; do { ++N; newName = string.Format("Diagram {0}", N); // Search name in list of diagrams found = false; foreach (Diagram d in project.Repository.GetDiagrams()) if (d.Name.Equals(newName, StringComparison.InvariantCultureIgnoreCase)) { found = true; break; } } while (found); Diagram diagram = new Diagram(newName); InsertDiagramCommand cmd = new InsertDiagramCommand(diagram); project.ExecuteCommand(cmd); UpdateDiagramCombo(); diagramComboBox.Text = newName; }