示例#1
0
 public MainWindowViewModel(IMainWindow view,
                            IExportLifetimeService exportLifetimeService,
                            ExportFactory <NetworkSettingsPageViewModel> networkSettingsPageFactory,
                            ExportFactory <ActionsPageViewModel> actionsPageFactory) : base(view)
 {
     _exportLifetimeService = exportLifetimeService;
     _networkSettingsPage   = _exportLifetimeService.GetValue(networkSettingsPageFactory);
     _actionsPage           = _exportLifetimeService.GetValue(actionsPageFactory);
 }
        public NetworkSettingsPageViewModel(INetworkSettingsPage view,
                                            ISettingsProvider settingsService,
                                            IExportLifetimeService exportLifetimeService,
                                            ExportFactory <ServerSettingsViewModel> serverSettingsViewModelFactory,
                                            ExportFactory <ClientSettingsViewModel> clientSettingsViewModelFactory) : base(view)
        {
            _settingsService         = settingsService;
            _exportLifetimeService   = exportLifetimeService;
            _serverSettingsViewModel = _exportLifetimeService.GetValue(serverSettingsViewModelFactory);
            _clientSettingsViewModel = _exportLifetimeService.GetValue(clientSettingsViewModelFactory);

            SetNetTypeCommand = new DelegateCommand((obj) => SetNetType((NetType)obj));
            _settingsService.SettingsChanged += _settingsServiceSettingsChanged;

            LoadSettings();

            ViewCore.PageLeft += (sender, args) => LoadSettings();
        }
示例#3
0
 /// <summary>
 /// Открыть окно приложения, если оно закрыто
 /// </summary>
 private void ShowWindow()
 {
     if (_mainWindow == null)
     {
         _mainWindow         = _exportLifetimeService.GetValue(_mainWindowFactory);
         _mainWindow.Closed += (sender, args) =>
         {
             _exportLifetimeService.Dispose(_mainWindow);
             _mainWindow = null;
         };
         _mainWindow.Show();
     }
     else
     {
         _mainWindow.Activate();
     }
 }