protected override Task OnInitialise() { return(Task.Factory .StartNew(() => { var steps = GetSteps(); var index = 0; foreach (var step in steps) { step.Context = Context; step.Ordinal = index; this.SyncViewModelActivationStates(step).AddDisposable(Disposables); this.SyncViewModelBusy(step).AddDisposable(Disposables); _steps.Add(step); index++; } CurrentStep = _steps.First(); GoBackCommand.RaiseCanExecuteChanged(); GoForwardCommand.RaiseCanExecuteChanged(); }, Scheduler.Task.TPL)); }
/// <summary> /// Invoked on every mouse click, touch screen tap, or equivalent interaction when this /// page is active and occupies the entire window. Used to detect browser-style next and /// previous mouse button clicks to navigate between pages. /// </summary> /// <param name="sender">Instance that triggered the event.</param> /// <param name="e">Event data describing the conditions that led to the event.</param> private void CoreWindow_PointerPressed(CoreWindow sender, PointerEventArgs e) { var properties = e.CurrentPoint.Properties; // Ignore button chords with the left, right, and middle buttons if (properties.IsLeftButtonPressed || properties.IsRightButtonPressed || properties.IsMiddleButtonPressed) { return; } // If back or foward are pressed (but not both) navigate appropriately bool backPressed = properties.IsXButton1Pressed; bool forwardPressed = properties.IsXButton2Pressed; if (backPressed ^ forwardPressed) { e.Handled = true; if (backPressed) { GoBackCommand.Execute(null); } if (forwardPressed) { GoForwardCommand.Execute(null); } } }
private void GoBackInViewModels() { switch (CheckSize()) { case "Small": if (_thirdColumnVisibility) { FirstColumnVisibility = false; SecondColumnVisibility = true; ThirdColumnVisibility = false; } else { FirstColumnVisibility = true; SecondColumnVisibility = false; } break; case "Medium": FirstColumnVisibility = true; SecondColumnVisibility = true; ThirdColumnVisibility = false; break; } GoBackCommand.RaiseCanExecuteChanged(); GoForwardCommand.RaiseCanExecuteChanged(); }
private void PublishIsGameOver(bool isOver) { _isGameOver = isOver; MoveCommand.RaiseCanExecuteChanged(); HintMoveCommand.RaiseCanExecuteChanged(); GoForwardCommand.RaiseCanExecuteChanged(); GoBackCommand.RaiseCanExecuteChanged(); IsGameOverEvent_EA_PUB(isOver); }
private void OnMainFrameAfterNavigation() { CurrentPage = GetCurrentPage(); GoBackCommand.RaiseCanExecuteChanged(); GoForwardCommand.RaiseCanExecuteChanged(); NavigateToHomeCommand.RaiseCanExecuteChanged(); _usageCalculator.UpdateUsage(CurrentPage); }
public void Navigate(Guid pageId) { var page = Module.ChartingPages[pageId]; _mainFrame.Navigate(new Uri(page.Uri, UriKind.RelativeOrAbsolute)); GoBackCommand.RaiseCanExecuteChanged(); GoForwardCommand.RaiseCanExecuteChanged(); NavigateToHomeCommand.RaiseCanExecuteChanged(); }
private void GoBack() { if (!CanGoBack()) { return; } (var region, var journal) = GetMainRegion(); journal.GoBack(); GoBackCommand.RaiseCanExecuteChanged(); GoForwardCommand.RaiseCanExecuteChanged(); }
private void MoveHelper(object param, bool isGoBackOrForth, Direction backOrForth) { try { var num = Convert.ToInt32(param); if (MainBoard.IsAllowSwitch(num)) { MainBoard.Switch(num); } else { return; } HintTileProp = -1; if (!isGoBackOrForth) { _isHint = true; if (_breadCrumbsList.Count > _crumb) { _breadCrumbsList.RemoveRange(_crumb, _breadCrumbsList.Count - _crumb); } _breadCrumbsList.Add(num); } switch (backOrForth) { case Direction.BACK: _crumb--; TileClickEvent_EA_PUB(--_moveCnt); break; case Direction.FORTH: _crumb++; TileClickEvent_EA_PUB(++_moveCnt); break; } } catch (Exception) { } if (IsGameOver()) { PublishIsGameOver(true); } else { HintMoveCommand.RaiseCanExecuteChanged(); GoForwardCommand.RaiseCanExecuteChanged(); GoBackCommand.RaiseCanExecuteChanged(); MoveCommand.RaiseCanExecuteChanged(); } }
public async Task Forward(CancellationToken cancellationToken = default(CancellationToken)) { await asyncFirefoxDriver.CheckConnected(cancellationToken).ConfigureAwait(false); if (asyncFirefoxDriver.ClientMarionette == null) { throw new Exception("error: no clientMarionette"); } var comm1 = new GoForwardCommand(); await asyncFirefoxDriver.ClientMarionette.SendRequestAsync(comm1, cancellationToken).ConfigureAwait(false); if (comm1.Error != null) { throw new WebBrowserException(comm1.Error); } }
public override void OnNavigatedTo(NavigationContext navigationContext) { InitializeRegionContext(); InitializePrintTemplates(); _navigationContext = navigationContext; _regionManager.RequestNavigate(RegionNames.OrderWizardStageRegion, ViewNames.OrderWizardCustomerView); _regionManager.Regions[RegionNames.OrderWizardStageRegion].NavigationService.Navigated += (s, a) => { Current = a.Uri.ToString(); GoForwardCommand.RaiseCanExecuteChanged(); GoBackwardCommand.RaiseCanExecuteChanged(); }; }
public void GoForward() { var lastExamplePage = CurrentExample as ExampleAppPage; var lastExampleView = _currentExample; _history.Redo(); var example = _history.Current as Example; if (example != null) { Navigate(example); ServiceLocator.Container.Resolve <IModule>().CurrentExample = example; } else { Navigate((Guid)_history.Current); } ServiceLocator.Container.Resolve <ExampleViewModel>().ExportExampleViewModel.IsExportVisible = false; ServiceLocator.Container.Resolve <ExampleViewModel>().BreadCrumbViewModel.IsShowingBreadcrumbNavigation = false; GoBackCommand.RaiseCanExecuteChanged(); GoForwardCommand.RaiseCanExecuteChanged(); NavigateToHomeCommand.RaiseCanExecuteChanged(); if (lastExamplePage != null) { // Required to release memory from last example lastExamplePage.ViewModel = null; } if (lastExampleView != null) { lastExampleView.View = null; } GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); }
/// <summary> /// Handle XButton events. /// </summary> private void OnCoreWindowPointerReleased(CoreWindow sender, PointerEventArgs args) { if (args.CurrentPoint.Properties.PointerUpdateKind == Windows.UI.Input.PointerUpdateKind.XButton1Released) { var popups = VisualTreeHelper.GetOpenPopups(Window.Current); if (popups.Count != 0) { return; } args.Handled = true; GoBackCommand.Execute(null); } else if (args.CurrentPoint.Properties.PointerUpdateKind == Windows.UI.Input.PointerUpdateKind.XButton2Released) { var popups = VisualTreeHelper.GetOpenPopups(Window.Current); if (popups.Count != 0) { return; } args.Handled = true; GoForwardCommand.Execute(null); } }
/// <summary> /// Invoked on every keystroke, including system keys such as Alt key combinations, when /// this page is active and occupies the entire window. Used to detect keyboard navigation /// between pages even when the page itself doesn't have focus. /// </summary> /// <param name="sender">Instance that triggered the event.</param> /// <param name="e">Event data describing the conditions that led to the event.</param> private void CoreDispatcher_AcceleratorKeyActivated(CoreDispatcher sender, AcceleratorKeyEventArgs e) { var virtualKey = e.VirtualKey; // Only investigate further when Left, Right, or the dedicated Previous or Next keys // are pressed if ((e.EventType == CoreAcceleratorKeyEventType.SystemKeyDown || e.EventType == CoreAcceleratorKeyEventType.KeyDown) && (virtualKey == VirtualKey.Left || virtualKey == VirtualKey.Right || (int)virtualKey == 166 || (int)virtualKey == 167)) { var coreWindow = Window.Current.CoreWindow; var downState = CoreVirtualKeyStates.Down; bool menuKey = (coreWindow.GetKeyState(VirtualKey.Menu) & downState) == downState; bool controlKey = (coreWindow.GetKeyState(VirtualKey.Control) & downState) == downState; bool shiftKey = (coreWindow.GetKeyState(VirtualKey.Shift) & downState) == downState; bool noModifiers = !menuKey && !controlKey && !shiftKey; bool onlyAlt = menuKey && !controlKey && !shiftKey; if (((int)virtualKey == 166 && noModifiers) || (virtualKey == VirtualKey.Left && onlyAlt)) { // When the previous key or Alt+Left are pressed navigate back e.Handled = true; GoBackCommand.Execute(null); } else if (((int)virtualKey == 167 && noModifiers) || (virtualKey == VirtualKey.Right && onlyAlt)) { // When the next key or Alt+Right are pressed navigate forward e.Handled = true; GoForwardCommand.Execute(null); } } }
public void OnNavigatedTo(NavigationContext navigationContext) { _journal = navigationContext.NavigationService.Journal; GoForwardCommand.RaiseCanExecuteChanged(); }
//private DxxUrl CreateDxxUrl() { // var driver = Driver.Value; // var uri = new Uri(Url.Value); // return new DxxUrl(uri, driver, driver.GetNameFromUri(uri, "link"), IsMain ? "from main" : "from sub"); //} private void InitializeCommands() { GoBackCommand.Subscribe(() => { GoBack(); }); GoForwardCommand.Subscribe(() => { GoForward(); }); ReloadCommand.Subscribe(() => { Reload(); }); StopCommand.Subscribe(() => { Stop(); }); BookmarkCommand.Subscribe((v) => { if (string.IsNullOrEmpty(v) || !v.StartsWith("http")) { IsBookmarked.Value = false; return; } if (IsBookmarked.Value) { Bookmarks.Value.AddBookmark("", v); } else { Bookmarks.Value.RemoveBookmark(v); Url.Value = v; } }); NavigateCommand.Subscribe((v) => { Navigate(v); }); ClearURLCommand.Subscribe((v) => { Url.Value = ""; }); AnalyzeCommand.Subscribe((v) => { if (v == null) { v = Url.Value; } var aw = new DxxAnalysisWindow(v); //aw.Owner = Owner; aw.Show(); }); CopyCommand.Subscribe((v) => { Clipboard.SetData(DataFormats.Text, v); }); DownloadCommand.Subscribe(() => { if (IsTarget.Value || IsContainer.Value) { DxxDriverManager.Instance.Download(Url.Value, null, ""); } }); ListingCommand.Subscribe(async() => { if (IsContainerList.Value) { var uri = new Uri(Url.Value); var dxxUrl = new DxxUrl(uri, Driver.Value, Driver.Value.GetNameFromUri(uri), ""); var targets = await Driver.Value.LinkExtractor.ExtractTargets(dxxUrl); if (targets != null && targets.Count > 0) { TargetList.Value = new ObservableCollection <DxxTargetInfo>(targets); } else { TargetList.Value?.Clear(); } } }); SetupDriverCommand.Subscribe(() => { DxxDriverManager.Instance.Setup(Driver.Value, Owner); }); FrameSelectCommand.Subscribe((v) => { if (IsMain) { RequestLoadInSubview.OnNext(v); } else { Navigate(v); } }); }
private void UpdateHistoryTransitionStatus() { GoBackwardCommand.RaiseCanExecuteChanged(); GoForwardCommand.RaiseCanExecuteChanged(); GoUpCommand.RaiseCanExecuteChanged(); }
public void RequestNavigation(string targetView, NavigationParameters parameters) { _regionManager.RequestNavigate(MainRegionName, targetView, parameters); GoBackCommand.RaiseCanExecuteChanged(); GoForwardCommand.RaiseCanExecuteChanged(); }