public SettingsPageViewModel(ISettingsRepository settingsRepository, IArticleRepository articleRepository, IPlatformCodeService platformCodeService, IPermissionsService permissionsService)
        {
            _settingsRepository  = settingsRepository;
            _articleRepository   = articleRepository;
            _platformCodeService = platformCodeService;
            _permissionsService  = permissionsService;

            Sources  = _articleRepository.GetAllSources();
            Settings = _settingsRepository.GetEditSettings();
            foreach (var baseSettingModel in Settings)
            {
                baseSettingModel.PropertyChanged += BaseSettingModelOnPropertyChanged;
            }


            _saveCommand               = new LoadingRelayCommand(Save, () => _anythingChanged, true);
            _switchFeedStatusCommand   = new LoadingRelayCommand <FeedModel>(SwitchFeedStatus, f => true, true);
            _switchSourceStatusCommand = new LoadingRelayCommand <SourceModel>(SwitchSourceStatus, f => true, true);
            _resetApplicationCommand   = new LoadingRelayCommand(ResetApplication, () => true, true);

            if (!IsInDesignMode)
            {
                InitializeSettingsAsync();
            }
        }
示例#2
0
        public MyDayViewModel(IWeatherRepository weatherRepository, IProgressService progressService)
        {
            _weatherRepository = weatherRepository;

            _refreshCommand = new LoadingRelayCommand(Refresh);

            Forecasts = _weatherRepository.GetForecasts();
            if (!IsInDesignMode)
            {
                if (_refreshCommand.CanExecute(null))
                    _refreshCommand.Execute(null);
            }
        }
示例#3
0
        public MyDayViewModel(IWeatherRepository weatherRepository, IProgressService progressService)
        {
            _weatherRepository = weatherRepository;

            _refreshCommand = new LoadingRelayCommand(Refresh);

            Forecasts = _weatherRepository.GetForecasts();
            if (!IsInDesignMode)
            {
                if (_refreshCommand.CanExecute(null))
                {
                    _refreshCommand.Execute(null);
                }
            }
        }
示例#4
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public NoteViewModel(INoteRepository noteRepository, IHistoryNavigationService navigationService, IProgressService progressService)
        {
            _noteRepository = noteRepository;
            _navigationService = navigationService;
            _progressService = progressService;
            
            _saveNoteCommand = new LoadingRelayCommand(SaveNote, () => CanSaveNote);
            _removeNoteCommand = new LoadingRelayCommand(RemoveNote);

            _removeNoteCommand.AddDependentCommand(_saveNoteCommand);
            _saveNoteCommand.AddDependentCommand(_removeNoteCommand);

            if (IsInDesignMode)
            {
                ActiveNote = noteRepository.GetCollections()[0].CompletedNotes[0];
            }
        }
示例#5
0
        public MainPageViewModel(IProgressService progressService, IArticleRepository articleRepository, ISettingsRepository settingsRepository, IHistoryNavigationService historyNavigationService, IDialogService dialogService, IPermissionsService permissionsService)
        {
            _articleRepository        = articleRepository;
            _historyNavigationService = historyNavigationService;
            _permissionsService       = permissionsService;

            _openSettingsCommand  = new RelayCommand(OpenSettings);
            _openInfoCommand      = new RelayCommand(OpenInfo);
            _refreshCommand       = new LoadingRelayCommand(Refresh, () => _canRefresh, true);
            _selectArticleCommand = new RelayCommand <ArticleModel>(SelectArticle);
            _selectFeedCommand    = new RelayCommand <FeedModel>(SelectFeed);

            _permissionsService.PermissionsChanged += PermissionsServiceOnPermissionsChanged;

            Sources = _articleRepository.GetActiveSources();

            if (!IsInDesignMode)
            {
                Initialize();
            }
        }
示例#6
0
        public MainPageViewModel(IProgressService progressService, IArticleRepository articleRepository, ISettingsRepository settingsRepository, IHistoryNavigationService historyNavigationService, IDialogService dialogService, IPermissionsService permissionsService)
        {
            _articleRepository = articleRepository;
            _historyNavigationService = historyNavigationService;
            _permissionsService = permissionsService;

            _openSettingsCommand = new RelayCommand(OpenSettings);
            _openInfoCommand = new RelayCommand(OpenInfo);
            _refreshCommand = new LoadingRelayCommand(Refresh, () => _canRefresh, true);
            _selectArticleCommand = new RelayCommand<ArticleModel>(SelectArticle);
            _selectFeedCommand = new RelayCommand<FeedModel>(SelectFeed);

            _permissionsService.PermissionsChanged += PermissionsServiceOnPermissionsChanged;

            Sources = _articleRepository.GetActiveSources();

            if (!IsInDesignMode)
            {
                Initialize();
            }
        }
        public SettingsPageViewModel(ISettingsRepository settingsRepository, IArticleRepository articleRepository, IPlatformCodeService platformCodeService, IPermissionsService permissionsService)
        {
            _settingsRepository = settingsRepository;
            _articleRepository = articleRepository;
            _platformCodeService = platformCodeService;
            _permissionsService = permissionsService;

            Sources = _articleRepository.GetAllSources();
            Settings = _settingsRepository.GetEditSettings();
            foreach (var baseSettingModel in Settings)
                baseSettingModel.PropertyChanged += BaseSettingModelOnPropertyChanged;


            _saveCommand = new LoadingRelayCommand(Save, () => _anythingChanged, true);
            _switchFeedStatusCommand = new LoadingRelayCommand<FeedModel>(SwitchFeedStatus, f => true, true);
            _switchSourceStatusCommand = new LoadingRelayCommand<SourceModel>(SwitchSourceStatus, f => true, true);
            _resetApplicationCommand = new LoadingRelayCommand(ResetApplication, () => true, true);

            if (!IsInDesignMode)
                InitializeSettingsAsync();
        }
示例#8
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel(INoteRepository noteRepository, IProgressService progressService, IHistoryNavigationService navigationService)
        {
            _noteRepository = noteRepository;
            _progressService = progressService;
            _navigationService = navigationService;

            _refreshCommand = new LoadingRelayCommand(Refresh);
            _addNoteCommand = new LoadingRelayCommand(AddNote, () => CanAddNote);
            _removeNote = new LoadingRelayCommand<NoteModel>(RemoveNote);
            _toggleCompleted = new LoadingRelayCommand<NoteModel>(ToggleCompleted);

            NoteCollections = noteRepository.GetCollections();
            NoteCollections.CollectionChanged += NoteCollectionsOnCollectionChanged;
            if (IsInDesignMode)
            {
                ActiveCollection = NoteCollections[0];
            }

            _removeNoteCollection = new LoadingRelayCommand<NoteCollectionModel>(RemoveNoteCollection, CanRemoveNoteCollection);
            _saveNoteCollection = new LoadingRelayCommand<NoteCollectionModel>(SaveNoteCollection, CanSaveNoteCollection);
            _addNoteCollectionCommand = new LoadingRelayCommand(AddNoteCollection, () => CanAddNoteCollection);
            _selectNoteCommand = new RelayCommand<NoteModel>(SelectNote);
        }