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

Commit b9b54ce

Browse files
committed
Use interface instead of class for cancel commands
1 parent ab16bca commit b9b54ce

File tree

7 files changed

+8
-12
lines changed

7 files changed

+8
-12
lines changed

src/GitHub.App/SampleData/PullRequestCreationViewModelDesigner.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using GitHub.Validation;
66
using System;
77
using System.Windows.Input;
8+
using ReactiveUI;
89

910
namespace GitHub.SampleData
1011
{
@@ -39,7 +40,7 @@ public PullRequestCreationViewModelDesigner()
3940
public string SelectedAssignee { get; set; }
4041
public List<string> Users { get; set; }
4142

42-
public ICommand CreatePullRequest { get; }
43+
public IReactiveCommand<IPullRequestModel> CreatePullRequest { get; }
4344

4445
public string PRTitle { get; set; }
4546

src/GitHub.App/ViewModels/BaseViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public BaseViewModel()
1414
CancelCommand = ReactiveCommand.Create();
1515
}
1616

17-
public ReactiveCommand<object> CancelCommand { get; protected set; }
17+
public IReactiveCommand<object> CancelCommand { get; protected set; }
1818
public ICommand Cancel { get { return CancelCommand; } }
1919

2020
public string Title {[return: AllowNull] get; protected set; }

src/GitHub.App/ViewModels/LogoutRequiredViewModel.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public LogoutRequiredViewModel(IRepositoryHosts repositoryHosts, INotificationSe
3333

3434
Title = Resources.LogoutRequiredTitle;
3535
Logout = ReactiveCommand.CreateAsyncObservable(OnLogout);
36-
CancelCommand = ReactiveCommand.Create();
3736
Icon = Octicon.mark_github;
3837
}
3938

src/GitHub.Exports.Reactive/ViewModels/ILogoutRequiredViewModel.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,9 @@ namespace GitHub.ViewModels
77
/// <summary>
88
/// Represents a view model for the "Log out Required" dialog..
99
/// </summary>
10-
public interface ILogoutRequiredViewModel : IViewModel
10+
public interface ILogoutRequiredViewModel : IReactiveViewModel
1111
{
1212
IReactiveCommand<ProgressState> Logout { get; }
13-
14-
ReactiveCommand<object> CancelCommand { get; }
15-
1613
string LogoutRequiredMessage { get; set; }
1714
Octicon Icon { get; set; }
1815
}

src/GitHub.Exports.Reactive/ViewModels/IPullRequestCreationViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Collections.Generic;
44
using System.Windows.Input;
55
using GitHub.Validation;
6+
using ReactiveUI;
67

78
namespace GitHub.ViewModels
89
{
@@ -11,9 +12,8 @@ public interface IPullRequestCreationViewModel : IReactiveViewModel
1112
IBranch SourceBranch { get; set; }
1213
IBranch TargetBranch { get; set; }
1314
IReadOnlyList<IBranch> Branches { get; }
14-
ICommand CreatePullRequest { get; }
15+
IReactiveCommand<IPullRequestModel> CreatePullRequest { get; }
1516
string PRTitle { get; set; }
1617
ReactivePropertyValidator TitleValidator { get; }
17-
ReactivePropertyValidator BranchValidator { get; }
1818
}
1919
}

src/GitHub.Exports.Reactive/ViewModels/IReactiveViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ namespace GitHub.ViewModels
44
{
55
public interface IReactiveViewModel : IViewModel
66
{
7-
ReactiveCommand<object> CancelCommand { get; }
7+
IReactiveCommand<object> CancelCommand { get; }
88
}
99
}

src/GitHub.Exports.Reactive/ViewModels/ITwoFactorDialogViewModel.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44

55
namespace GitHub.ViewModels
66
{
7-
public interface ITwoFactorDialogViewModel : IViewModel
7+
public interface ITwoFactorDialogViewModel : IReactiveViewModel
88
{
99
ReactiveCommand<object> OkCommand { get; }
10-
ReactiveCommand<object> CancelCommand { get; }
1110
ReactiveCommand<object> NavigateLearnMore { get; }
1211
ReactiveCommand<object> ResendCodeCommand { get; }
1312

0 commit comments

Comments
 (0)