예제 #1
0
        public static void Show(Grid parent, NModbusWrapper.ValueType valueType, ushort length, Action <NModbusWrapper.ValueType, ushort> callback, ValueTypeMode mode)
        {
            var control = new ModbusValueTypeSelectionView(length, valueType, mode);
            var dialog  = new DialogView(control);

            control.OkPressed += () => {
                callback?.Invoke(control.GetValueType(), control.GetValueLength());
                dialog.Close();
            };
            control.SetValueType(valueType);
            control.SetValueLength(length);
            control.CancelPressed += () => dialog.Close();
            dialog.Show(parent);
        }
예제 #2
0
        public SelectValueTypeView()
        {
            InitializeComponent();

            Loaded += (o, e) => {
                var grid = Window.GetWindow(this).Content as Grid;
                btEdit.Click += (o1, e1) => {
                    ModbusValueTypeSelectionView.Show(
                        grid,
                        this.ValueType,
                        this.Length,
                        (type, length) => {
                        RefreshWith(type, length, _mode);
                        ValueTypeChanged?.Invoke(length, type);
                    },
                        _mode);
                };
            };
        }