Пример #1
0
 public static CheckBox Listen(this CheckBox src, ControlListenGroup listen)
 {
     if (listen != null)
     {
         src.CheckedChanged += (s, e) => listen.Trigger();
     }
     return(src);
 }
Пример #2
0
 public static RadioButton Listen(this RadioButton src, ControlListenGroup listen)
 {
     if (listen != null)
     {
         src.CheckedChanged += (s, e) => listen.Trigger();
     }
     return(src);
 }
Пример #3
0
 public static DateTimePicker Listen(this DateTimePicker src, ControlListenGroup listen)
 {
     if (listen != null)
     {
         src.ValueChanged += (s, e) => listen.Trigger();
     }
     return(src);
 }
Пример #4
0
 public static TextBox Listen(this TextBox src, ControlListenGroup listen)
 {
     if (listen != null)
     {
         src.TextChanged += (s, e) => listen.Trigger();
     }
     return(src);
 }
Пример #5
0
 public static NumericUpDown Listen(this NumericUpDown src, ControlListenGroup listen)
 {
     if (listen != null)
     {
         src.ValueChanged += (s, e) => listen.Trigger();
     }
     return(src);
 }
Пример #6
0
 public static ComboBox Listen(this ComboBox src, ControlListenGroup listen, Action action = null)
 {
     if (listen != null)
     {
         src.SelectionChangeCommitted += (s, e) => listen.Trigger();
     }
     action?.Invoke();
     return(src);
 }
Пример #7
0
 public static DataGridView Listen(this DataGridView src, ControlListenGroup listen)
 {
     if (listen != null)
     {
         src.RowsAdded        += (s, e) => listen.Trigger();
         src.RowsRemoved      += (s, e) => listen.Trigger();
         src.CellValueChanged += (s, e) => listen.Trigger();
     }
     return(src);
 }
Пример #8
0
        public static DateTimePicker BindValueTo(this DateTimePicker src, Action <DateTime?> action, CheckBox enabled = null, ControlListenGroup clg = null)
        {
            void evt() => action(src.GetValue(enabled));

            src.ValueChanged += (s, e) => evt();
            if (enabled != null)
            {
                enabled.CheckedChanged += (e, s) => evt();
            }

            evt();
            src.Listen(clg);
            enabled?.Listen(clg);
            return(src);
        }
Пример #9
0
        public static NumericUpDown BindValueTo(this NumericUpDown src, Action <float?> action, RadioButton enabled = null, ControlListenGroup clg = null)
        {
            void evt() => action(src.GetValueFloat(enabled));

            src.ValueChanged += (e, s) => evt();
            if (enabled != null)
            {
                enabled.CheckedChanged += (e, s) => evt();
            }

            evt();

            src.Listen(clg);
            enabled?.Listen(clg);

            return(src);
        }
Пример #10
0
        public static ComboBox BindValueTo(this ComboBox src, Action <object> action, CheckBox enabled = null, ControlListenGroup clg = null)
        {
            void evt() => action(src.GetValue(enabled));

            src.SelectionChangeCommitted += (e, s) => evt();
            if (enabled != null)
            {
                enabled.CheckedChanged += (e, s) => evt();
            }

            evt();

            src.Listen(clg);
            enabled?.Listen(clg);

            return(src);
        }
Пример #11
0
        public static RadioButton BindValueTo(this RadioButton src, Action <bool> action, CheckBox enabled = null, ControlListenGroup clg = null)
        {
            void evt() => action(src.Checked);

            src.CheckedChanged += (s, e) => evt();
            if (enabled != null)
            {
                enabled.CheckedChanged += (e, s) => evt();
            }
            evt();

            src.Listen(clg);
            enabled?.Listen(clg);
            return(src);
        }
Пример #12
0
 public static CheckBox BindValueTo(this CheckBox src, Action <bool> action, CheckBox enabled = null, ControlListenGroup clg = null)
 {
     src.CheckedChanged += (s, e) => action(src.Checked);
     action(src.Checked);
     src.Listen(clg);
     enabled?.Listen(clg);
     return(src);
 }
Пример #13
0
        public static DataGridView BindValueTo(this DataGridView src, Action <DataGridViewRowCollection> action, CheckBox enabled = null, ControlListenGroup clg = null)
        {
            void evt() => action(src.Rows);

            src.RowsAdded        += (s, e) => evt();
            src.RowsRemoved      += (s, e) => evt();
            src.CellValueChanged += (s, e) => evt();

            if (enabled != null)
            {
                enabled.CheckedChanged += (s, e) => evt();
            }
            evt();
            src.Listen(clg);
            enabled?.Listen(clg);
            return(src);
        }
Пример #14
0
        public static TextBox BindValueTo(this TextBox src, Action <string> action, CheckBox enabled = null, ControlListenGroup clg = null)
        {
            void evt() => action(src.GetValue(enabled));

            src.TextChanged += (s, e) => evt();
            if (enabled != null)
            {
                enabled.CheckedChanged += (e, s) => evt();
            }
            evt();

            src.Listen(clg);
            enabled?.Listen(clg);

            return(src);
        }