Exemplo n.º 1
0
        public MainWindowViewModel(ApplicationSettings settings,
		                           DataSources dataSources,
		                           QuickFilters quickFilters,
		                           IActionCenter actionCenter,
		                           IAutoUpdater updater,
		                           IDispatcher dispatcher)
        {
            if (dataSources == null) throw new ArgumentNullException("dataSources");
            if (quickFilters == null) throw new ArgumentNullException("quickFilters");
            if (updater == null) throw new ArgumentNullException("updater");
            if (dispatcher == null) throw new ArgumentNullException("dispatcher");

            _dataSourcesViewModel = new DataSourcesViewModel(settings, dataSources);
            _dataSourcesViewModel.PropertyChanged += DataSourcesViewModelOnPropertyChanged;
            _quickFilters = new QuickFiltersViewModel(settings, quickFilters);
            _quickFilters.OnFiltersChanged += OnQuickFiltersChanged;
            _settings = new SettingsViewModel(settings);
            _actionCenter = new ActionCenterViewModel(dispatcher, actionCenter);

            _timer = new DispatcherTimer
                {
                    Interval = TimeSpan.FromMilliseconds(100)
                };
            _timer.Tick += TimerOnTick;
            _timer.Start();

            _autoUpdater = new AutoUpdateViewModel(updater, settings.AutoUpdate, dispatcher);

            _dispatcher = dispatcher;
            WindowTitle = Constants.MainWindowTitle;

            _selectNextDataSourceCommand = new DelegateCommand(SelectNextDataSource);
            _selectPreviousDataSourceCommand = new DelegateCommand(SelectPreviousDataSource);
            _addDataSourceCommand = new DelegateCommand(AddDataSource);

            ChangeDataSource(CurrentDataSource);
        }
 public void SetUp()
 {
     _settings = new ApplicationSettings("foo");
     _model = new SettingsViewModel(_settings);
 }