Ejemplo n.º 1
0
        private async void LoadVm(string address)
        {
            vm          = new DesktopVisitingViewModel();
            DataContext = vm;
            vc          = new VisitingControlView {
                DataContext = vm
            };
            titleService = AppEngine.GetRequiredService <TitleService>();
            titleService.LeftControls.Add(vc);
            try
            {
                await vm.Visiting.LoadAsync(address);

                if (vm.HasStoreBox)
                {
                    await vm.GoChapterIndexAsync(vm.StoreBox.AttackModel.CurrentChapter);
                }
                else
                {
                    await vm.NextChapterAsync();
                }
                _ = LoadPageAsync(0);
                vm.TransverseChanged += Vm_TransverseChanged;
                rep = this.Get <ItemsRepeater>("Rep");
                car = this.Get <Carousel>("Car");
                var sv = this.Get <ScrollViewer>("RepSv");
                sv.ScrollChanged += Sv_ScrollChanged;
                this.KeyDown     += OnCarKeyDown;
                Vm_TransverseChanged(vm, vm.Transverse);
            }
            catch (Exception ex)
            {
                vm.ExceptionService.Exception = ex;
            }
        }
Ejemplo n.º 2
0
 private void Vm_TransverseChanged(DesktopVisitingViewModel arg1, bool arg2)
 {
     if (arg2)
     {
         rep.ElementPrepared     -= OnRepElementPrepared;
         rep.ElementIndexChanged -= OnRepElementIndexChanged;
         car.SelectionChanged    += OnSelectionChanged;
         car.PointerReleased     += OnCarPointerReleased;
     }
     else
     {
         rep.ElementPrepared     += OnRepElementPrepared;
         rep.ElementIndexChanged += OnRepElementIndexChanged;
         car.SelectionChanged    -= OnSelectionChanged;
         car.PointerReleased     -= OnCarPointerReleased;
     }
 }