Exemple #1
0
        /// <summary>
        /// Updates all elements to display the current effect and brightness
        /// </summary>
        public void Update()
        {
            //Update UI on main thread
            Dispatcher.Invoke(new Action(() =>
            {
                var orchestrator = OrchestratorCollection.GetOrchestratorForDevice(_device);
                var activeEffect = orchestrator.GetActiveEffectName();

                if (string.IsNullOrEmpty(activeEffect))
                {
                    ActiveEffectLabel.Content = MainWindows.Resources.None;
                }
                else
                {
                    ActiveEffectLabel.Content = $"{activeEffect} ({EnumLocalizer.GetLocalizedEnum(_device.OperationMode)})";
                }

                _selectedEffect = activeEffect;

                var activeBrightness = orchestrator.GetActiveBrightness();
                Brightness           = activeBrightness < 0 ? 0 : activeBrightness;
                OnPropertyChanged(nameof(Brightness)); //Call property changed to correctly set slider position

                //Update the colors in the mainwindow
                _parent.UpdateLayoutColors(_device.Name);

                //Update the dropdown
                EffectComboBox.UpdateSelection(_selectedEffect);
            }));
        }
Exemple #2
0
        public DeviceUserControl(Device device, MainWindow parent)
        {
            InitializeComponent();

            _device = device;
            SetOrchestrator();

            _parent = parent;

            DeviceNameLabel.Content = _device.Name;

            //Set the correct icon
            switch (_orchestrator.PanelLayout.DeviceType)
            {
            case DeviceType.Canvas:
                SquareIcon.Visibility = Visibility.Visible;
                break;

            case DeviceType.Aurora:
                TriangleIcon.Visibility = Visibility.Visible;
                break;

            default:
                throw new NotImplementedException($"No icon implemented for device type {_orchestrator.PanelLayout.DeviceType}");
            }

            //Initialize the effect combox box
            EffectComboBox.InitializeEffects(_orchestrator);
            EffectComboBox.ParentUserControl = this;

            DataContext = this;

            Update();
        }
Exemple #3
0
        public void ReloadEffects()
        {
            //Reset the orchestrator since it can happen that the orchestrators have been reset before calling this function
            SetOrchestrator();

            EffectComboBox.InitializeEffects(_orchestrator);

            EffectComboBox.UpdateSelection(_selectedEffect);
        }
Exemple #4
0
        public void ReloadEffects()
        {
            //Reset the orchestrator since it can happen that the orchestrators have been reset before calling this function
            RegisterWithOrchestrator();

            var orchestrator = OrchestratorCollection.GetOrchestratorForDevice(_device);

            EffectComboBox.InitializeEffects(orchestrator);

            EffectComboBox.UpdateSelection(_selectedEffect);
        }
        public AddProcessEventWindow(EventUserControl parent)
        {
            _parent = parent;

            DataContext = this;

            InitializeComponent();

            EffectComboBox.InitializeEffects();
            EffectComboBox.ParentUserControl = 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;
        }
Exemple #7
0
        public AddTimeTriggerWindow(DayUserControl parent)
        {
            _parent = parent;

            _triggerTypeMapping = new Dictionary <string, TriggerType>()
            {
                { EnumLocalizer.GetLocalizedEnum(TriggerType.Time), TriggerType.Time },
                { EnumLocalizer.GetLocalizedEnum(TriggerType.Sunrise), TriggerType.Sunrise },
                { EnumLocalizer.GetLocalizedEnum(TriggerType.Sunset), TriggerType.Sunset }
            };

            DataContext = this;

            InitializeComponent();

            SelectedTriggerType = EnumLocalizer.GetLocalizedEnum(TriggerType.Time);

            EffectComboBox.InitializeEffects();
            EffectComboBox.ParentUserControl = this;
        }