Exemplo n.º 1
0
        public ManageScheduleWindow(MainWindow parent, WorkMode workMode, Schedule schedule = null)
        {
            _parent   = parent;
            _workMode = workMode;

            if (_workMode == WorkMode.Add)
            {
                Schedule = new Schedule(true);
            }
            else
            {
                _originalSchedule = schedule;

                var serialized = JsonConvert.SerializeObject(schedule); //Deep copy the schedule when editing
                Schedule = JsonConvert.DeserializeObject <Schedule>(serialized);
            }

            DataContext = Schedule;

            InitializeComponent();

            _dayUserControls = new List <DayUserControl>();
            _dayUserControls.Add(MondayUserControl);
            _dayUserControls.Add(TuesdayUserControl);
            _dayUserControls.Add(WednesdayUserControl);
            _dayUserControls.Add(ThursdayUserControl);
            _dayUserControls.Add(FridayUserControl);
            _dayUserControls.Add(SaturdayUserControl);
            _dayUserControls.Add(SundayUserControl);

            SetupDayUserControls();

            EventUserControl.EventTriggers = Schedule.EventTriggers;
            EventUserControl.BuildTriggerList();
        }
Exemplo n.º 2
0
        public EventTriggerUserControl(EventUserControl parent, TriggerBase trigger, bool highestPriority, bool lowestPriority)
        {
            _trigger = trigger;
            _parent  = parent;

            InitializeComponent();

            TriggerType = EnumLocalizer.GetLocalizedEnum(trigger.GetTriggerType());
            Description = trigger.GetDescription();
            EffectName  = trigger.GetEffectName();
            Brightness  = trigger.GetBrightness().ToString();
            Priority    = trigger.Priority;

            if (highestPriority)
            {
                PriorityUpButton.Visibility = System.Windows.Visibility.Hidden;
            }

            if (lowestPriority)
            {
                PriorityDownButton.Visibility = System.Windows.Visibility.Hidden;
            }

            DataContext = this;
        }
        public AddProcessEventWindow(EventUserControl parent)
        {
            _parent = parent;
            Effects = new List <Effect>(UserSettings.Settings.ActiveDevice.Effects);
            Effects.InsertRange(0, OrchestratorCollection.GetOrchestratorForDevice(UserSettings.Settings.ActiveDevice).GetCustomEffectAsEffects());

            DataContext = this;

            InitializeComponent();
        }
        public AddProcessEventWindow(EventUserControl parent)
        {
            _parent = parent;

            DataContext = this;

            InitializeComponent();

            EffectComboBox.InitializeEffects();
            EffectComboBox.ParentUserControl = this;
        }
        public EventTriggerUserControl(EventUserControl parent, TriggerBase trigger)
        {
            _trigger = trigger;
            _parent  = parent;

            InitializeComponent();

            TriggerType = EnumLocalizer.GetLocalizedEnum(trigger.GetTriggerType());
            Description = trigger.GetDescription();
            EffectName  = trigger.GetEffectName();
            Brightness  = trigger.GetBrightness().ToString();

            DataContext = this;
        }
        public AddSpotifyEventWindow(EventUserControl parent, Dictionary <string, string> playlists)
        {
            _parent = parent;

            Playlists = playlists.Select(playlist => new SpotifyPlaylistViewModel {
                PlaylistId = playlist.Key, PlaylistName = playlist.Value
            }).ToList();

            DataContext = this;

            InitializeComponent();

            EffectComboBox.InitializeEffects();
            EffectComboBox.ParentUserControl = this;
        }
        public ManageScheduleWindow(MainWindow parent, WorkMode workMode, Schedule schedule = null)
        {
            _parent   = parent;
            _workMode = workMode;

            if (_workMode == WorkMode.Add)
            {
                Schedule = new Schedule(true);
            }
            else
            {
                _originalSchedule = schedule;

                var serialized = JsonConvert.SerializeObject(schedule); //Deep copy the schedule when editing
                Schedule = JsonConvert.DeserializeObject <Schedule>(serialized);
            }

            DataContext = Schedule;

            InitializeComponent();

            _dayUserControls = new List <DayUserControl>();
            _dayUserControls.Add(MondayUserControl);
            _dayUserControls.Add(TuesdayUserControl);
            _dayUserControls.Add(WednesdayUserControl);
            _dayUserControls.Add(ThursdayUserControl);
            _dayUserControls.Add(FridayUserControl);
            _dayUserControls.Add(SaturdayUserControl);
            _dayUserControls.Add(SundayUserControl);

            SetupDayUserControls();

            EventUserControl.EventTriggers = Schedule.EventTriggers;
            EventUserControl.BuildTriggerList();

            //Set the device dropdown values
            DevicesDropdown.ItemsSource   = UserSettings.Settings.Devices.Select(device => device.Name);
            DevicesDropdown.SelectedValue = Schedule.AppliedDeviceNames;
        }