本文整理汇总了C#中ReactiveCommand.RegisterAsyncTask方法的典型用法代码示例。如果您正苦于以下问题:C# ReactiveCommand.RegisterAsyncTask方法的具体用法?C# ReactiveCommand.RegisterAsyncTask怎么用?C# ReactiveCommand.RegisterAsyncTask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReactiveCommand
的用法示例。
在下文中一共展示了ReactiveCommand.RegisterAsyncTask方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CategoryListViewModel
public CategoryListViewModel(IThemeService themeService,
IRssReader rssReader,
IAsyncDownloadManager downloadManager,
INavigationService navigationService,
ILockscreenHelper lockscreen,
IDownloadHelper downloadHelper)
{
_themeService = themeService;
_rssReader = rssReader;
_downloadManager = downloadManager;
_navigationService = navigationService;
_lockscreen = lockscreen;
_downloadHelper = downloadHelper;
AddMorePicturesCommand = Items.CountChanged
.Select(_ => Items.Count < imageMetaData.Count())
.ToCommand();
AddMorePicturesCommand
.RegisterAsyncTask(value => GetImages((int)value));
FullScreenCommand = new ReactiveCommand();
SetLockScreenCommand = new ReactiveCommand();
SetLockScreenCommand
.RegisterAsyncTask(value => SetLockscreen(value as CategoryItem));
DownloadImageCommand = new ReactiveCommand();
DownloadImageCommand
.RegisterAsyncTask(value => DownloadImage(value as CategoryItem));
}
示例2: MainWindowModel
public MainWindowModel()
{
_testDataSource = new TestDataSource();
TestModels = new ReactiveList<TestModel>();
TestViewModels = TestModels.CreateDerivedCollection(m =>
{
var vm = new TestViewModel
{
Id = m.Id,
Name = m.Name,
OtherValue = "",
OriginalModel = m
};
vm.DoStuffWithThisCommand.Subscribe(x => DoStuff(x as TestViewModel));
return vm;
}, m => true, (m, vm) => 0);
SetUpDataCommand = new ReactiveCommand();
SetUpDataCommand.RegisterAsyncTask(_ => _testDataSource.GetTests())
.Subscribe(results =>
{
using (SuppressChangeNotifications())
{
TestModels.Clear();
foreach (var model in results)
TestModels.Add(model);
}
});
}
示例3: LoginViewModel
public LoginViewModel(ILoginService loginFactory,
IAccountsService accountsService)
{
_loginFactory = loginFactory;
WebDomain = "https://github.com";
GoToOldLoginWaysCommand = new ReactiveCommand();
GoToOldLoginWaysCommand.Subscribe(_ => ShowViewModel(CreateViewModel<AddAccountViewModel>()));
LoginCommand = new ReactiveCommand(this.WhenAnyValue(x => x.Code, x => !string.IsNullOrEmpty(x)));
LoginCommand.RegisterAsyncTask(_ => Login(Code))
.Subscribe(x => accountsService.ActiveAccount = x);
}
示例4: AddAccountViewModel
public AddAccountViewModel(ILoginService loginFactory, IAccountsService accountsService)
{
_loginFactory = loginFactory;
this.WhenAnyValue(x => x.AttemptedAccount).Where(x => x != null).Subscribe(x =>
{
Username = x.Username;
Password = x.Password;
Domain = x.Domain;
});
LoginCommand = new ReactiveCommand(this.WhenAnyValue(x => x.Username, y => y.Password, (x, y) => !string.IsNullOrEmpty(x) && !string.IsNullOrEmpty(y)));
LoginCommand.RegisterAsyncTask(_ => Login())
.Subscribe(x => accountsService.ActiveAccount = x);
}
示例5: LoginViewModel
public LoginViewModel(IAuthentication authentication = null)
{
authentication = authentication ?? new Authentication();
var canLogin = this.WhenAny(x => x.LoginName,
x => x.Password,
(l, p) => !String.IsNullOrWhiteSpace(l.Value) && !String.IsNullOrWhiteSpace(p.Value));
LoginCommand = new ReactiveCommand(canLogin);
var loggedIn = LoginCommand.RegisterAsyncTask(_ => authentication.AuthenticateAsync(LoginName,
Password).
ContinueWith(t => t.Result == AuthenticationResult.Authenticated
? "Přihlášen"
: "Nepřihlášen"));
message = new ObservableAsPropertyHelper<string>(loggedIn,
s => raisePropertyChanged("Message"));
}
示例6: ImageDetailsViewModel
public ImageDetailsViewModel(IThemeService themeService,
IRssReader rssReader,
IAsyncDownloadManager downloadManager)
{
_themeService = themeService;
_rssReader = rssReader;
_downloadManager = downloadManager;
OnActivatedCommand = new ReactiveCommand();
OnActivatedCommand.RegisterAsyncTask(_ => OnActivated());
SetLockscreenCommand = new ReactiveCommand();
SetLockscreenCommand.RegisterAsyncTask(_ => SetLockscreen());
DownloadPhotoCommand = new ReactiveCommand();
DownloadPhotoCommand.RegisterAsyncTask(_ => DownloadPhoto());
}
示例7: LoginViewModel
public LoginViewModel(INavigationService service)
{
_service = service;
// Enable the login command when both username and password
// have non emtpy/whitespace values in them
var canLogin = this.WhenAnyValue(
lvm => lvm.Username,
lvm => lvm.Password,
(u, p) => !string.IsNullOrWhiteSpace(u) && !string.IsNullOrWhiteSpace(p));
var cmd = new ReactiveCommand(canLogin);
// call login when invoked
_loginsub = cmd.RegisterAsyncTask(_ => Login()).Subscribe();
LoginCommand = cmd;
Title = "Login";
}
示例8: CategoryListViewModel
public CategoryListViewModel(IThemeService themeService,
IRssReader rssReader,
IAsyncDownloadManager downloadManager,
INavigationService navigationService)
{
this.themeService = themeService;
this.rssReader = rssReader;
this.downloadManager = downloadManager;
this.navigationService = navigationService;
OnActivateCommand = new ReactiveCommand();
OnActivateCommand.RegisterAsyncTask(_ => GetImages());
CategoryItemCommand = new ReactiveCommand();
CategoryItemCommand.Subscribe(item =>
{
var categoryItem = item as CategoryItem;
navigationService
.UriFor<ImageDetailsViewModel>()
.WithParam(x => x.Category, Category)
.WithParam(x => x.Id, categoryItem.Id)
.Navigate();
});
}
示例9: HubViewModel
public HubViewModel(IThemeService themeService,
IRssReader rssReader,
IAsyncDownloadManager downloadManager,
INavigationService navigationService)
{
_themeService = themeService;
_rssReader = rssReader;
_downloadManager = downloadManager;
_navigationService = navigationService;
OnActivateCommand = new ReactiveCommand();
OnActivateCommand.RegisterAsyncTask(_ => OnActivateWork());
WallpaperOfTheDayCommand = new ReactiveCommand();
WallpaperOfTheDayCommand.Subscribe(NavigateToDetailsForWallpaperOfTheDay);
Top4Command = new ReactiveCommand();
Top4Command.Subscribe(NavigateToDetailsForTop4Item);
CategoryCommand = new ReactiveCommand();
CategoryCommand.Subscribe(NavigateToCategoryList);
//BlobCache.LocalMachine.Dispose();
this.updater = TileUpdateManager.CreateTileUpdaterForApplication();
updater.EnableNotificationQueue(true);
}
示例10: MainWindowViewModel
public MainWindowViewModel()
{
var auth = new SingleUserAuthorizer
{
CredentialStore = new SingleUserInMemoryCredentialStore
{
ConsumerKey = ConfigurationManager.AppSettings["consumerKey"],
ConsumerSecret = ConfigurationManager.AppSettings["consumerSecret"],
AccessToken = ConfigurationManager.AppSettings["accessToken"],
AccessTokenSecret = ConfigurationManager.AppSettings["accessTokenSecret"]
}
};
TwitterContext = new TwitterContext(auth);
ReloadTweetsCommand = new ReactiveCommand();
ReloadTweetsCommand.RegisterAsyncTask(_ => ReloadTweets());
Observable.Interval(TimeSpan.FromMinutes(15), RxApp.TaskpoolScheduler).InvokeCommand(ReloadTweetsCommand);
NewTweetCommand =
new ReactiveCommand(this.WhenAnyValue(f => f.NewTweetText.Length,count => count > 0 && count <= 140));
NewTweetCommand.RegisterAsyncTask(_ => SendTweet());
}
示例11: AgentMeetingViewModel
public AgentMeetingViewModel(
IAgentConnection agentConnection,
ISharedDataService sharedDataService,
INavigationService navigation,
IViewModelLocator locator,
IPlatformServices platformServices)
{
_sharedDataService = sharedDataService;
_agentConnection = agentConnection;
NavigationPane = locator.NavigationPaneViewModel;
var startcmd = new ReactiveCommand(this.WhenAnyValue(vm => vm.MeetingStarted, vm => vm.Meeting.VideoConf.VideoInitCompleted, vm => vm.Meeting, (started, video, mtg) => !started && mtg != null));
_startMeetingSub = startcmd.RegisterAsyncTask(async _ =>
{
MeetingStarted = true;
Meeting.VideoConf.Config = await _agentConnection.StartMeeting(Meeting.Id);
}).Subscribe();
var endcmd = new ReactiveCommand(this.WhenAnyValue(vm => vm.MeetingStarted, vm => vm.Meeting.VideoConf.VideoInitCompleted, (meetingStarted, videoStarted) => meetingStarted && videoStarted));
_endMeetingSub = endcmd.RegisterAsyncAction(_ => navigation.BackCommand.Execute(null)).Subscribe();
StartMeetingCommand = startcmd;
EndMeetingCommand = endcmd;
_agentConnection.ClientInMeeting.ToProperty(this, t => t.IsClientInMeeting, out _isClientInMeeting);
var savePdfCmd = new ReactiveCommand(this.WhenAnyValue(vm => vm.MeetingStarted, vm => vm.Meeting.VideoConf.VideoInitCompleted, (meetingStarted, videoStarted) => meetingStarted && videoStarted));
_pdfSub = savePdfCmd.RegisterAsyncTask(async _ =>
{
await _agentConnection.GenerateIllustration(Meeting.Id, _sharedDataService.Person);
}).Subscribe();
_pdfAvailableSub = _agentConnection.PdfAvailable.ObserveOn(RxApp.MainThreadScheduler).Subscribe(async p =>
{
var result = await _agentConnection.GetIllustrationPdfAsync(p);
await platformServices.SaveAndLaunchFile(new System.IO.MemoryStream(result), "pdf");
});
SavePdfCommand = savePdfCmd;
_titleSub = this.WhenAnyValue(
vm => vm.Meeting.Client,
(client) =>
string.Format("Meeting with {0}",
client.FullName)
)
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(t => Title = t);
MeetingStatus = GetMeetingStatusString(IsClientInMeeting, MeetingStarted);
_meetingStatusSub = this.WhenAnyValue(
vm => vm.MeetingStarted,
vm => vm.IsClientInMeeting,
(started, clientIn) => GetMeetingStatusString(clientIn, started))
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(t => MeetingStatus = t);
//_titleSub = this.WhenAnyValue(
// vm => vm.Meeting.Client,
// vm => vm.MeetingStarted,
// vm => vm.IsClientInMeeting,
// (client, started, clientIn) =>
// string.Format("Meeting with {0}. Started: {1} Client Joined: {2}",
// client.FullName, started, clientIn)
// )
// .ObserveOn(RxApp.MainThreadScheduler)
// .Subscribe(t => Title = t);
// When the meeting's active tool changes, set the Tool and page number
// into the shared state so it'll be propagated.
// Get an observable for the currently set tool
var activeToolObs = this.WhenAnyValue(vm => vm.Meeting.ActiveTool)
.Where(t => t != null);
// Every time the tool changes, watch the new tool's CurrentPageNumber
// for changes.
//
// When we get a change, convert that into a ToolIdAndPageNumber, bringing in
// the owning tool id.
var pageChangedObs = activeToolObs
.Select(t => t.WhenAnyValue(v => v.CurrentPageNumber,
p => new ToolIdAndPageNumber { ToolId = t.ToolId, PageNumber = p})
)
.Switch() // Only listen to the most recent sequence of property changes (active tool)
.Log(this, "Current Page Changed", t => string.Format("Tool: {0}, Page: {1}", t.ToolId, t.PageNumber));
// Every time the tool changes, select the tool id and current page number
var toolChangedObs = activeToolObs
.Select(t => new ToolIdAndPageNumber { ToolId = t.ToolId, PageNumber = t.CurrentPageNumber })
.Log(this, "Tool Changed", t => string.Format("Tool: {0}, Page: {1}", t.ToolId, t.PageNumber));
// Merge them together - tool changes and current page of the tool
_meetingStateSub = toolChangedObs
.Merge(pageChangedObs)
.Subscribe(t => sharedDataService.MeetingState.State = t);
//.........这里部分代码省略.........
示例12: GistViewModel
public GistViewModel(IApplicationService applicationService, IShareService shareService)
{
_applicationService = applicationService;
Comments = new ReactiveCollection<GistCommentModel>();
ShareCommand = new ReactiveCommand(this.WhenAnyValue(x => x.Gist, x => x != null));
ShareCommand.Subscribe(_ => shareService.ShareUrl(Gist.HtmlUrl));
ToggleStarCommand = new ReactiveCommand(this.WhenAnyValue(x => x.IsStarred, x => x.HasValue));
ToggleStarCommand.RegisterAsyncTask(async t =>
{
try
{
if (!IsStarred.HasValue) return;
var request = IsStarred.Value ? _applicationService.Client.Gists[Id].Unstar() : _applicationService.Client.Gists[Id].Star();
await _applicationService.Client.ExecuteAsync(request);
IsStarred = !IsStarred.Value;
}
catch (Exception e)
{
throw new Exception("Unable to start gist. Please try again.", e);
}
});
ForkCommand = new ReactiveCommand();
ForkCommand.RegisterAsyncTask(async t =>
{
var data =
await _applicationService.Client.ExecuteAsync(_applicationService.Client.Gists[Id].ForkGist());
var forkedGist = data.Data;
var vm = CreateViewModel<GistViewModel>();
vm.Id = forkedGist.Id;
vm.Gist = forkedGist;
ShowViewModel(vm);
});
GoToViewableFileCommand = new ReactiveCommand();
GoToViewableFileCommand.OfType<GistFileModel>().Subscribe(x =>
{
var vm = CreateViewModel<GistViewableFileViewModel>();
vm.GistFile = x;
ShowViewModel(vm);
});
GoToHtmlUrlCommand = new ReactiveCommand(this.WhenAnyValue(x => x.Gist, x => x != null && !string.IsNullOrEmpty(x.HtmlUrl)));
GoToHtmlUrlCommand.Subscribe(_ => GoToUrlCommand.ExecuteIfCan(Gist.HtmlUrl));
GoToFileSourceCommand = new ReactiveCommand();
GoToFileSourceCommand.OfType<GistFileModel>().Subscribe(x =>
{
var vm = CreateViewModel<GistFileViewModel>();
vm.Id = Id;
vm.GistFile = x;
vm.Filename = x.Filename;
ShowViewModel(vm);
});
GoToUserCommand = new ReactiveCommand(this.WhenAnyValue(x => x.Gist, x => x != null));
GoToUserCommand.Subscribe(x =>
{
var vm = CreateViewModel<ProfileViewModel>();
vm.Username = Gist.Owner.Login;
ShowViewModel(vm);
});
GoToForksCommand = new ReactiveCommand();
LoadCommand.RegisterAsyncTask(t =>
{
var forceCacheInvalidation = t as bool?;
var t1 = this.RequestModel(_applicationService.Client.Gists[Id].Get(), forceCacheInvalidation, response => Gist = response.Data);
this.RequestModel(_applicationService.Client.Gists[Id].IsGistStarred(), forceCacheInvalidation, response => IsStarred = response.Data).FireAndForget();
Comments.SimpleCollectionLoad(_applicationService.Client.Gists[Id].GetComments(), forceCacheInvalidation).FireAndForget();
return t1;
});
}
示例13: NotificationsViewModel
public NotificationsViewModel(IApplicationService applicationService)
{
_applicationService = applicationService;
Notifications = new ReactiveCollection<NotificationModel> {GroupFunc = x => x.Repository.FullName};
LoadCommand.RegisterAsyncTask(t =>
{
var req = applicationService.Client.Notifications.GetAll(all: Filter.All, participating: Filter.Participating);
return this.RequestModel(req, t as bool?, response => Notifications.Reset(response.Data));
});
GoToNotificationCommand = new ReactiveCommand();
GoToNotificationCommand.OfType<NotificationModel>().Subscribe(GoToNotification);
ReadAllCommand = new ReactiveCommand(this.WhenAnyValue(x => x.ShownIndex, x => x != 2));
ReadAllCommand.RegisterAsyncTask(async t =>
{
try
{
if (!Notifications.Any()) return;
await applicationService.Client.ExecuteAsync(applicationService.Client.Notifications.MarkAsRead());
Notifications.Clear();
}
catch (Exception e)
{
throw new Exception("Unable to mark all notifications as read. Please try again.", e);
}
});
ReadRepositoriesCommand = new ReactiveCommand();
ReadRepositoriesCommand.RegisterAsyncTask(async t =>
{
try
{
var repo = t as string;
if (repo == null) return;
var repoId = new CodeFramework.Core.Utils.RepositoryIdentifier(repo);
await applicationService.Client.ExecuteAsync(applicationService.Client.Notifications.MarkRepoAsRead(repoId.Owner, repoId.Name));
Notifications.RemoveAll(Notifications.Where(x => string.Equals(x.Repository.FullName, repo, StringComparison.OrdinalIgnoreCase)).ToList());
}
catch (Exception e)
{
throw new Exception("Unable to mark repositories' notifications as read. Please try again.", e);
}
});
this.WhenAnyValue(x => x.ShownIndex).Subscribe(x =>
{
switch (x)
{
case 0:
Filter = NotificationsFilterModel.CreateUnreadFilter();
break;
case 1:
Filter = NotificationsFilterModel.CreateParticipatingFilter();
break;
default:
Filter = NotificationsFilterModel.CreateAllFilter();
break;
}
});
this.WhenAnyValue(x => x.Filter).Skip(1).Subscribe(x => LoadCommand.ExecuteIfCan());
}
示例14: RepositoryViewModel
public RepositoryViewModel(IApplicationService applicationService)
{
ApplicationService = applicationService;
ToggleStarCommand = new ReactiveCommand(this.WhenAnyValue(x => x.IsStarred, x => x.HasValue));
ToggleStarCommand.RegisterAsyncTask(t => ToggleStar());
ToggleWatchCommand = new ReactiveCommand(this.WhenAnyValue(x => x.IsWatched, x => x.HasValue));
ToggleWatchCommand.RegisterAsyncTask(t => ToggleWatch());
GoToOwnerCommand = new ReactiveCommand();
GoToOwnerCommand.Subscribe(_ =>
{
var vm = CreateViewModel<ProfileViewModel>();
vm.Username = RepositoryOwner;
ShowViewModel(vm);
});
PinCommand = new ReactiveCommand(this.WhenAnyValue(x => x.Repository, x => x != null));
PinCommand.Subscribe(x => PinRepository());
GoToForkParentCommand = new ReactiveCommand(this.WhenAnyValue(x => x.Repository, x => x != null && x.Fork && x.Parent != null));
GoToForkParentCommand.Subscribe(x =>
{
var vm = CreateViewModel<RepositoryViewModel>();
vm.RepositoryOwner = Repository.Parent.Owner.Login;
vm.RepositoryName = Repository.Parent.Name;
vm.Repository = Repository.Parent;
ShowViewModel(vm);
});
GoToStargazersCommand = new ReactiveCommand();
GoToStargazersCommand.Subscribe(_ =>
{
var vm = CreateViewModel<RepositoryStargazersViewModel>();
vm.RepositoryOwner = RepositoryOwner;
vm.RepositoryName = RepositoryName;
ShowViewModel(vm);
});
GoToWatchersCommand = new ReactiveCommand();
GoToWatchersCommand.Subscribe(_ =>
{
var vm = CreateViewModel<RepositoryWatchersViewModel>();
vm.RepositoryOwner = RepositoryOwner;
vm.RepositoryName = RepositoryName;
ShowViewModel(vm);
});
GoToEventsCommand = new ReactiveCommand();
GoToEventsCommand.Subscribe(_ =>
{
var vm = CreateViewModel<RepositoryEventsViewModel>();
vm.RepositoryOwner = RepositoryOwner;
vm.RepositoryName = RepositoryName;
ShowViewModel(vm);
});
GoToIssuesCommand = new ReactiveCommand();
GoToIssuesCommand.Subscribe(_ =>
{
var vm = CreateViewModel<IssuesViewModel>();
vm.RepositoryOwner = RepositoryOwner;
vm.RepositoryName = RepositoryName;
ShowViewModel(vm);
});
GoToReadmeCommand = new ReactiveCommand();
GoToReadmeCommand.Subscribe(_ =>
{
var vm = CreateViewModel<ReadmeViewModel>();
vm.RepositoryOwner = RepositoryOwner;
vm.RepositoryName = RepositoryName;
ShowViewModel(vm);
});
GoToCommitsCommand = new ReactiveCommand();
GoToCommitsCommand.Subscribe(_ =>
{
if (Branches != null && Branches.Count == 1)
{
var vm = CreateViewModel<ChangesetsViewModel>();
vm.RepositoryOwner = RepositoryOwner;
vm.RepositoryName = RepositoryName;
ShowViewModel(vm);
}
else
{
var vm = CreateViewModel<ChangesetBranchesViewModel>();
vm.RepositoryOwner = RepositoryOwner;
vm.RepositoryName = RepositoryName;
ShowViewModel(vm);
}
});
GoToPullRequestsCommand = new ReactiveCommand();
GoToPullRequestsCommand.Subscribe(_ =>
{
var vm = CreateViewModel<PullRequestsViewModel>();
vm.RepositoryOwner = RepositoryOwner;
//.........这里部分代码省略.........
示例15: IssueViewModel
public IssueViewModel(IApplicationService applicationService, IShareService shareService)
{
_applicationService = applicationService;
Comments = new ReactiveCollection<IssueCommentModel>();
Events = new ReactiveCollection<IssueEventModel>();
var issuePresenceObservable = this.WhenAnyValue(x => x.Issue, x => x != null);
ShareCommand = new ReactiveCommand(this.WhenAnyValue(x => x.Issue, x => x != null && !string.IsNullOrEmpty(x.HtmlUrl)));
ShareCommand.Subscribe(_ => shareService.ShareUrl(Issue.HtmlUrl));
AddCommentCommand = new ReactiveCommand();
AddCommentCommand.Subscribe(_ =>
{
var vm = CreateViewModel<CommentViewModel>();
vm.SaveCommand.RegisterAsyncTask(async t =>
{
var issue = _applicationService.Client.Users[RepositoryOwner].Repositories[RepositoryName].Issues[IssueId];
var comment = await _applicationService.Client.ExecuteAsync(issue.CreateComment(vm.Comment));
Comments.Add(comment.Data);
vm.DismissCommand.ExecuteIfCan();
});
ShowViewModel(vm);
});
ToggleStateCommand = new ReactiveCommand(issuePresenceObservable);
ToggleStateCommand.RegisterAsyncTask(async t =>
{
var close = string.Equals(Issue.State, "open", StringComparison.OrdinalIgnoreCase);
try
{
var issue = _applicationService.Client.Users[RepositoryOwner].Repositories[RepositoryName].Issues[Issue.Number];
var data = await _applicationService.Client.ExecuteAsync(issue.UpdateState(close ? "closed" : "open"));
Issue = data.Data;
}
catch (Exception e)
{
throw new Exception("Unable to " + (close ? "close" : "open") + " the item. " + e.Message, e);
}
});
GoToEditCommand = new ReactiveCommand(issuePresenceObservable);
GoToEditCommand.Subscribe(_ =>
{
var vm = CreateViewModel<IssueEditViewModel>();
vm.RepositoryOwner = RepositoryOwner;
vm.RepositoryName = RepositoryName;
vm.Id = IssueId;
vm.Issue = Issue;
vm.WhenAnyValue(x => x.Issue).Skip(1).Subscribe(x => Issue = x);
ShowViewModel(vm);
});
GoToAssigneeCommand = new ReactiveCommand(issuePresenceObservable);
GoToAssigneeCommand.Subscribe(_ =>
{
var vm = CreateViewModel<IssueAssignedToViewModel>();
vm.SaveOnSelect = true;
vm.RepositoryOwner = RepositoryOwner;
vm.RepositoryName = RepositoryName;
vm.IssueId = IssueId;
vm.SelectedUser = Issue.Assignee;
vm.WhenAnyValue(x => x.SelectedUser).Subscribe(x =>
{
Issue.Assignee = x;
this.RaisePropertyChanged("Issue");
});
ShowViewModel(vm);
});
GoToLabelsCommand = new ReactiveCommand(issuePresenceObservable);
GoToLabelsCommand.Subscribe(_ =>
{
var vm = CreateViewModel<IssueLabelsViewModel>();
vm.SaveOnSelect = true;
vm.RepositoryOwner = RepositoryOwner;
vm.RepositoryName = RepositoryName;
vm.IssueId = IssueId;
vm.SelectedLabels.Reset(Issue.Labels);
vm.WhenAnyValue(x => x.SelectedLabels).Subscribe(x =>
{
Issue.Labels = x.ToList();
this.RaisePropertyChanged("Issue");
});
ShowViewModel(vm);
});
GoToMilestoneCommand = new ReactiveCommand(issuePresenceObservable);
GoToMilestoneCommand.Subscribe(_ =>
{
var vm = CreateViewModel<IssueMilestonesViewModel>();
vm.SaveOnSelect = true;
vm.RepositoryOwner = RepositoryOwner;
vm.RepositoryName = RepositoryName;
vm.IssueId = IssueId;
vm.SelectedMilestone = Issue.Milestone;
vm.WhenAnyValue(x => x.SelectedMilestone).Subscribe(x =>
{
Issue.Milestone = x;
this.RaisePropertyChanged("Issue");
});
//.........这里部分代码省略.........