private void saveButton_Click(object sender, EventArgs e) { if (this.uMLFlowBindingSource.Current != null) { this.uMLFlowBindingSource.EndEdit(); UMLFlow flow = this.uMLFlowBindingSource.Current as UMLFlow; if (flow.State == RecordState.Created) { this.uMLFlowCollectionBindingSource.Add(flow); this.uMLFlowCollectionBindingSource.Position = this.uMLFlowCollectionBindingSource.IndexOf(flow); } flow.Save(); this.LockFlowControls(true); this.uMLFlowCollectionDataGridView.Enabled = true; this.editButton.Enabled = true; this.newButton.Enabled = true; this.cancelButton.Enabled = false; this.saveButton.Enabled = false; this.removeButton.Enabled = true; } }
public FlowEdit(UMLFlow flow) { InitializeComponent(); this.DataBindings.Add(new System.Windows.Forms.Binding("Name", this.uMLFlowBindingSource, "PathName", true, System.Windows.Forms.DataSourceUpdateMode.OnValidation, "New Use Case")); this.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.uMLFlowBindingSource, "PathName", true, System.Windows.Forms.DataSourceUpdateMode.OnValidation, "New Use Case")); this.DataBindings.Add(new System.Windows.Forms.Binding("TabText", this.uMLFlowBindingSource, "PathName", true, System.Windows.Forms.DataSourceUpdateMode.OnValidation, "New Use Case")); this.DataBindings.Add(new System.Windows.Forms.Binding("ToolTipText", this.uMLFlowBindingSource, "PathName", true, System.Windows.Forms.DataSourceUpdateMode.OnValidation, "New Use Case")); this.Flow = flow; }
private void uMLFlowCollectionDataGridView_DoubleClick(object sender, EventArgs e) { UMLFlow item = uMLFlowCollectionBindingSource.Current as UMLFlow; if (item != null) { FormEdit form = FormsFactory.GetFormEdit(item); if (form != null) { form.FormClosed += new FormClosedEventHandler(form_FormClosed); form.Show((this.ParentForm as WeifenLuo.WinFormsUI.Docking.DockContent).DockPanel); } } }
private void LoadSelectedFlow() { selectedFlow = (UMLFlow)ddlFLows.SelectedItem; if (selectedFlow != null) { treeViewFlows.Nodes.Clear(); foreach (UMLStepFlow step in selectedFlow.GetStepFlows()) { TreeNode nodeStep = new TreeNode(); nodeStep.Tag = step; nodeStep.Text = step.Name; treeViewFlows.Nodes.Add(nodeStep); } treeViewFlows.ExpandAll(); } }
private void newButton_Click(object sender, EventArgs e) { UMLFlow flow = new UMLFlow(); flow.Owner = this.UseCase; this.uMLFlowBindingSource.DataSource = flow; this.LockFlowControls(false); this.uMLFlowCollectionDataGridView.Enabled = false; this.flowTypeComboBox.SelectedIndex = 0; this.editButton.Enabled = false; this.newButton.Enabled = false; this.cancelButton.Enabled = true; this.saveButton.Enabled = true; this.removeButton.Enabled = false; }
private void uMLFlowCollectionDataGridView_DoubleClick(object sender, EventArgs e) { UMLFlow item = uMLFlowCollectionBindingSource.Current as UMLFlow; if (item != null) { FormEdit form = FormsFactory.GetFormEdit(item); if (form != null) { form.FormClosed += new FormClosedEventHandler(form_FormClosed); if (this.DockPanel != null) { form.Show(this.DockPanel); } else { form.Show(); } } } }
private void removeButton_Click(object sender, EventArgs e) { if (this.uMLFlowBindingSource.Current != null) { UMLFlow item = uMLFlowCollectionBindingSource.Current as UMLFlow; if (item != null) { DialogResult result = MessageBox.Show(this, "Are you sure?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question); switch (result) { case DialogResult.Yes: item.Delete(); uMLFlowCollectionBindingSource.RemoveCurrent(); break; default: break; } } } }
private void cancelButton_Click(object sender, EventArgs e) { if (this.uMLFlowBindingSource.Current != null) { this.LockFlowControls(true); this.uMLFlowCollectionDataGridView.Enabled = true; UMLFlow flow = this.uMLFlowBindingSource.Current as UMLFlow; if (flow.State != RecordState.Created) { this.uMLFlowBindingSource.CancelEdit(); this.uMLFlowCollectionBindingSource.ResetCurrentItem(); } if (uMLFlowCollectionBindingSource.Count > 0) { this.uMLFlowBindingSource.DataSource = this.uMLFlowCollectionBindingSource.Current; this.editButton.Enabled = true; this.newButton.Enabled = true; this.cancelButton.Enabled = false; this.saveButton.Enabled = false; this.removeButton.Enabled = true; } else { this.uMLFlowBindingSource.Clear(); this.editButton.Enabled = false; this.newButton.Enabled = true; this.cancelButton.Enabled = false; this.saveButton.Enabled = false; this.removeButton.Enabled = false; } } }
private void LoadFlows() { if (Collaboration.Owner is UMLUseCase) { flows = (Collaboration.Owner as UMLUseCase).GetFlows(); this.uMLFlowCollectionBindingSource.DataSource = flows; if (Collaboration.Steps.Count > 0) { UMLStepFlow stepCollaboration = Collaboration.Steps[0]; foreach (UMLFlow flow in flows) { UMLStepFlowCollection stepsFlow = flow.GetStepFlows(); bool find = false; if (stepsFlow.Count > 0) { foreach (UMLStepFlow s in stepsFlow) { if (s.Guid == stepCollaboration.Guid) { flowSteps = stepsFlow; find = true; this.ddlFLows.SelectedItem = selectedFlow = flow; break; } } } if (find) { break; } } if (flowSteps != null) { if (flowSteps.Count > 0 && Collaboration.Steps.Count > 0) { foreach (UMLStepFlow s in flowSteps) { bool find = false; foreach (UMLStepFlow step in Collaboration.Steps) { if (step.Guid == s.Guid) { find = true; break; } } TreeNode nodeStep = new TreeNode(); nodeStep.Tag = s; nodeStep.Checked = find; nodeStep.Text = s.Name; treeViewFlows.Nodes.Add(nodeStep); } treeViewFlows.ExpandAll(); } } } } }
private void LoadFlows() { if (Collaboration.Owner is UMLUseCase) { flows = (Collaboration.Owner as UMLUseCase).GetFlows(); this.uMLFlowCollectionBindingSource.DataSource = flows; if (Collaboration.Steps.Count > 0) { UMLStepFlow stepCollaboration = Collaboration.Steps[0]; foreach (UMLFlow flow in flows) { UMLStepFlowCollection stepsFlow = flow.GetStepFlows(); bool find = false; if (stepsFlow.Count > 0) { foreach (UMLStepFlow s in stepsFlow) { if (s.Guid == stepCollaboration.Guid) { flowSteps = stepsFlow; find = true; this.ddlFLows.SelectedItem = selectedFlow = flow; break; } } } if (find) break; } if (flowSteps != null) { if (flowSteps.Count > 0 && Collaboration.Steps.Count > 0) { foreach (UMLStepFlow s in flowSteps) { bool find = false; foreach (UMLStepFlow step in Collaboration.Steps) { if (step.Guid == s.Guid) { find = true; break; } } TreeNode nodeStep = new TreeNode(); nodeStep.Tag = s; nodeStep.Checked = find; nodeStep.Text = s.Name; treeViewFlows.Nodes.Add(nodeStep); } treeViewFlows.ExpandAll(); } } } } }