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);
 }
Esempio n. 2
0
 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);
        }
Esempio n. 4
0
 /// <summary>
 /// modify the selection if needed. usually not
 /// </summary>
 /// <param name="selected"></param>
 public void SetSelection(DataEditor selected)
 {
     _editor = selected;
 }
Esempio n. 5
0
 /// <summary>
 /// use current value to set attributes if needed
 /// </summary>
 /// <param name="current"></param>
 public virtual void SetEditorAttributes(DataEditor current)
 {
 }
Esempio n. 6
0
 public DlgSetEditorAttributes(DataEditor editor)
 {
     _editor = editor;
 }
Esempio n. 7
0
 public DlgSelectFieldEditor(DataEditor editor)
     : base(editor)
 {
     InitializeComponent();
 }
Esempio n. 8
0
 public override void SetEditorAttributes(DataEditor current)
 {
 }
 protected virtual void OnClone(DataEditor cloned)
 {
 }
 public virtual DlgSetEditorAttributes GetDataDialog(DataEditor current)
 {
     return(new DlgSelectFieldEditor(current));
 }