Exemplo n.º 1
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();
        }
Exemplo n.º 2
0
        public TriggerView(Lazurite.MainDomain.TriggerBase trigger)
        {
            InitializeComponent();

            Refresh(trigger);

            buttons.AddNewClick += () => complexActionView.AddFirst();

            btScaleMinus.Click += (o, e) => {
                scale.ScaleX -= 0.1;
                scale.ScaleY -= 0.1;
            };

            btScalePlus.Click += (o, e) => {
                scale.ScaleX += 0.1;
                scale.ScaleY += 0.1;
            };

            complexActionView.Modified += (element) => Modified?.Invoke();

            btSelectScenario.Click += (o, e) => {
                SelectScenarioView.Show(
                    (selectedScenario) => {
                    if (_trigger.GetScenario() != null && !_trigger.GetScenario().ValueType.IsCompatibleWith(selectedScenario.ValueType))
                    {
                        _trigger.TargetAction = new ComplexAction();
                    }
                    _trigger.TargetScenarioId = selectedScenario.Id;
                    _trigger.SetScenario(selectedScenario);
                    Refresh(trigger);
                    Modified?.Invoke();
                },
                    null,
                    ActionInstanceSide.OnlyRight,
                    _trigger.TargetScenarioId
                    );
            };
        }