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