public void Save() { if (!Valid) { return; } IContractEditor edit = Editor as IContractEditor; edit.Save(); IResultGetter result = Editor as IResultGetter; XmlElement authElement = result.GetAuthElement(); XmlHelper h = new XmlHelper("<Definition/>"); h.AddElement(".", authElement); try { Contract.SetDefinition(h.GetElement("."), _owner); MessageBox.Show("儲存完畢!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show("儲存失敗!" + ex.Message, "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void Save() { IContractEditor edit = this.Editor as IContractEditor; edit.Save(); if (SaveCompleted != null) { SaveCompleted.Invoke(this, EventArgs.Empty); } }
private void DockControl(IContractEditor editor) { Control ctrl = editor as UserControl; panel.Controls.Clear(); ctrl.Dock = DockStyle.Fill; panel.Controls.Add(ctrl); this.Editor = ctrl; if (Contract.Definition != null) { IResultGetter rg = ctrl as IResultGetter; rg.SetDefinition(Contract.Definition); } }
private void ChangeType(ExtendType type) { IContractEditor editor = null; if (type == ExtendType.open) { rbPublic.Checked = true; editor = new PublicAuthEditor(); } else if (type == ExtendType.ta) { rbTA.Checked = true; editor = new ExtendAuthEditor(type); } else if (type == ExtendType.sa) { rbSA.Checked = true; editor = new ExtendAuthEditor(type); } else if (type == ExtendType.admin) { rbAdmin.Checked = true; editor = new ExtendAuthEditor(type); } else if (type == ExtendType.none) { rbOther.Checked = true; editor = new AdvAuthEditor(); } else if (type == ExtendType.parent) { rbParent.Checked = true; editor = new ExtendAuthEditor(type); } DockControl(editor); editor.DataChanged += new EventHandler(editor_DataChanged); editor.ChangeRecovered += new EventHandler(editor_ChangeRecovered); }
public override void Save() { IContractEditor edit = this.Editor as IContractEditor; edit.Save(); }