Interaction logic for EventButton.xaml
상속: System.Windows.Controls.UserControl
예제 #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);
        }
예제 #2
0
        void Event_RemoveClicked(Controls.EventButton bt)
        {
            if (bt.ParentEvent != null)
            {
                int index = GeneratedEvents.ToList().FindIndex(x => x == bt.ParentEvent);
                if (index >= 0)
                {
                    Event e = GeneratedEvents[index];

                    GeneratedEvents.Remove(e);

                    index = EventButtons.ToList().FindIndex(x => x.ButtonContent == bt);
                    if (index >= 0)
                    {
                        EventButtons.RemoveAt(index);
                    }
                }
            }

            if (EventButtons.Count > 0)
            {
                DisplayEvents = true;
            }
            else
            {
                DisplayEvents = false;
            }

            ChangeSetting(null, null, null);
        }
예제 #3
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);
        }