public static DataEditor ConvertFromString(string xml) { try { object obj = XmlSerializerUtility.LoadFromXmlString(xml); if (obj != null) { DataEditor ret = obj as DataEditor; if (ret == null) { if (NotifyException != null) { NotifyException(null, "Error reading DataEditor. the type is not a DataEditor:{0}, {1}", obj.GetType(), xml); } } return(ret); } return(null); } catch (Exception err) { if (NotifyException != null) { NotifyException(err, "Error reading DataEditor:{0}", xml); } } return(null); }
private void buttonOK_Click(object sender, EventArgs e) { try { if (listBox1.SelectedIndex >= 0) { DataEditor de = (DataEditor)Activator.CreateInstance((Type)(listBox1.Items[listBox1.SelectedIndex])); DlgSetEditorAttributes dlg = de.GetDataDialog(SelectedEditor); if (dlg != null) { dlg.SetEditorAttributes(SelectedEditor); if (dlg.ShowDialog(this) == DialogResult.OK) { SetSelection(de); this.DialogResult = DialogResult.OK; } } else { this.DialogResult = DialogResult.OK; } } } catch (Exception err) { MessageBox.Show(err.Message); } }
public object Clone() { DataEditor obj = (DataEditor)Activator.CreateInstance(this.GetType()); obj.ValueField = ValueField; obj.form = form; obj.nUpdatePos = nUpdatePos; OnClone(obj); return(obj); }
/// <summary> /// modify the selection if needed. usually not /// </summary> /// <param name="selected"></param> public void SetSelection(DataEditor selected) { _editor = selected; }
/// <summary> /// use current value to set attributes if needed /// </summary> /// <param name="current"></param> public virtual void SetEditorAttributes(DataEditor current) { }
public DlgSetEditorAttributes(DataEditor editor) { _editor = editor; }
public DlgSelectFieldEditor(DataEditor editor) : base(editor) { InitializeComponent(); }
public override void SetEditorAttributes(DataEditor current) { }
protected virtual void OnClone(DataEditor cloned) { }
public virtual DlgSetEditorAttributes GetDataDialog(DataEditor current) { return(new DlgSelectFieldEditor(current)); }