Exemplo n.º 1
0
		private async void ExecuteMarkPrioWatchedCommand()
		{
			if( Settings.ConfirmPriorWatched )
			{
				ConfirmationServiceArgs csa = new ConfirmationServiceArgs( Strings.ConfirmAction, Strings.ConfirmMarkPriorWatchedMessage );
				if( !await ViewServices.Execute<IConfirmationService, bool>( csa ) )
				{
					return;
				}

				if( csa.DontAskAgain )
				{
					Settings.ConfirmPriorWatched = false;
					Settings.Save();
				}
			}

			await ViewModelContainer.BackgroundRunner.Run( stats =>
			{
				var eps =
					Series.Episodes.Where(
						e =>
							e.Model.SeasonNumber < Model.SeasonNumber ||
							( e.Model.SeasonNumber == Model.SeasonNumber && e.Model.EpisodeNumber <= Model.EpisodeNumber ) );

				foreach( var ep in eps )
				{
					ep.SetWatched( true );
				}

				Repositories.Series.Update( Series.Model );
				stats.SetResult( true );
			}, Strings.MarkingEpisodesAsWatched ).ContinueWith( t => Series.EpisodesWatched() );
		}
Exemplo n.º 2
0
		private async void ExecuteMarkWatchedCommand( bool watched )
		{
			if( Settings.ConfirmSeasonWatched )
			{
				string message = watched ? Strings.ConfirmMarkWatchedSeasonMessage : Strings.ConfirmMarNotkWatchedSeasonMessage;
				ConfirmationServiceArgs csa = new ConfirmationServiceArgs( Strings.ConfirmAction, message );
				if( !await ViewServices.Execute<IConfirmationService, bool>( csa ) )
				{
					return;
				}

				if( csa.DontAskAgain )
				{
					Settings.ConfirmSeasonWatched = false;
					Settings.Save();
				}
			}

			await ViewModelContainer.BackgroundRunner.Run( stats =>
			{
				foreach( var ep in SeasonEpisodes )
				{
					ep.SetWatched( watched );
				}

				Repositories.Series.Update( Series.Model );
				stats.SetResult( true );
			}, Strings.MarkingEpisodesAsWatched );

			RaisePropertyChanged( nameof( UnwatchedEpisodeCount ) );
			Series.EpisodesWatched();
		}
Exemplo n.º 3
0
		private async void ExecuteDeleteCommand( SeriesEntry entry )
		{
			ConfirmationServiceArgs csa = new ConfirmationServiceArgs( Strings.ConfirmAction, Strings.ConfirmRemoveMessage );
			if( !await ViewServices.Execute<IConfirmationService, bool>( csa ) )
			{
				return;
			}

			Repositories.Series.Delete( entry.Model );

			if( SelectedSeries == entry )
			{
				SelectedSeries = Series.FirstOrDefault( s => s != entry );
			}

			Series.Remove( entry );
		}
Exemplo n.º 4
0
		protected override async void ExecuteOkCommand()
		{
			Settings.Accent = SelectedAccent.Name;
			Settings.Theme = SelectedTheme.Name;
			Settings.Language = SelectedLanguage;
			Settings.ContentLanguage = SelectedContentLanguage;
			Settings.Save();

			base.ExecuteOkCommand();

			if( !Equals( OriginalContentLanguage, SelectedContentLanguage ) )
			{
				ConfirmationServiceArgs csa = new ConfirmationServiceArgs( Strings.ContentLanguageChanged, Strings.ReloadAllSeriesAfterLanguageChange )
				{
					DisplayDontAskAgain = false
				};

				if( await ViewServices.Execute<IConfirmationService, bool>( csa ) )
				{
					MessengerInstance.Send( new ReloadRequest() );
				}
			}
		}