Interaction logic for Event.xaml
Inheritance: System.Windows.Controls.UserControl
Beispiel #1
0
        void AddEvent(Event e, bool select = false)
        {
            Controls.Event ev = CreateEvent(e);

            var event_bt = new Controls.EventButton();

            event_bt.EventName       = String_Functions.UppercaseFirst(e.name.Replace('_', ' '));
            event_bt.SettingChanged += event_bt_SettingChanged;
            event_bt.RemoveClicked  += Event_RemoveClicked;
            event_bt.ParentEvent     = e;

            var bt = new TrakHound_UI.CollapseButton();

            bt.ButtonContent = event_bt;

            if (select)
            {
                event_bt.eventname_TXT.Focus();

                foreach (var obt in EventButtons)
                {
                    obt.IsExpanded = false;
                }
                bt.IsExpanded = true;
            }

            bt.PageContent = ev;

            events.Add(ev);

            EventButtons.Add(bt);
        }
Beispiel #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);
                            }
                        }
                    }
                }
            }
        }
Beispiel #3
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);
                            }
                        }
                    }
                }
            }
        }
Beispiel #4
0
        void Value_AddTriggerClicked(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 t = new Trigger();
                                val.ParentValue.triggers.Add(t);

                                Controls.Trigger tr = CreateTrigger(t, val.ParentValue, val.ParentEvent);
                                tr.modifier_COMBO.SelectedItem = "Equal To";
                                val.Triggers.Add(tr);
                            }
                        }
                    }
                }
            }
        }
Beispiel #5
0
        void Event_AddCaptureItemClicked(Controls.Event e)
        {
            CaptureItem ci = new CaptureItem();

            if (e.ParentEvent != null)
            {
                Controls.CaptureItem item = CreateCaptureItem(ci, e.ParentEvent);
                e.ParentEvent.captureItems.Add(ci);
                e.CaptureItems.Add(item);
            }

            SettingChanged?.Invoke(null, null, null);
        }
Beispiel #6
0
        void CaptureItem_RemoveClicked(Controls.CaptureItem item)
        {
            if (item.ParentEvent != null)
            {
                item.ParentEvent.captureItems.Remove(item.ParentCaptureItem);

                Controls.Event e = events.Find(x => x.ParentEvent == item.ParentEvent);
                if (e != null)
                {
                    if (e.CaptureItems.Contains(item))
                    {
                        e.CaptureItems.Remove(item);
                    }
                }
            }

            SettingChanged?.Invoke(null, null, null);
        }
Beispiel #7
0
        void Value_RemoveClicked(Controls.Value val)
        {
            if (val.ParentValue != null && val.ParentEvent != null)
            {
                if (val.ParentEvent.values.Contains(val.ParentValue))
                {
                    val.ParentEvent.values.Remove(val.ParentValue);

                    Controls.Event e = events.Find(x => x.ParentEvent == val.ParentEvent);
                    if (e != null)
                    {
                        if (e.Values.Contains(val))
                        {
                            e.Values.Remove(val);
                        }
                    }
                }
            }
        }
Beispiel #8
0
        void Event_AddValueClicked(Controls.Event e)
        {
            if (e.ParentEvent != null)
            {
                var value = new Value();

                e.ParentEvent.values.Add(value);

                var uiValue = CreateValue(value, e.ParentEvent);

                var t = new Trigger();
                uiValue.ParentValue.triggers.Add(t);

                Controls.Trigger tr = CreateTrigger(t, uiValue.ParentValue, uiValue.ParentEvent);
                tr.modifier_COMBO.SelectedItem = "Equal To";
                uiValue.Triggers.Add(tr);

                e.Values.Add(uiValue);
            }

            ChangeSetting(null, null, null);
        }
Beispiel #9
0
        Controls.Event CreateEvent(Event e)
        {
            var result = new Controls.Event();

            result.ParentPage  = this;
            result.ParentEvent = e;

            result.Description = e.description;

            result.SettingChanged        += Event_SettingChanged;
            result.AddValueClicked       += Event_AddValueClicked;
            result.AddCaptureItemClicked += Event_AddCaptureItemClicked;

            foreach (Value v in e.values)
            {
                Controls.Value val = CreateValue(v, e);
                result.Values.Add(val);
            }

            foreach (CaptureItem ci in e.captureItems)
            {
                Controls.CaptureItem cap = CreateCaptureItem(ci, e);
                result.CaptureItems.Add(cap);
            }

            // Default
            var def = new Controls.Default();

            def.ParentResult = e.Default;
            if (e.Default != null)
            {
                def.ValueName = e.Default.value;
            }
            def.SettingChanged += def_SettingChanged;
            result.DefaultValue = def;

            return(result);
        }
Beispiel #10
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);
                            }
                        }
                    }
                }
            }
        }
        Controls.Event CreateEvent(Event e)
        {
            var result = new Controls.Event();
            result.ParentPage = this;
            result.ParentEvent = e;

            result.Description = e.description;

            result.SettingChanged += Event_SettingChanged;
            result.AddValueClicked += Event_AddValueClicked;
            result.AddCaptureItemClicked += Event_AddCaptureItemClicked;

            foreach (Value v in e.values)
            {
                Controls.Value val = CreateValue(v, e);
                result.Values.Add(val);
            }

            foreach (CaptureItem ci in e.captureItems)
            {
                Controls.CaptureItem cap = CreateCaptureItem(ci, e);
                result.CaptureItems.Add(cap);
            }

            // Default
            var def = new Controls.Default();
            def.ParentResult = e.Default;
            if (e.Default != null) def.ValueName = e.Default.value;
            def.SettingChanged += def_SettingChanged;
            result.DefaultValue = def;

            return result;
        }