Example #1
0
 private void editToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (SelectedVariable != null)
     {
         var type = SelectedVariable.NetValueType;
         if (type == typeof(string))
         {
             StringPicker p = new StringPicker(SelectedVariable.Value);
             if (p.ShowDialog() == DialogResult.OK)
             {
                 SelectedVariable.Value = p.Value;
                 RefreshValues();
             }
         }
         else if (type == typeof(bool))
         {
             if (SelectedVariable.Value == null)
             {
                 SelectedVariable.Value = false;
             }
             else
             {
                 SelectedVariable.Value = !(bool)SelectedVariable.Value;
             }
             RefreshValues();
         }
         else if (Variable.IsNumber(SelectedVariable.ValueType))
         {
             NumberPicker p = new NumberPicker(SelectedVariable.NetValueType, SelectedVariable.Value);
             //p.PrepareByType(SelectedVariable.NetValueType);
             if (p.ShowDialog() == DialogResult.OK)
             {
                 SelectedVariable.Value = p.Value;
                 RefreshValues();
             }
         }
     }
 }