Beispiel #1
0
        private void itemView_Click(object sender, EventArgs e)
        {
            var controlSlider = new FloatViewSliderSwitch(_model);
            var dialogSlider  = new DialogView(controlSlider);

            controlSlider.ManualInputActivate += (o1, e1) =>
            {
                _currentContext.Post((s) =>
                {
                    dialogSlider.Close();
                    var controlManual           = new FloatViewManualSwitch(_model);
                    var dialogManual            = new DialogView(controlManual);
                    controlManual.ApplyClicked += (o2, e2) =>
                    {
                        _model.ScenarioValue = e2.Value;
                        dialogManual.Close();
                    };
                    dialogManual.Show(DialogView.GetDialogHost(this));
                },
                                     null);
            };
            controlSlider.NeedClose += (o1, e1) =>
                                       _currentContext.Post((s) => dialogSlider.Close(), null);
            dialogSlider.Show(DialogView.GetDialogHost(this));
        }
        private void btCreateScenario_Click(object sender, RoutedEventArgs e)
        {
            ThroughScenarioSave(() => {
                var selectScenarioTypeControl = new NewScenarioSelectionView();
                var dialogView = new DialogView(selectScenarioTypeControl);
                dialogView.Show();

                selectScenarioTypeControl.SingleActionScenario += () => {
                    dialogView.Close();
                    NewScenario(new SingleActionScenario());
                };

                selectScenarioTypeControl.RemoteScenario += () => {
                    dialogView.Close();
                    NewScenario(new RemoteScenario());
                };

                selectScenarioTypeControl.CompositeScenario += () => {
                    dialogView.Close();
                    var selectCompositeScenarioType       = new NewCompositeScenarioSelectionView();
                    var dialogViewComposite               = new DialogView(selectCompositeScenarioType);
                    selectCompositeScenarioType.Selected += (valueType) => {
                        dialogViewComposite.Close();
                        var scenario = new CompositeScenario()
                        {
                            ValueType = valueType
                        };
                        NewScenario(scenario);
                    };
                    dialogViewComposite.Show();
                };
            });
        }
Beispiel #3
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);
        }
        public static void Show(SettingsItem[] items, string caption, Grid parent)
        {
            var selectView = new SettingsSelectView(items, caption);
            var dialogView = new DialogView(selectView);

            selectView.ItemClicked += (o, e) => dialogView.Close();
            dialogView.Show(parent, nameof(SettingsSelectView));
        }
Beispiel #5
0
        private void ItemView_Click(object sender, RoutedEventArgs e)
        {
            var statusSwitch = new StatusViewSwitch((ScenarioModel)DataContext);
            var dialog       = new DialogView(statusSwitch);

            statusSwitch.StateChanged += (o, e2) => dialog.Close();
            dialog.Show();
        }
#pragma warning restore 67

        public static void Show(ScenarioBase scenario, Action modified)
        {
            var control = new ScenarioSecurityManagementView(scenario);
            var dialog  = new DialogView(control);

            control.Modified     += () => modified?.Invoke();
            control.CloseClicked += () => dialog.Close();
            dialog.Show();
        }
Beispiel #7
0
        public static void Show(ServerSettings settings, Action <ServerSettings> selected)
        {
            var selectView = new CertificateSelectView(settings);
            var dialogView = new DialogView(selectView);

            selectView.Selected += new Action <ServerSettings>((s) => {
                selected?.Invoke(s);
                dialogView.Close();
            });
            dialogView.Show();
        }
Beispiel #8
0
        public static void Show(Action <IPermission> callback)
        {
            var control = new SelectPermissionView();
            var dialog  = new DialogView(control);

            control.PermissionCreated += (permission) => {
                callback?.Invoke(permission);
                dialog.Close();
            };
            dialog.Show();
        }
        public static void Show(SwitchScenarioModel model, Grid parent)
        {
            var @switch = new InfoViewSwitch(model);
            var dialog  = new DialogView(@switch);

            @switch.ApplyClicked += (o, e) =>
            {
                dialog.Close();
                model.ScenarioValue = e.Value;
            };
            dialog.Show(parent);
        }
Beispiel #10
0
        public static void Show(Action <DateSelectionItem> selected, DateTime max, DateTime min, DateSelectionItem selectionItem)
        {
            var control = new DatesRangeSelectView(max, min, selectionItem);
            var dialog  = new DialogView(control);

            control.Commited += (o, e) =>
            {
                selected?.Invoke(e.Value);
                dialog.Close();
            };
            dialog.Show();
        }
        public static void Show(Action <bool> callback, bool selectedValue)
        {
            var control = new CheckerOperatorSelectView2(selectedValue);
            var dialog  = new DialogView(control);

            dialog.ShowUnderCursor = true;
            control.Selected      += (result) => {
                callback?.Invoke(result);
                dialog.Close();
            };
            dialog.Show();
        }
        public static void Show(Action <IComparisonType> callback, IComparisonType selected, bool onlyNumeric)
        {
            var control = new ComparisonTypeSelectView(selected, onlyNumeric);
            var dialog  = new DialogView(control);

            dialog.ShowUnderCursor = true;
            control.Selected      += (type) => {
                callback?.Invoke(type);
                dialog.Close();
            };
            dialog.Show();
        }
        public static void Show(Action <WarnType> callback)
        {
            var control = new SelectWarnTypeView();
            var dialog  = new DialogView(control);

            control.Selected += (warnType) => {
                dialog.Close();
                callback?.Invoke(warnType);
            };
            dialog.ShowUnderCursor = true;
            dialog.Show();
        }
Beispiel #14
0
        public static void Show(Action <bool> callback)
        {
            var control = new SelectCheckerTypeView();
            var dialog  = new DialogView(control);

            dialog.ShowUnderCursor = true;
            control.Selected      += (result) => {
                callback?.Invoke(result);
                dialog.Close();
            };
            dialog.Show();
        }
Beispiel #15
0
        public static void Show(Action <string> callbackEnter, bool numeric = false, double min = 0, double max = 100)
        {
            var @switch = new InfoViewSwitch(numeric, min, max);
            var dialog  = new DialogView(@switch);

            @switch.ApplyClicked += (o, e) =>
            {
                callbackEnter?.Invoke(e.Value);
                dialog.Close();
            };
            dialog.Show();
        }
        public static void Show(string[] selectedScenarios, Action <string[]> callback)
        {
            var control = new SelectScenarioView(selectedScenarios);
            var dialog  = new DialogView(control);

            control.ApplyClicked += (o, e) =>
            {
                callback?.Invoke(e.Value);
                dialog.Close();
            };
            dialog.Show();
        }
        public static void Show(Action callback, Action <UserParamsValidationArgs> validation, UserBase user)
        {
            var control = new EditUserView(user);
            var dialog  = new DialogView(control);

            control.Validation = validation;
            control.OkClicked += () =>
            {
                callback?.Invoke();
                dialog.Close();
            };
            dialog.Show();
        }
Beispiel #18
0
 private void ItemView2_Click(object sender, RoutedEventArgs e)
 {
     StuckUILoadingWindow.Show("Загрузка иконок...",
                               () =>
     {
         var switchIconSelect      = new SwitchIconSelect(((ScenarioModel)DataContext), true);
         var dialog                = new DialogView(switchIconSelect);
         dialog.Caption            = "Выберите иконку, которая будет отображаться над переключателем. Для поиска нужной иконки начните вводить текст в поле ввода.";
         switchIconSelect.OkClick += (o, args) => dialog.Close();
         dialog.Show();
     }
                               );
 }
        public static void Show(Action <Type> selectedCallback, Type valueType = null, ActionInstanceSide side = ActionInstanceSide.Both, Type selectedType = null)
        {
            var control    = new SelectActionView();
            var dialogView = new DialogView(control);

            control.Initialize(valueType, side, selectedType);
            control.SelectionChanged += (ctrl) =>
            {
                selectedCallback?.Invoke(control.SelectedType);
                dialogView.Close();
            };
            dialogView.Show();
        }
Beispiel #20
0
        public static void Show(Action <Type> callback)
        {
            var control = new SelectCoreActionView();
            var dialog  = new DialogView(control);

            control.Selected += (type) =>
            {
                callback(type);
                dialog.Close();
            };
            dialog.ShowUnderCursor = true;
            dialog.Show();
        }
        public static void Show(Action <UserGroupBase[]> callback, string[] selectedGroupsIds)
        {
            var control    = new GroupsSelectView(selectedGroupsIds);
            var dialogView = new DialogView(control);

            dialogView.Caption    = "Выберите группы";
            control.ApplyClicked += () =>
            {
                callback?.Invoke(control.SelectedGroups);
                dialogView.Close();
            };
            dialogView.Show();
        }
        private void ItemView_Click(object sender, EventArgs e)
        {
            var model        = (SwitchScenarioModel)BindingContext;
            var statusSwitch = new StatusViewSwitch(model);
            var dialog       = new DialogView(statusSwitch);

            statusSwitch.StateChanged += (o, args) =>
            {
                if (args.Value == ItemView.ClickSource.CloseAnyway)
                {
                    dialog.Close();
                }

                if ((args.Value == ItemView.ClickSource.Tap && model.AcceptedValues.Length <= StatusViewSwitch.NotClosingItemsCount) ||
                    args.Value == ItemView.ClickSource.CloseAnyway)                                                                 // Если количество возможных значений меньше 14,
                {
                    // то при выборе одного из значений закрываем окно.
                    dialog.Close();                                                                                                 // Число подобрано на основе того, сколько строчек вмещается на экран.
                }
            };
            dialog.Show(DialogView.GetDialogHost(this));
        }
Beispiel #23
0
        public static void Show(Action <ScenarioBase> selectedCallback, Type valueType = null, ActionInstanceSide side = ActionInstanceSide.Both, string selectedScenarioId = "")
        {
            var control    = new SelectScenarioView();
            var dialogView = new DialogView(control);

            control.Initialize(valueType, side, selectedScenarioId);
            control.SelectionChanged += (ctrl) =>
            {
                selectedCallback?.Invoke(control.SelectedScenario);
                dialogView.Close();
            };
            dialogView.Show();
        }
        public static void Show(Action callback, Action <GroupValidationArgs> validation, UserGroupBase group)
        {
            var control = new AddGroupView(group);
            var dialog  = new DialogView(control);

            control.Validation = validation;
            control.OkClicked += () =>
            {
                callback?.Invoke();
                dialog.Close();
            };
            dialog.Show();
        }
Beispiel #25
0
        public static void Show(Action <ScenarioBase, RunExistingScenarioMode> selectedCallback, Type valueType = null, ActionInstanceSide side = ActionInstanceSide.Both, string selectedScenarioId = "", RunExistingScenarioMode runMode = RunExistingScenarioMode.Synchronously)
        {
            var control    = new SelectScenarioAndRunModeView();
            var dialogView = new DialogView(control);

            control.Initialize(valueType, side, selectedScenarioId, runMode);
            control.SelectionChanged += (ctrl) =>
            {
                selectedCallback?.Invoke(control.SelectedScenario, control.SelectedMode);
                dialogView.Close();
            };
            dialogView.Show();
        }
Beispiel #26
0
 public static void UserInitialize(Action <bool> callback, IAction action, ValueTypeBase valueType, bool inheritsSupportedValues, IAction masterAction)
 {
     if (action is IStandardValueAction standardVTAction)
     {
         IStandardVTActionEditView vtAction = CreateControl(standardVTAction, masterAction);
         if (vtAction == null)
         {
             callback?.Invoke(true);
         }
         var dialog = new DialogView((FrameworkElement)vtAction);
         vtAction.ApplyClicked += () =>
         {
             callback(true);
             dialog.Close();
         };
         dialog.Show();
     }
     else if (action is RunExistingScenarioAction runExistingScenAction)
     {
         var runExistingScenarioAction = runExistingScenAction;
         SelectScenarioAndRunModeView.Show(
             (selectedScenario, selectedMode) => {
             var id = selectedScenario.Id;
             runExistingScenarioAction.Mode             = selectedMode;
             runExistingScenarioAction.TargetScenarioId = id;
             runExistingScenarioAction.SetTargetScenario(selectedScenario);
             callback(true);
         },
             valueType?.GetType(),
             Lazurite.Windows.Modules.ActionInstanceSide.OnlyLeft,
             runExistingScenarioAction.TargetScenarioId,
             runExistingScenarioAction.Mode);
     }
     else if (action is GetExistingScenarioValueAction getScenarioValueAction)
     {
         SelectScenarioView.Show(
             (selectedScenario) => {
             var id = selectedScenario.Id;
             getScenarioValueAction.TargetScenarioId = id;
             getScenarioValueAction.SetTargetScenario(selectedScenario);
             callback(true);
         },
             valueType?.GetType(),
             Lazurite.Windows.Modules.ActionInstanceSide.OnlyRight,
             getScenarioValueAction.TargetScenarioId);
     }
     else
     {
         callback(action.UserInitializeWith(valueType, inheritsSupportedValues));
     }
 }
Beispiel #27
0
        private void ItemView_Click(object sender, EventArgs e)
        {
            var statusSwitch = new StatusViewSwitch((SwitchScenarioModel)BindingContext);
            var dialog       = new DialogView(statusSwitch);

            statusSwitch.StateChanged += (o, args) =>
            {
                if (args.Value == StatusViewSwitch.StateChangedSource.Tap)
                {
                    dialog.Close();
                }
            };
            dialog.Show(Helper.GetLastParent(this));
        }
        public static void Show(Action <IModbusTransport> transportCreated, IModbusTransport transport = null, Grid parent = null)
        {
            if (transport == null)
            {
                transport = new ModbusRtuTransport();
            }

            var control = new ConfigureTransportView(transport);
            var dialog  = new DialogView(control);

            control.ApplyPressed += (newTransport) => {
                dialog.Close();
                transportCreated(newTransport);
            };
            dialog.Show(parent);
        }
        public static void Show(string caption, Action <string> entered, Func <string, bool> validation = null, string notation = "")
        {
            DialogView dialogView        = null;
            var        enterPasswordView = new EnterPasswordView(
                caption,
                (pass) =>
            {
                dialogView.Close();
                entered?.Invoke(pass);
            },
                validation,
                notation);

            dialogView = new DialogView(enterPasswordView);
            dialogView.Show();
        }
        private void ItemView_Click(object sender, RoutedEventArgs e)
        {
            var dateTime = DateTime.Now;

            DateTime.TryParse(((ScenarioModel)DataContext).ScenarioValue, out dateTime);
            var dateTimeSwitch = new DateTimeViewSwitch()
            {
                DateTime = dateTime
            };
            var dialog = new DialogView(dateTimeSwitch);

            dateTimeSwitch.Apply += (o, args) => {
                dialog.Close();
                ((ScenarioModel)DataContext).ScenarioValue = dateTimeSwitch.DateTime.ToString();
            };
            dialog.Show();
        }