Initialize() публичный Метод

public Initialize ( ) : bool
Результат bool
Пример #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            try
            {
                _settings = SerializationHelper.LoadObjectFromFile <AmbilightSettings>(PATH_SETTINGS) ??
                            new AmbilightSettings();
                IScreenCapture screenCapture = new DX9ScreenCapture();

                // DarthAffe 05.11.2016: This could be done way cleaner ...
                _taskBar = FindResource("Taskbar") as TaskbarIcon;
                FrameworkElement configView = _taskBar?.TrayPopup as ConfigView;
                if (configView == null)
                {
                    Shutdown();
                }
                else
                {
                    configView.DataContext = new ConfigViewModel(_settings);
                }

                _ambilight = new Ambilight(screenCapture, _settings);
                if (!_ambilight.Initialize())
                {
                    throw new ApplicationException();
                }
            }
            catch
            {
                MessageBox.Show("An error occured while starting the Keyboard-Ambilight.\r\nPlease double check if CUE is running and 'Enable SDK' is checked.", "Can't start Keyboard-Ambilight");
                Shutdown();
            }
        }
Пример #2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            try
            {
                _settings = SerializationHelper.LoadObjectFromFile<AmbilightSettings>(PATH_SETTINGS) ??
                    new AmbilightSettings();
                IScreenCapture screenCapture = new DX9ScreenCapture();

                // DarthAffe 05.11.2016: This could be done way cleaner ...
                _taskBar = FindResource("Taskbar") as TaskbarIcon;
                FrameworkElement configView = _taskBar?.TrayPopup as ConfigView;
                if (configView == null)
                    Shutdown();
                else
                    configView.DataContext = new ConfigViewModel(_settings);

                _ambilight = new Ambilight(screenCapture, _settings);
                if (!_ambilight.Initialize())
                    throw new ApplicationException();
            }
            catch
            {
                MessageBox.Show("An error occured while starting the Keyboard-Ambilight.\r\nPlease double check if CUE is running and 'Enable SDK' is checked.", "Can't start Keyboard-Ambilight");
                Shutdown();
            }
        }