Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Commit

Permalink
Resolved a problem with caliburn.micro not updating the click event b…
Browse files Browse the repository at this point in the history
…indings.
  • Loading branch information
nightowl286 committed Jan 15, 2022
1 parent 90ada64 commit a425594
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/WinUI/ViewModels/EpisodeViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ public void Change(IEpisode episode)
NotifyOfPropertyChange(() => HasStarted);
NotifyOfPropertyChange(() => IsFinished);
}
public void ToggleSeen()
public void ToggleSeen(EpisodeViewModel ep)
{
WatchedPercent = IsFinished ? 0 : 1;
ep.WatchedPercent = ep.IsFinished ? 0 : 1;

IoC.Get<ShellViewModel>().Synchronise();

}
public void Play()
public void Play(EpisodeViewModel ep)
{
var model = IoC.Get<PlayerViewModel>();
model.SetEpisode(this);
model.SetEpisode(ep);

_WindowManager.ShowWindowAsync(model);

Expand Down
8 changes: 6 additions & 2 deletions src/WinUI/Views/EpisodeView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
<Path Height="18" Margin="0,0,-5,0" Stretch="Uniform" Fill="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=Foreground}" Data="{StaticResource Icon.Play}" />
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<cal:ActionMessage MethodName="Play" />
<cal:ActionMessage MethodName="Play">
<cal:Parameter Value="$dataContext" />
</cal:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
Expand All @@ -61,7 +63,9 @@
</Path>
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<cal:ActionMessage MethodName="ToggleSeen" />
<cal:ActionMessage MethodName="ToggleSeen">
<cal:Parameter Value="$dataContext"/>
</cal:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
Expand Down

0 comments on commit a425594

Please sign in to comment.