public void Output_OnEndEdit(object sender, OnOutputEntityEndEdit e) { OutputEntityEditorWindow _sender = (OutputEntityEditorWindow)sender; Editors2.Remove(_sender); if (e.DialogResult != DialogResult.OK) { return; } modified = true; bool exists = false; for (int i = 0; i < Data.Outputs.Length; i++) { if (Data.Outputs[i].GUID.ToUpper() == e.Data.GUID.ToUpper()) { exists = true; Data.Outputs[i] = e.Data; } } if (!exists) { Array.Resize <OutputEntity>(ref Data.Outputs, Data.Outputs.Length + 1); Data.Outputs[Data.Outputs.Length - 1] = e.Data; } UpdateFields(); }
private void AddOutputButton_Click(object sender, EventArgs e) { OutputEntityEditorWindow outputEntityEditorWindow = new OutputEntityEditorWindow(this); outputEntityEditorWindow.Show(); outputEntityEditorWindow.OnEndEdit += Output_OnEndEdit; Editors2.Add(outputEntityEditorWindow); }
private void EditOutputButton_Click(object sender, EventArgs e) { string guid = (string)OutputEntityView.Rows[OutputEntityView.CurrentCell.RowIndex].Cells[0].Value; bool found = false; foreach (OutputEntity output in Data.Outputs) { if (output.GUID.ToUpper() == guid.ToUpper()) { OutputEntityEditorWindow outputEditor = new OutputEntityEditorWindow(this, output); outputEditor.OnEndEdit += Output_OnEndEdit; Editors2.Add(outputEditor); outputEditor.Show(); found = true; break; } } if (!found) { MessageBox.Show("Could not find output with GUID: \"" + guid.ToUpper() + "\".", "Error!"); } }