Interaction logic for MultiTrigger.xaml
상속: System.Windows.Controls.UserControl
예제 #1
0
        private void MultiTrigger_AddTriggerClicked(Controls.MultiTrigger sender)
        {
            if (sender.ParentMultiTrigger != null && sender.ParentValue != null && sender.ParentEvent != null)
            {
                if (sender.ParentEvent.values.Contains(sender.ParentValue))
                {
                    Controls.Event e = events.Find(x => x.ParentEvent == sender.ParentEvent);
                    if (e != null)
                    {
                        int index = e.Values.ToList().FindIndex(x => x.ParentValue == sender.ParentValue);
                        if (index >= 0)
                        {
                            Controls.Value v = e.Values[index];
                            if (v != null)
                            {
                                var t = new Trigger();
                                Controls.Trigger tr = CreateTrigger(t, sender.ParentValue, sender.ParentEvent);

                                sender.ParentMultiTrigger.triggers.Add(t);

                                tr.modifier_COMBO.SelectedItem = "Equal To";
                                sender.Triggers.Add(tr);
                            }
                        }
                    }
                }
            }
        }
예제 #2
0
        private void Value_AddMultiTriggerClicked(Controls.Value val)
        {
            if (val.ParentValue != null && val.ParentEvent != null)
            {
                if (val.ParentEvent.values.Contains(val.ParentValue))
                {
                    Controls.Event e = events.Find(x => x.ParentEvent == val.ParentEvent);
                    if (e != null)
                    {
                        int index = e.Values.ToList().FindIndex(x => x.ParentValue == val.ParentValue);
                        if (index >= 0)
                        {
                            Controls.Value v = e.Values[index];
                            if (v != null)
                            {
                                var multitrigger = new MultiTrigger();
                                val.ParentValue.triggers.Add(multitrigger);

                                Controls.MultiTrigger uiMultiTrigger = CreateMultiTrigger(multitrigger, val.ParentValue, val.ParentEvent);

                                var trigger = new Trigger();
                                multitrigger.triggers.Add(trigger);

                                Controls.Trigger uiTrigger = CreateTrigger(trigger, uiMultiTrigger.ParentValue, uiMultiTrigger.ParentEvent);
                                uiTrigger.modifier_COMBO.SelectedItem = "Equal To";
                                uiMultiTrigger.Triggers.Add(uiTrigger);

                                val.Triggers.Add(uiMultiTrigger);
                            }
                        }
                    }
                }
            }
        }
예제 #3
0
        Controls.Value CreateValue(Value v, Event e)
        {
            Controls.Value result = new Controls.Value();

            result.ParentEvent = e;
            result.ParentValue = v;

            result.SettingChanged         += result_SettingChanged;
            result.RemoveClicked          += Value_RemoveClicked;
            result.AddTriggerClicked      += Value_AddTriggerClicked;
            result.AddMultiTriggerClicked += Value_AddMultiTriggerClicked;

            if (v.result != null)
            {
                result.ValueName = v.result.value.Replace('_', ' ');
            }

            foreach (Trigger t in v.triggers.OfType <Trigger>())
            {
                Controls.Trigger tr = CreateTrigger(t, v, e);
                result.Triggers.Add(tr);
            }

            foreach (MultiTrigger t in v.triggers.OfType <MultiTrigger>())
            {
                Controls.MultiTrigger tr = CreateMultiTrigger(t, v, e);
                result.Triggers.Add(tr);
            }

            return(result);
        }
예제 #4
0
        Controls.MultiTrigger CreateMultiTrigger(MultiTrigger t, Value v, Event e)
        {
            var result = new Controls.MultiTrigger();

            result.ParentPage         = this;
            result.ParentEvent        = e;
            result.ParentValue        = v;
            result.ParentMultiTrigger = t;

            foreach (var trigger in t.triggers)
            {
                result.Triggers.Add(CreateTrigger(trigger, v, e));
            }

            result.AddTriggerClicked += MultiTrigger_AddTriggerClicked;
            result.SettingChanged    += MultiTrigger_SettingChanged;
            result.RemoveClicked     += MultiTrigger_RemoveClicked;

            return(result);
        }
예제 #5
0
        void MultiTrigger_RemoveClicked(Controls.MultiTrigger t)
        {
            if (t.ParentMultiTrigger != null && t.ParentValue != null && t.ParentEvent != null)
            {
                t.ParentValue.triggers.Remove(t.ParentMultiTrigger);

                if (t.ParentEvent.values.Contains(t.ParentValue))
                {
                    Controls.Event e = events.Find(x => x.ParentEvent == t.ParentEvent);
                    if (e != null)
                    {
                        Controls.Value v = e.Values.ToList().Find(x => x.ParentValue == t.ParentValue);
                        if (v != null)
                        {
                            if (v.Triggers.Contains(t))
                            {
                                v.Triggers.Remove(t);
                            }
                        }
                    }
                }
            }
        }
예제 #6
0
        Controls.MultiTrigger CreateMultiTrigger(MultiTrigger t, Value v, Event e)
        {
            var result = new Controls.MultiTrigger();

            result.ParentPage = this;
            result.ParentEvent = e;
            result.ParentValue = v;
            result.ParentMultiTrigger = t;

            foreach (var trigger in t.triggers)
            {
                result.Triggers.Add(CreateTrigger(trigger, v, e));
            }

            result.AddTriggerClicked += MultiTrigger_AddTriggerClicked;
            result.SettingChanged += MultiTrigger_SettingChanged;
            result.RemoveClicked += MultiTrigger_RemoveClicked;

            return result;
        }