Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit f728d41

Browse files
committed
Subscribe using ReactiveUI
1 parent bfebeae commit f728d41

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/GitHub.InlineReviews/Services/PullRequestStatusBarManager.cs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System.Windows.Input;
44
using System.Windows.Controls;
55
using System.Windows.Controls.Primitives;
6-
using System.ComponentModel;
76
using System.ComponentModel.Composition;
87
using GitHub.InlineReviews.Views;
98
using GitHub.InlineReviews.ViewModels;
@@ -13,6 +12,7 @@
1312
using GitHub.Logging;
1413
using GitHub.Extensions;
1514
using Serilog;
15+
using ReactiveUI;
1616

1717
namespace GitHub.InlineReviews.Services
1818
{
@@ -39,24 +39,15 @@ public void StartShowingStatus()
3939
{
4040
// Create just in time on Main thread.
4141
pullRequestSessionManager = serviceProvider.GetService<IPullRequestSessionManager>();
42-
43-
RefreshCurrentSession();
44-
pullRequestSessionManager.PropertyChanged += PullRequestSessionManager_PropertyChanged;
42+
pullRequestSessionManager.WhenAnyValue(x => x.CurrentSession)
43+
.Subscribe(x => RefreshCurrentSession());
4544
}
4645
catch (Exception e)
4746
{
4847
log.Error(e, "Error initializing");
4948
}
5049
}
5150

52-
void PullRequestSessionManager_PropertyChanged(object sender, PropertyChangedEventArgs e)
53-
{
54-
if (e.PropertyName == nameof(PullRequestSessionManager.CurrentSession))
55-
{
56-
RefreshCurrentSession();
57-
}
58-
}
59-
6051
void RefreshCurrentSession()
6152
{
6253
var pullRequest = pullRequestSessionManager.CurrentSession?.PullRequest;

0 commit comments

Comments
 (0)