Skip to content

Commit

Permalink
Change the way movie series form title is shown
Browse files Browse the repository at this point in the history
  • Loading branch information
TolikPylypchuk committed Feb 16, 2020
1 parent eb2abde commit ff254e6
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,11 @@ public sealed class MovieSeriesFormViewModel : MovieSeriesEntryFormBase<MovieSer
.Bind(out this.entries)
.Subscribe();

var formTitleWhenHasTitles = this.FormTitle;
var formTitleWhenDoesNotHaveTitles = Observable.Return(this.GetFormTitle(this.MovieSeries));

this.FormTitle =
this.WhenAnyValue(vm => vm.HasTitles)
.Select(hasTitles => hasTitles ? formTitleWhenHasTitles : formTitleWhenDoesNotHaveTitles)
.Switch()
.ObserveOn(RxApp.MainThreadScheduler);
this.FormTitle
.Select(title => this.MovieSeriesEntry != null
? $"{this.GetFormTitle(this.MovieSeriesEntry.ParentSeries)}: {title}"
: title);

this.PosterUrlRule = this.ValidationRule(vm => vm.PosterUrl, url => url.IsUrl(), "PosterUrlInvalid");

Expand Down Expand Up @@ -243,7 +240,7 @@ private void InitializeValueDependencies()
private string GetFormTitle(MovieSeries movieSeries)
{
string title = movieSeries.ActualTitles.FirstOrDefault(t => !t.IsOriginal)?.Name
?? this.ResourceManager.GetString(this.NewItemKey) ?? String.Empty;
?? this.ResourceManager.GetString(this.NewItemKey) ?? String.Empty;
return movieSeries.Entry == null ? title : $"{this.GetFormTitle(movieSeries.Entry.ParentSeries)}: {title}";
}

Expand Down

0 comments on commit ff254e6

Please sign in to comment.