Пример #1
0
        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);
        }
Пример #3
0
        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
                        });
                    }
                }
            });
        }
Пример #4
0
 public PricesViewModel()
 {
     ShopService   = ShopService.Instance;
     AddPriceGroup = ReactiveCommand.CreateFromTask(AddPriceGroupImpl);
 }
Пример #5
0
 public AddAccountViewModel(IApplicationService application, ILoginFactory loginFactory)
 {
     _application  = application;
     _loginFactory = loginFactory;
     LoginCommand  = ReactiveUI.ReactiveCommand.CreateFromTask(Login);
 }
Пример #6
0
        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));
        }