private void OnLoaded(object sender, RoutedEventArgs e)
        {
            _bag = new CompositeDisposable();
            TitleBarHandler.BindRepoDropdown(_bag, SetRepository);

            var app = (PahkatApp)Application.Current;

            app.PackageStore.Notifications()
            .Filter(x => x == Notification.RepositoriesChanged)
            .ObserveOn(app.Dispatcher)
            .SubscribeOn(app.Dispatcher)
            .StartWith(Notification.RepositoriesChanged)
            .Subscribe(x => { ConfigureWebView(); })
            .DisposedBy(_bag);
        }
Пример #2
0
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            _bag = new CompositeDisposable();
            NavigationService.Navigating += NavigationService_Navigating;

            _packageToggled = TvPackages.ReactiveKeyDown()
                              .Filter(x => x.EventArgs.Key == Key.Space)
                              .Map(_ => Unit.Default).Merge(TvPackages.ReactiveDoubleClick()
                                                            .Filter(x => {
                var hitTest = TvPackages.InputHitTest(x.EventArgs.GetPosition((IInputElement)x.Sender));
                return(!(hitTest is Rectangle));
            })
                                                            .Map(_ => Unit.Default))
                              .Map(_ => TvPackages.SelectedItem as PackageMenuItem)
                              .NotNull() !;

            _groupToggled =
                TvPackages.ReactiveKeyDown()
                .Filter(x => x.EventArgs.Key == Key.Space)
                .Map(_ => TvPackages.SelectedItem as PackageCategoryTreeItem)
                .NotNull() !;

            _presenter.Start().DisposedBy(_bag);

            TitleBarHandler.BindRepoDropdown(_bag, async x => {
                var app     = (PahkatApp)Application.Current;
                var repos   = (await app.PackageStore.RepoIndexes()).Values.ToArray();
                var records = await app.PackageStore.GetRepoRecords();

                TitleBarHandler.RefreshFlyoutItems(TitleBarReposButton, TitleBarReposFlyout, repos, records);
                // _presenter.BindNewRepositories(_sortedBy.Value);
            });

            ConfigureSortBy();

            TvPackages.Focus();
        }