コード例 #1
0
        /// <summary>
        /// Creates ne instance of <see cref="VoiceCommandsHandler"/>
        /// </summary>
        /// <param name="logger">Instance of <see cref="ILogger"/></param>
        /// <param name="applicationSettingsHelper">Instance of <see cref="IApplicationSettingsHelper"/></param>
        /// <param name="episodeListManager">Instance of <see cref="IEpisodeListManager"/></param>
        /// <param name="playbackManager">Instance of <see cref="IPlaybackManager"/></param>
        /// <param name="textSpeaker">Instance of <see cref="ITextSpeaker"/></param>
        public VoiceCommandsHandler(
            ILogger logger,
            IApplicationSettingsHelper applicationSettingsHelper,
            IEpisodeListManager episodeListManager,
            IPlaybackManager playbackManager,
            ITextSpeaker textSpeaker)
        {
            this.textSpeaker = textSpeaker;
            this.playbackManager = playbackManager;
            this.episodeListManager = episodeListManager;
            this.applicationSettingsHelper = applicationSettingsHelper;
            this.logger = logger;

            Initialization = initializeAsync();
            logger.LogMessage("Voice commands handler initialized.", LoggingLevel.Information);
        }
コード例 #2
0
        /// <summary>
        /// Creates new instance of <see cref="EpisodesViewModel"/>
        /// </summary>
        /// <param name="logger">Instance of <see cref="ILogger"/></param>
        /// <param name="playlist">Instance of <see cref="IPlayList"/></param>
        /// <param name="loaderFactory">Instance of <see cref="ILoaderFactory"/></param>
        /// <param name="navigationService">Instance of <see cref="INavigationService"/></param>
        /// <param name="applicationSettingsHelper">Instance of <see cref="IApplicationSettingsHelper"/></param>
        /// <param name="downloadManager">Instance of <see cref="IDownloadManager"/></param>
        public EpisodesViewModel(
            ILogger logger,
            INavigationService navigationService,
            IApplicationSettingsHelper applicationSettingsHelper,
            IDownloadManager downloadManager,
            IEpisodeListManager episodeListManager)
        {
            this.logger = logger;
            this.navigationService = navigationService;
            this.applicationSettingsHelper = applicationSettingsHelper;
            this.downloadManager = downloadManager;
            this.episodeListManager = episodeListManager;

            RefreshCommand = new RelayCommand(loadEpisodeListFromServer);
            DownloadCommand = new RelayCommand(downloadEpisode);
            CancelDownloadCommand = new RelayCommand((Action<object>)cancelDownload);
            DeleteCommand = new RelayCommand((Action<object>)deleteEpisodeFromStorage);
            PlayCommand = new RelayCommand((Action<object>)playEpisode);
            AddToPlaylistCommand = new RelayCommand((Action<object>)addToPlaylistCommand);
            ClearPlaylistCommand = new RelayCommand((Action)clearPlaylistCommand);

            Application.Current.Resuming += onAppResuming;
            Application.Current.Suspending += (_, __) => unregisterUpdaterCompletionHandler();
            Application.Current.UnhandledException += (_, __) => unregisterUpdaterCompletionHandler();
            backgroundUpdaterTask = BackgroundTaskRegistration.AllTasks
                .Where(t => t.Value.Name == Constants.BackgroundUpdaterTaskName)
                .Select(t => t.Value)
                .FirstOrDefault();
            Initialization = initializeAsync();
            logger.LogMessage("EpisodesViewModel: Initialized.", LoggingLevel.Information);
        }