public ChangesetViewModel(IApplicationService application, IFeaturesService featuresService) { _applicationService = application; _featuresService = featuresService; GoToOwner = ReactiveUI.ReactiveCommand.Create(this.Bind(x => x.Changeset, true).Select(x => x?.Author?.Login != null)); GoToOwner.Subscribe(_ => ShowViewModel <UserViewModel>(new UserViewModel.NavObject { Username = Changeset?.Author?.Login })); }
public override void Init() { deviceService.SelectedDevice .Do(device => Device = device) .ObserveOnDispatcher() .Subscribe() .AddDisposableTo(Disposables); SaveCommand = ReactiveUI.ReactiveCommand.CreateFromTask(SaveDeviceSettings) .AddDisposableTo(Disposables); ResetCommand = ReactiveUI.ReactiveCommand.CreateFromTask(ResetDevice) .AddDisposableTo(Disposables); }
public SourceTreeViewModel(IApplicationService applicationService, IFeaturesService featuresService) { _applicationService = applicationService; _featuresService = featuresService; GoToItemCommand = ReactiveUI.ReactiveCommand.Create <ContentModel>(x => { if (x.Type.Equals("dir", StringComparison.OrdinalIgnoreCase)) { ShowViewModel <SourceTreeViewModel>(new NavObject { Username = Username, Branch = Branch, Repository = Repository, Path = x.Path, TrueBranch = TrueBranch }); } if (x.Type.Equals("file", StringComparison.OrdinalIgnoreCase)) { if (x.DownloadUrl == null) { var nameAndSlug = x.GitUrl.Substring(x.GitUrl.IndexOf("/repos/", StringComparison.Ordinal) + 7); var indexOfGit = nameAndSlug.LastIndexOf("/git", StringComparison.Ordinal); indexOfGit = indexOfGit < 0 ? 0 : indexOfGit; var repoId = RepositoryIdentifier.FromFullName(nameAndSlug.Substring(0, indexOfGit)); if (repoId == null) { return; } var sha = x.GitUrl.Substring(x.GitUrl.LastIndexOf("/", StringComparison.Ordinal) + 1); ShowViewModel <SourceTreeViewModel>(new NavObject { Username = repoId?.Owner, Repository = repoId?.Name, Branch = sha }); } else { ShowViewModel <SourceViewModel>(new SourceViewModel.NavObject { Name = x.Name, Username = Username, Repository = Repository, Branch = Branch, Path = x.Path, HtmlUrl = x.HtmlUrl, GitUrl = x.GitUrl, TrueBranch = TrueBranch }); } } }); }
public PricesViewModel() { ShopService = ShopService.Instance; AddPriceGroup = ReactiveCommand.CreateFromTask(AddPriceGroupImpl); }
public AddAccountViewModel(IApplicationService application, ILoginFactory loginFactory) { _application = application; _loginFactory = loginFactory; LoginCommand = ReactiveUI.ReactiveCommand.CreateFromTask(Login); }
public SimulationListViewModel(IObservableList <SimulationRowViewModel> simulations, ReactiveUI.ReactiveCommand renderCommand) { if (simulations == null) { throw new ArgumentNullException(nameof(simulations)); } simulations .Connect() .Bind(Simulations) .Subscribe(); RenderCommand = renderCommand ?? throw new ArgumentNullException(nameof(renderCommand)); }