예제 #1
0
 public DateTimeEditor(string title, DateTime value, bool allowTemplates, string propertyName, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
 {
     _propertyName = propertyName;
     _onChange = onChange;
     _onActivate = onActivate;
     InitializeComponent();
     labelTitle.Text = title;
     dateTimePicker.Value = value;
 }
예제 #2
0
 public DateTimeEditor(string title, DateTime value, bool allowTemplates, string propertyName, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
 {
     _propertyName = propertyName;
     _onChange     = onChange;
     _onActivate   = onActivate;
     InitializeComponent();
     labelTitle.Text      = title;
     dateTimePicker.Value = value;
 }
예제 #3
0
파일: IntEditor.cs 프로젝트: vgrinin/gin
 public IntEditor(string title, int value, bool allowTemplates, string propertyName, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
 {
     _onChange     = onChange;
     _onActivate   = onActivate;
     _propertyName = propertyName;
     InitializeComponent();
     labelTitle.Text = title;
     textValue.Text  = value.ToString();
 }
예제 #4
0
 public CheckBoxEditor(string title, bool value, string propertyName, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
 {
     _propertyName = propertyName;
     _onChange     = onChange;
     _onActivate   = onActivate;
     InitializeComponent();
     checkBox.Checked = value;
     checkBox.Text    = title;
 }
예제 #5
0
 public CheckBoxEditor(string title, bool value, string propertyName, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
 {
     _propertyName = propertyName;
     _onChange = onChange;
     _onActivate = onActivate;
     InitializeComponent();
     checkBox.Checked = value;
     checkBox.Text = title;
 }
예제 #6
0
 public BrowseFolderEditor(string title, string value, string propertyName, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
 {
     _onChange = onChange;
     _onActivate = onActivate;
     _propertyName = propertyName;
     InitializeComponent();
     labelTitle.Text = title;
     textValue.Text = value;
 }
예제 #7
0
 public BrowseFolderEditor(string title, string value, string propertyName, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
 {
     _onChange     = onChange;
     _onActivate   = onActivate;
     _propertyName = propertyName;
     InitializeComponent();
     labelTitle.Text = title;
     textValue.Text  = value;
 }
예제 #8
0
 public CheckBoxTemplateEditor(string title, object value, string propertyName, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
 {
     _propertyName = propertyName;
     _onChange     = onChange;
     _onActivate   = onActivate;
     InitializeComponent();
     Value         = value;
     checkBox.Text = title;
     AdjustControlState();
 }
예제 #9
0
 public CheckBoxTemplateEditor(string title, object value, string propertyName, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
 {
     _propertyName = propertyName;
     _onChange = onChange;
     _onActivate = onActivate;
     InitializeComponent();
     Value = value;
     checkBox.Text = title;
     AdjustControlState();
 }
예제 #10
0
 public override Control GetEditor(object value, string propertyName, PackageBody body, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
 {
     var dateTime = (DateTime)value;
     if (dateTime <= DateTime.MinValue || dateTime >= DateTime.MaxValue)
     {
         dateTime = DateTime.Now;
     }
     Control control = new Editors.DateTimeEditor(Name, dateTime, AllowTemplates, propertyName, onChange, onActivate);
     return control;
 }
예제 #11
0
파일: ListEditor.cs 프로젝트: vgrinin/gin
 public ListEditor(string title, IEnumerable <ComboBoxItem> list, Type listType, string propertyName, PackageBody body, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
 {
     _onChange     = onChange;
     _onActivate   = onActivate;
     _propertyName = propertyName;
     _listType     = listType;
     _itemType     = _listType.GetProperty("Item").PropertyType;
     _body         = body;
     InitializeComponent();
     labelTitle.Text = title;
     PopulateList(list);
 }
예제 #12
0
파일: ListEditor.cs 프로젝트: vgrinin/gin
 public ListEditor(string title, IEnumerable<ComboBoxItem> list, Type listType, string propertyName, PackageBody body, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
 {
     _onChange = onChange;
     _onActivate = onActivate;
     _propertyName = propertyName;
     _listType = listType;
     _itemType = _listType.GetProperty("Item").PropertyType;
     _body = body;
     InitializeComponent();
     labelTitle.Text = title;
     PopulateList(list);
 }
예제 #13
0
파일: TextEditor.cs 프로젝트: vgrinin/gin
 public TextEditor(string title, string value, int maxLength, string propertyName, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
 {
     _onChange     = onChange;
     _onActivate   = onActivate;
     _propertyName = propertyName;
     InitializeComponent();
     labelTitle.Text = title;
     textValue.Text  = value;
     if (maxLength > 0)
     {
         textValue.MaxLength = maxLength;
     }
 }
예제 #14
0
 public SimpleComboBoxEditor(string title, object list, bool dropDownListOnly, string displayField, string valueField, string propertyName, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
 {
     _onChange     = onChange;
     _onActivate   = onActivate;
     _propertyName = propertyName;
     InitializeComponent();
     labelTitle.Text                = title;
     comboBox.DropDownStyle         = dropDownListOnly ? ComboBoxStyle.DropDownList : ComboBoxStyle.DropDown;
     comboBox.ValueMember           = valueField;
     comboBox.DisplayMember         = displayField;
     comboBox.DataSource            = list;
     comboBox.SelectedIndexChanged += new EventHandler(comboBox_SelectedIndexChanged);
 }
예제 #15
0
 public override Control GetEditor(object value, string propertyName, PackageBody body, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
 {
     Control control;
     if (Multiline)
     {
         control = new Editors.MultilineTextEditor(Name, (string)value, MaxLength, propertyName, onChange, onActivate);
     }
     else
     {
         control = new Editors.TextEditor(Name, (string)value, MaxLength, propertyName, onChange, onActivate);
     }
     return control;
 }
예제 #16
0
 public SimpleComboBoxEditor(string title, object list, bool dropDownListOnly, string displayField, string valueField, string propertyName, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
 {
     _onChange = onChange;
     _onActivate = onActivate;
     _propertyName = propertyName;
     InitializeComponent();
     labelTitle.Text = title;
     comboBox.DropDownStyle = dropDownListOnly ? ComboBoxStyle.DropDownList : ComboBoxStyle.DropDown;
     comboBox.ValueMember = valueField;
     comboBox.DisplayMember = displayField;
     comboBox.DataSource = list;
     comboBox.SelectedIndexChanged += new EventHandler(comboBox_SelectedIndexChanged);
 }
예제 #17
0
 public MultilineTextEditor(string title, string value, int maxLength, string propertyName, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
 {
     _propertyName = propertyName;
     _onChange = onChange;
     _onActivate = onActivate;
     InitializeComponent();
     labelTitle.Text = title;
     textValue.Text = value;
     if (maxLength > 0)
     {
         textValue.MaxLength = maxLength;
     }
 }
예제 #18
0
 public override Control GetEditor(object value, string propertyName, PackageBody body, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
 {
     var fields = ListEnum.GetFields().Where(f => f.FieldType == ListEnum).ToList();
     var list = new List<Editors.ComboBoxItem>();
     foreach (var f in fields)
     {
         var nameAttr = f.GetCustomAttributes(true).OfType<GinNameAttribute>().FirstOrDefault();
         list.Add(new Editors.ComboBoxItem
                      {
             Display = nameAttr != null ? nameAttr.Name : f.Name,
             Value = f.GetValue(null)
         });
     }
     Control control = new Editors.ComboBoxEditor(Name, value, true, list, propertyName, onChange, onActivate);
     return control;
 }
예제 #19
0
 public override Control GetEditor(object value, string propertyName, PackageBody body, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
 {
     Control control;
     if (AllowTemplates)
     {
         control = new Editors.CheckBoxTemplateEditor(Name, value, propertyName, onChange, onActivate);
     }
     else
     {
         var boolValue = false;
         if (value is bool)
         {
             boolValue = (bool)value;
         }
         control = new Editors.CheckBoxEditor(Name, boolValue, propertyName, onChange, onActivate);
     }
     return control;
 }
예제 #20
0
 public ComplexValueEditor(string title, object value, Type valueType, string propertyName, PackageBody body, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
 {
     if (value == null)
     {
         value = GetDefaultValueOrNull(valueType);
     }
     _onChange = onChange;
     _onActivate = onActivate;
     _propertyName = propertyName;
     _valueType = valueType;
     _value = value;
     _body = body;
     InitializeComponent();
     labelTitle.Text = title;
     if (value != null)
     {
         labelValue.Text = value.ToString();
     }
 }
예제 #21
0
 public override Control GetEditor(object value, string propertyName, PackageBody body, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
 {
     Control control = null;
     var iList = value as IList;
     if (iList != null)
     {
         var list = new List<ComboBoxItem>();
         foreach (var item in iList)
         {
             list.Add(new ComboBoxItem
                          {
                              Display = item.ToString(),
                              Value = item
                          });
         }
         control = new ListEditor(Name, list, ListType, propertyName, body, onChange, onActivate);
     }
     return control;
 }
예제 #22
0
 public ComplexValueEditor(string title, object value, Type valueType, string propertyName, PackageBody body, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
 {
     if (value == null)
     {
         value = GetDefaultValueOrNull(valueType);
     }
     _onChange     = onChange;
     _onActivate   = onActivate;
     _propertyName = propertyName;
     _valueType    = valueType;
     _value        = value;
     _body         = body;
     InitializeComponent();
     labelTitle.Text = title;
     if (value != null)
     {
         labelValue.Text = value.ToString();
     }
 }
예제 #23
0
 public ComboBoxEditor(string title, object value, bool dropDownListOnly, IEnumerable <ComboBoxItem> list, string propertyName, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
 {
     _onChange     = onChange;
     _onActivate   = onActivate;
     _propertyName = propertyName;
     InitializeComponent();
     labelTitle.Text        = title;
     comboBox.DropDownStyle = dropDownListOnly ? ComboBoxStyle.DropDownList : ComboBoxStyle.DropDown;
     comboBox.ValueMember   = "Value";
     comboBox.DisplayMember = "Display";
     comboBox.DataSource    = list;
     foreach (var item in comboBox.Items)
     {
         if (((ComboBoxItem)item).Value.ToString() == value.ToString())
         {
             comboBox.SelectedItem = item;
             break;
         }
     }
     comboBox.SelectedIndexChanged += new EventHandler(comboBox_SelectedIndexChanged);
 }
예제 #24
0
 public ComboBoxEditor(string title, object value, bool dropDownListOnly, IEnumerable<ComboBoxItem> list, string propertyName, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
 {
     _onChange = onChange;
     _onActivate = onActivate;
     _propertyName = propertyName;
     InitializeComponent();
     labelTitle.Text = title;
     comboBox.DropDownStyle = dropDownListOnly ? ComboBoxStyle.DropDownList : ComboBoxStyle.DropDown;
     comboBox.ValueMember = "Value";
     comboBox.DisplayMember = "Display";
     comboBox.DataSource = list;
     foreach (var item in comboBox.Items)
     {
         if (((ComboBoxItem)item).Value.ToString() == value.ToString())
         {
             comboBox.SelectedItem = item;
             break;
         }
     }
     comboBox.SelectedIndexChanged += new EventHandler(comboBox_SelectedIndexChanged);
 }
예제 #25
0
 /// <summary>
 /// Returns null, 'cause it has no standard editor
 /// </summary>
 /// <returns>null</returns>
 public override Control GetEditor(object value, string propertyName, PackageBody body, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
 {
     return(null);
 }
예제 #26
0
 public override Control GetEditor(object value, string propertyName, PackageBody body, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
 {
     Control control = new Editors.IntEditor(Name, (int)value, AllowTemplates, propertyName, onChange, onActivate);
     return control;
 }
예제 #27
0
 /// <summary>
 /// Returns null, 'cause it has no standard editor
 /// </summary>
 /// <returns>null</returns>
 public override Control GetEditor(object value, string propertyName, PackageBody body, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
 {
     return null;
 }
예제 #28
0
        public override Control GetEditor(object value, string propertyName, PackageBody body, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
        {
            Control control = new Editors.IntEditor(Name, (int)value, AllowTemplates, propertyName, onChange, onActivate);

            return(control);
        }
예제 #29
0
 /// <summary>
 /// Returns the UI-editor for this property
 /// </summary>
 /// <param name="value">Initial value for editor</param>
 /// <param name="propertyName">Property name</param>
 /// <param name="body">The PackageBody of current package</param>
 /// <param name="onChange">PropertyChanged delegate</param>
 /// <param name="onActivate">PropertyActivated delegate</param>
 /// <returns>Windows Forms Control, which supplies the edit value function for this class property</returns>
 public abstract Control GetEditor(object value, string propertyName, PackageBody body, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate);
예제 #30
0
 /// <summary>
 /// Returns the UI-editor for this property
 /// </summary>
 /// <param name="value">Initial value for editor</param>
 /// <param name="propertyName">Property name</param>
 /// <param name="body">The PackageBody of current package</param>
 /// <param name="onChange">PropertyChanged delegate</param>
 /// <param name="onActivate">PropertyActivated delegate</param>
 /// <returns>Windows Forms Control, which supplies the edit value function for this class property</returns>
 public abstract Control GetEditor(object value, string propertyName, PackageBody body, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate);
예제 #31
0
        public override Control GetEditor(object value, string propertyName, PackageBody body, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
        {
            Control control = null;
            var     iList   = value as IList;

            if (iList != null)
            {
                var list = new List <ComboBoxItem>();
                foreach (var item in iList)
                {
                    list.Add(new ComboBoxItem
                    {
                        Display = item.ToString(),
                        Value   = item
                    });
                }
                control = new ListEditor(Name, list, ListType, propertyName, body, onChange, onActivate);
            }
            return(control);
        }
예제 #32
0
        public override Control GetEditor(object value, string propertyName, PackageBody body, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
        {
            Control control;

            if (AllowTemplates)
            {
                control = new Editors.CheckBoxTemplateEditor(Name, value, propertyName, onChange, onActivate);
            }
            else
            {
                var boolValue = false;
                if (value is bool)
                {
                    boolValue = (bool)value;
                }
                control = new Editors.CheckBoxEditor(Name, boolValue, propertyName, onChange, onActivate);
            }
            return(control);
        }
 public override Control GetEditor(object value, string propertyName, PackageBody body, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
 {
     return new Editors.BrowseFolderEditor(Name, (string)value, propertyName, onChange, onActivate);
 }
예제 #34
0
        public override Control GetEditor(object value, string propertyName, PackageBody body, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
        {
            Control control;

            if (Multiline)
            {
                control = new Editors.MultilineTextEditor(Name, (string)value, MaxLength, propertyName, onChange, onActivate);
            }
            else
            {
                control = new Editors.TextEditor(Name, (string)value, MaxLength, propertyName, onChange, onActivate);
            }
            return(control);
        }
        public override Control GetEditor(object value, string propertyName, PackageBody body, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
        {
            Control control = new Editors.ComplexValueEditor(Name, value, ValueType, propertyName, body, onChange, onActivate);

            return(control);
        }
 public override Control GetEditor(object value, string propertyName, PackageBody body, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
 {
     Control control = new Editors.ComplexValueEditor(Name, value, ValueType, propertyName, body, onChange, onActivate);
     return control;
 }
예제 #37
0
        public override Control GetEditor(object value, string propertyName, PackageBody body, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
        {
            var dateTime = (DateTime)value;

            if (dateTime <= DateTime.MinValue || dateTime >= DateTime.MaxValue)
            {
                dateTime = DateTime.Now;
            }
            Control control = new Editors.DateTimeEditor(Name, dateTime, AllowTemplates, propertyName, onChange, onActivate);

            return(control);
        }
예제 #38
0
 public override Control GetEditor(object value, string propertyName, PackageBody body, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
 {
     return(new Editors.BrowseFileEditor(IsNewFile, Name, (string)value, propertyName, onChange, onActivate));
 }
예제 #39
0
        public override Control GetEditor(object value, string propertyName, PackageBody body, PropertyChangedDelegate onChange, PropertyActivatedDelegate onActivate)
        {
            var fields = ListEnum.GetFields().Where(f => f.FieldType == ListEnum).ToList();
            var list   = new List <Editors.ComboBoxItem>();

            foreach (var f in fields)
            {
                var nameAttr = f.GetCustomAttributes(true).OfType <GinNameAttribute>().FirstOrDefault();
                list.Add(new Editors.ComboBoxItem
                {
                    Display = nameAttr != null ? nameAttr.Name : f.Name,
                    Value   = f.GetValue(null)
                });
            }
            Control control = new Editors.ComboBoxEditor(Name, value, true, list, propertyName, onChange, onActivate);

            return(control);
        }