Exemple #1
0
        public MainWindowModel(Dispatcher dispatcher, ILrControlApplication lrControlApplication, IMainWindowDialogProvider mainWindowDialogProvider) : base(dispatcher)
        {
            _lrControlApplication = lrControlApplication;
            _dialogProvider       = mainWindowDialogProvider;

            // Commands
            OpenSettingsCommand            = new DelegateCommand(OpenSettings);
            SaveCommand                    = new DelegateCommand(() => _lrControlApplication.SaveConfiguration());
            LoadCommand                    = new DelegateCommand(() => _lrControlApplication.LoadConfiguration());
            ExportCommand                  = new DelegateCommand(ExportConfiguration);
            ImportCommand                  = new DelegateCommand(ImportConfiguration);
            ResetCommand                   = new DelegateCommand(Reset);
            RefreshAvailableDevicesCommand = new DelegateCommand(() => _lrControlApplication.RefreshAvailableDevices());

            // Initialize catalogs and controllers
            FunctionGroupManagerViewModel = new FunctionGroupManagerViewModel(dispatcher, _lrControlApplication.FunctionGroupManager);

            InputDevices  = new ObservableCollection <IInputDevice>(_lrControlApplication.InputDevices);
            OutputDevices = new ObservableCollection <IOutputDevice>(_lrControlApplication.OutputDevices);

            // Listen for connection status
            _lrControlApplication.ConnectionStatus += LrControlApplicationOnConnectionStatus;
            _lrControlApplication.PropertyChanged  += LrControlApplicationOnPropertyChanged;

            _lrControlApplication.UpdateConnectionStatus();
        }
Exemple #2
0
        private void ShowMainWindow()
        {
            // Create and show main window
            _lrControlApplication = LrControlApplication.Create();

            var mainWindow = new MainWindow
            {
                WindowState = _lrControlApplication.Settings.StartMinimized ? WindowState.Minimized : WindowState.Normal
            };

            mainWindow.ViewModel = new MainWindowModel(Dispatcher.CurrentDispatcher, _lrControlApplication, new MainWindowDialogProvider(mainWindow));
            mainWindow.Show();
        }