public override void Replay(NavigationService navigationService, NavigationMode mode) { ContentControl navigator = (ContentControl)navigationService.INavigatorHost; // Find a reference to the DocumentViewer hosted in the NavigationWindow // On initial history navigation in the browser, the window's layout may not have been // done yet. ApplyTemplate() causes the viewer to be created. navigator.ApplyTemplate(); DocumentApplicationDocumentViewer docViewer = navigator.Template.FindName( "PUIDocumentApplicationDocumentViewer", navigator) as DocumentApplicationDocumentViewer; Debug.Assert(docViewer != null, "PUIDocumentApplicationDocumentViewer not found."); if (docViewer != null) { // Set the new state on the DocumentViewer if (_state is DocumentApplicationState) { docViewer.StoredDocumentApplicationState = (DocumentApplicationState)_state; } // Check that a Document exists. if (navigationService.Content != null) { IDocumentPaginatorSource document = navigationService.Content as IDocumentPaginatorSource; // If the document has already been paginated (could happen in the // case of a fragment navigation), then set the DocumentViewer to the // new state that was set. if ((document != null) && (document.DocumentPaginator.IsPageCountValid)) { docViewer.SetUIToStoredState(); } } } }
private DeactivateEvent GetDeactivateEvent(NavigationMode mode) { if (mode == NavigationMode.Back) return DeactivateEvent.Back; if (mode == NavigationMode.Forward) return DeactivateEvent.Forward; return DeactivateEvent.Default; }
public override void OnNavigatedTo(object navigationParameter, NavigationMode navigationMode, Dictionary<string, object> viewModelState) { if (navigationParameter != null) { Items = navigationParameter as IEnumerable<ProductInformation>; } }
public async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary<string, object> state) { if (state.Any()) { Sub = JsonConvert.DeserializeObject<SubredditItem>((string)state["sub"]); Images = IncrementalSubredditGallery.fromJson((string)state["images"]); state.Clear(); } else { if (mode == NavigationMode.Back) { if (galleryMetaInfo == null) { galleryMetaInfo = BootStrapper.Current.SessionState["GalleryInfo"] as GalleryMetaInfo; Images = galleryMetaInfo?.Gallery as IncrementalSubredditGallery; var sub = (await Reddits.SearchSubreddits(Images.Subreddit)).First(s => s.Data.DisplayName == Images.Subreddit); Sub = new SubredditItem(sub); } ImageSelectedIndex = galleryMetaInfo?.SelectedIndex ?? 0; } else { Activate(parameter); } } await Task.CompletedTask; }
public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary<string, object> state) { string error; try { if (TrophyScrollingCollection == null || !TrophyScrollingCollection.Any()) { if (!string.IsNullOrEmpty(parameter as string)) { Username = parameter as string; } else { Username = Shell.Instance.ViewModel.CurrentUser.Username; } SetTrophyList(); } return; } catch (Exception ex) { error = ex.Message; } await ResultChecker.SendMessageDialogAsync(error, false); }
public async Task NavedFromAsync(object viewmodel, NavigationMode mode, Page sourcePage, Type sourceType, object sourceParameter, Page targetPage, Type targetType, object targetParameter, bool suspending) { Services.NavigationService.NavigationService.DebugWrite(); if (sourcePage == null) { return; } else if (viewmodel == null) { return; } else if (viewmodel is Classic.INavigatedAwareAsync) { var vm = viewmodel as Classic.INavigatedAwareAsync; await vm?.OnNavigatedFromAsync(PageState(sourcePage), suspending); } else if (viewmodel is Portable.INavigatedAware) { var vm = viewmodel as Portable.INavigatedAware; var parameters = new Portable.NavigationParameters(); vm?.OnNavigatedFrom(parameters); } else if (viewmodel is Portable.INavigatedAwareAsync) { var vm = viewmodel as Portable.INavigatedAwareAsync; var parameters = new Portable.NavigationParameters(); await vm?.OnNavigatedFromAsync(parameters); } }
public override async void OnNavigatedTo(object navigationParameter, NavigationMode navigationMode, Dictionary<string, object> viewModelState) { Chat = navigationParameter as VKMessage; await initUsers(); await getTasks(); base.OnNavigatedTo(navigationParameter, navigationMode, viewModelState); }
protected MovementBasedLogicTile(Int32[] levels, Int32[] rows, Int32[] columns, NavigationMode[] navigationModes, Action<MapCharacter, SpriteDirection> onEntering, Action<MapCharacter, SpriteDirection> onLeaving) : base(levels, rows, columns, navigationModes) { OnEntering = onEntering; OnLeaving = onLeaving; }
public override Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary<string, object> state) { if (state.Any()) { Value = state[nameof(Value)]?.ToString(); state.Clear(); } return Task.CompletedTask; }
public NavigatingCancelEventArgs(IViewMappingItem mapping, NavigationMode navigationMode, string parameter) { _mapping = mapping; _navigationMode = navigationMode; _parameter = parameter; _isCancelable = true; }
void NavigateTo(NavigationMode mode, string parameter) { LastNavigationParameter = parameter; LastNavigationType = _frame.Content.GetType().FullName; if (mode == NavigationMode.New) { // TODO: clear existing state } var page = _frame.Content as FrameworkElement; if (page != null) { var dataContext = page.DataContext; if (dataContext != null) { // navigationService will not depend on Mvvm namespace var method = dataContext.GetType() .GetRuntimeMethod(OnNavigatedTo, new[] { typeof(string), typeof(NavigationMode), typeof(Dictionary<string, object>) }); if (method != null) { // TODO: get existing state method.Invoke(dataContext, new object[] { parameter, mode, null }); } } } }
public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary<string, object> state) { _statisticsService.RegisterPage("LoginView"); var sessionId = _appSettings.Get<string>(StorageKey.SessionId); var expiration = _appSettings.Get<DateTime>(StorageKey.SessionExpiration); var username = _appSettings.Get<string>(StorageKey.Username); var password = _appSettings.Get<string>(StorageKey.Password); Username = username; Password = password; RememberMe = true; if (string.IsNullOrWhiteSpace(sessionId) == false) { if (expiration > DateTime.Now) NavigationService.Navigate(typeof(HomeView)); else { if (string.IsNullOrWhiteSpace(username) || string.IsNullOrWhiteSpace(password)) return; RememberMe = true; await Login(); } } }
public override async void OnNavigatedTo(string parameter, NavigationMode mode, Dictionary<string, object> state) { Debug.WriteLine("In DetailPageViewModel OnNavigatedTo"); _repository = Repositories.MessageItemRepository.GetInstance(); await LoadRuntimeDataAsync(parameter); // Since we are viewing this item, set its status to 'Read' this.MessageItem.IsRead = true; await _repository.UpdateAsync(this.MessageItem); #region Remove corresponding item from Action Center // Also remove it from the Action Center if it is there //ToastNotificationManager.History.Remove(parameter); #endregion #region Sync Tile badge count with unread toasts count from Action Center //// Set the Badge count on the tile //var toasts = ToastNotificationManager.History.GetHistory(); //if (toasts != null) //{ // var count = toasts.Count(); // // Sync up the count on the tile // TileServices.SetBadgeCountOnTile(count); //} #endregion }
public override void OnNavigatedTo(object navigationParameter, NavigationMode navigationMode, Dictionary<string, object> viewModelState) { if (navigationParameter != null) { SelectedNews = navigationParameter as News; } }
public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary<string, object> state) { if (state.ContainsKey(nameof(this.FeaturedShows))) { this.FeaturedShows = state[nameof(this.FeaturedShows)] as ObservableCollection<Show>; } if (state.ContainsKey(nameof(this.NewReleaseShows))) { this.NewReleaseShows = state[nameof(this.NewReleaseShows)] as ObservableCollection<Show>; } state.Clear(); if (this._dataAcquired) { await Task.Yield(); return; } this.RetrieveFeaturedShows(); this.RetrieveOtherShows(); this._dataAcquired = true; }
public override void OnNavigatedTo(object navigationParameter, NavigationMode navigationMode, Dictionary<string, object> viewModelState) { // 画面遷移してきたときに呼ばれる base.OnNavigatedTo(navigationParameter, navigationMode, viewModelState); Photo = navigationParameter as Photo.PhotoItem; }
public override async void OnNavigatedTo(object navigationParameter, NavigationMode navigationMode, Dictionary<string, object> viewState) { if (viewState != null) { base.OnNavigatedTo(navigationParameter, navigationMode, viewState); if (navigationMode == NavigationMode.Refresh) { // Restore the errors collection manually var errorsCollection = RetrieveEntityStateValue<IDictionary<string, ReadOnlyCollection<string>>>("errorsCollection", viewState); if (errorsCollection != null) { _paymentMethod.SetAllErrors(errorsCollection); } } } if (navigationMode == NavigationMode.New) { var defaultPaymentMethod = await _checkoutDataRepository.GetDefaultPaymentMethodAsync(); if (defaultPaymentMethod != null) { // Update the information and validate the values PaymentMethod.CardNumber = defaultPaymentMethod.CardNumber; PaymentMethod.CardVerificationCode = defaultPaymentMethod.CardVerificationCode; PaymentMethod.CardholderName = defaultPaymentMethod.CardholderName; PaymentMethod.ExpirationMonth = defaultPaymentMethod.ExpirationMonth; PaymentMethod.ExpirationYear = defaultPaymentMethod.ExpirationYear; PaymentMethod.Phone = defaultPaymentMethod.Phone; ValidateForm(); } } }
public NavigationTargetInfo(string key, string name, string description, NavigationMode mode) { Key = key; Name = name; Description = description; Mode = mode; }
public async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary<string, object> state) { (nav as MergedNavigationService).Clear(); JObject param = (JObject)Portable.Helpers.StateHelper.SessionState["LaunchData"]; if (param["url"] == null) { isUrlLaunch = false; } else { isUrlLaunch = true; string url = (string)param["url"]; var query = Uri.UnescapeDataString(new Uri(url).Query); query = query.StartsWith("?") ? query.Substring(1) : query; string[] frags = query.Split('&'); foreach (var frag in frags) { string[] splits = frag.Split('='); state.Add(splits[0], splits[1]); } (SimpleIoc.Default.GetInstance<IViewModelLocator>().BrowserViewModel as BrowserPageViewModel).State = state; } if ((bool)param["isNewLaunch"]) await base.ShakeHandsAndNavigate(); else await Navigate(); }
public override async void NavigatedTo(NavigationMode mode, object parameter) { base.NavigatedTo(mode, parameter); if (mode == NavigationMode.Back) { return; } var term = parameter as string; if (!string.IsNullOrEmpty(term)) { var vm = (SearchViewModel)DataContext; SearchTextBox.Text = term; SearchTextBox.IsEnabled = false; vm.IsLoading = true; await vm.SearchAsync(term); SearchTextBox.IsEnabled = true; vm.IsLoading = false; } else { SearchTextBox.Focus(FocusState.Keyboard); } }
public override async void OnNavigatedTo(object parameter, NavigationMode mode, Dictionary<string, object> state) { if (mode == NavigationMode.Back) { _navigationService.GoBack(); return; } PlaybackTorrent = (PlaybackTorrent) parameter; if (!string.IsNullOrEmpty(PlaybackTorrent.TorrentUrl)) { State = TorrentStreamManager.State.Metadata; var torrent = await Torrent.LoadAsync(new Uri(PlaybackTorrent.TorrentUrl), ""); _torrentStreamService.CreateManager(torrent); } else if (!string.IsNullOrEmpty(PlaybackTorrent.MagnetLink)) { var magnetLink = new MagnetLink(PlaybackTorrent.MagnetLink); _torrentStreamService.CreateManager(magnetLink); } else { var hash = InfoHash.FromHex(PlaybackTorrent.TorrentHash); _torrentStreamService.CreateManager(hash); } _torrentStreamService.StreamManager.StreamProgress += StreamManagerOnStreamProgress; _torrentStreamService.StreamManager.StreamReady += StreamManagerOnStreamReady; _torrentStreamService.StreamManager.Error += StreamManagerOnError; _torrentStreamService.StreamManager.StartDownload(); State = _torrentStreamService.StreamManager.CurrentState; }
public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary<string, object> state) { var sessionId = _appSettings.Get<string>(StorageKey.SessionId); IsLoggedIn = string.IsNullOrWhiteSpace(sessionId) == false; if (IsLoggedIn) UserDisplayName = _appSettings.Get<string>(StorageKey.UserDisplayName); }
public override async void OnNavigatedTo(object navigationParameter, NavigationMode navigationMode, Dictionary<string, object> viewModelState) { dynamic parameters = navigationParameter; var seasonNumber = (int)parameters.season; var showId = (int)parameters.showId; var episodeNumber = (int)parameters.episode; Episode = await traktService.GetEpisodeAsync(showId, seasonNumber, episodeNumber, extended: TraktExtendEnum.FULL_IMAGES); Show = await traktService.GetShowAsync(showId, extended: TraktExtendEnum.MIN); Number = Episode.Number; Title = Episode.Title; Overview = Episode.Overview; Screen = Episode.Images.Screenshot.Full; AirDate = DateTime.Parse(Episode.First_Aired, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal); Comments = new ObservableCollection<TraktComment>(await traktService.GetEpisodeCommentsAsync(showId, seasonNumber, episodeNumber)); try { Link = await crawlerService.GetLink(Show.Title, Episode.Season, Episode.Number); } catch { } }
public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary<string, object> state) { Reading = SessionState["reading"] as ePub; ContentWebView = (NavigationService.Content as ReadingPage).FindName("ContentWebView") as WebView; ContentWebView.NavigateToString(await LoadHtmlFromManifestItem(Reading.Manifest.First())); await Task.CompletedTask; }
/// <summary> /// Initializes a new instance of the <see cref="AlternativeNavigationEventArgs" /> class. /// </summary> /// <param name="content">The content.</param> /// <param name="navigationMode">The navigation mode.</param> /// <param name="parameter">The parameter.</param> /// <param name="sourcePageType">Type of the source page.</param> public AlternativeNavigationEventArgs(object content, NavigationMode navigationMode, object parameter, Type sourcePageType) { this.Content = content; this.NavigationMode = navigationMode; this.Parameter = parameter; this.SourcePageType = sourcePageType; }
public NavigatingCancelEventArgs(Type pageType, NavigationMode mode, bool isCancelable, bool isNavigationInitiator) { this.SourcePageType = pageType; this.NavigationMode = mode; this.IsCancelable = isCancelable; this.IsNavigationInitiator = isNavigationInitiator; }
public NavigatingCancelEventArgs(Type pageType, NavigationMode mode) { this.SourcePageType = pageType; this.NavigationMode = mode; this.IsCancelable = true; this.IsNavigationInitiator = true; }
// </snippet412> public async override void OnNavigatedTo(object navigationParameter, NavigationMode navigationMode, Dictionary<string, object> viewState) { ReadOnlyCollection<Category> rootCategories = null; var getCategoriesCallFailed = false; try { // <snippet511> rootCategories = await _productCatalogRepository.GetCategoriesAsync(50); // </snippet511> } catch (HttpRequestException) { getCategoriesCallFailed = true; } if (getCategoriesCallFailed) { await _alertMessageService.ShowAsync(_resourceLoader.GetString("ErrorServiceUnreachable"), _resourceLoader.GetString("Error")); return; } var rootCategoryViewModels = new List<CategoryViewModel>(); foreach (var rootCategory in rootCategories) { rootCategoryViewModels.Add(new CategoryViewModel(rootCategory, _navigationService)); } RootCategories = new ReadOnlyCollection<CategoryViewModel>(rootCategoryViewModels); _searchPaneService.ShowOnKeyboardInput(true); }
public override void OnNavigatedTo(object parameter, NavigationMode mode, IDictionary<string, object> state) { base.OnNavigatedTo(parameter, mode, state); Messages = _messageService.GetMessages(); Selected = Messages.First(); }
void NavigateTo(NavigationMode mode, string parameter) { LastNavigationParameter = parameter; LastNavigationType = FrameFacade.Content.GetType().FullName; if (mode == NavigationMode.New) { FrameFacade.ClearFrameState(); } var page = FrameFacade.Content as Page; if (page != null) { // call viewmodel var dataContext = page.DataContext as INavigable; if (dataContext != null) { if (dataContext.Identifier != null && (mode == NavigationMode.Forward || mode == NavigationMode.Back)) { // don't call load if cached && navigating back/forward return; } else { // prepare for state load dataContext.NavigationService = this; var pageState = FrameFacade.PageStateContainer(page.GetType()); dataContext.OnNavigatedTo(parameter, mode, pageState); } } } }
public virtual void OnNavigatedTo(string parameter, NavigationMode mode, IDictionary <string, object> state) /* nothing by default */ }
public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> suspensionState) { Value = (suspensionState.ContainsKey(nameof(Value))) ? suspensionState[nameof(Value)]?.ToString() : parameter?.ToString(); await Task.CompletedTask; }
public override void OnNavigatedTo(object parameter, NavigationMode mode, IDictionary <string, object> state) { _category = (PlainCategory)parameter; }
public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> suspensionState) { userLoggedIn = _contentProviderApiService.getLoggedInUser(); // await OnNavigatedToAsync(parameter, mode, suspensionState); }
public virtual Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> state) { return(Task.CompletedTask); }
protected virtual void OnNavigatedFrom(NavigationMode mode) { }
protected virtual bool OnNavigatingFrom(NavigationMode mode) { return(false); }
protected virtual void OnNavigatedTo(NavigationMode mode, TNavigationParameter parameter) { }
void INavigationViewModel.OnNavigatedFrom(NavigationMode mode) { OnNavigatedFrom(mode); }
bool INavigationViewModel.OnNavigatingFrom(NavigationMode mode) { return(OnNavigatingFrom(mode)); }
public override void OnNavigatedTo(object parameter, NavigationMode mode, IDictionary <string, object> state) { LoadCommand.Execute(null); base.OnNavigatedTo(parameter, mode, state); }
/// <summary> /// On Navigation Handler /// </summary> /// <param name="sender">The sending object</param> /// <param name="e">Navigating Cancel Event Args</param> protected virtual void OnNavigating(object sender, NavigatingCancelEventArgs e) { navigationMode = e.NavigationMode; EventAggregator.PublishMessage(new NavigationEvent(e)); }
/// <summary> /// Forbid to naviguate through some members when tracking changes on an object graph. /// </summary> /// <param name="mode">Specific mode.</param> public NotNaviguableAttribute(NavigationMode mode = NavigationMode.All) { Mode = mode; }
public override Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> state) { Items.ReplaceWith(_playbackService.Items); return(Task.CompletedTask); }
public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> suspensionState) { Debug.WriteLine($"{nameof(OnNavigatedToAsync)}"); await Task.CompletedTask; }
public override void OnNavigatedTo(Dictionary <string, object> parameters, NavigationMode mode) { base.OnNavigatedTo(parameters, mode); Albums = (List <DiscoveryAlbum>)parameters["albums"]; }
/// <summary> /// Default constructor. /// </summary> /// <param name="uri">The Uri after it was mapped</param> /// <param name="uriBeforeMapping">The Uri before it was mapped</param> /// <param name="uriForJournal">The Uri to use for the journal</param> /// <param name="mode">The mode (new, forward, or back) of this operation</param> /// <param name="suppressJournalUpdate">True if the journal shouldn't be updated by this operation, false otherwise</param> public NavigationOperation(Uri uri, Uri uriBeforeMapping, Uri uriForJournal, NavigationMode mode, bool suppressJournalUpdate) { this.Uri = uri; this.UriBeforeMapping = uriBeforeMapping; this.UriForJournal = uriForJournal; this.Mode = mode; this.SuppressJournalAdd = suppressJournalUpdate; }
public void Navigate(NavigationMode mode) { LibVlcMethods.libvlc_media_player_navigate(m_hMediaPlayer, (libvlc_navigate_mode_t)mode); }
public virtual async Task OnNavigatingToAsync(object parameter, NavigationMode mode) { }
/// <summary> /// Creates the frame navigated event class. /// </summary> /// <param name="sourcePageType">The source page type</param> /// <param name="content">The content of the page</param> /// <param name="parameter">The parameter</param> /// <param name="navigationMode">The navigation mode</param> public FrameNavigatedEventArgs(Type sourcePageType, object content, object parameter, NavigationMode navigationMode) { this.SourcePageType = sourcePageType; this.Content = content; this.Parameter = parameter; this.NavigationMode = navigationMode; }
public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> suspensionState) { if (suspensionState.Any()) { } if (mode == NavigationMode.New && Billables.Count == 0) { Billables = await DataHelper.GetBillablesAsync(); // FileHelper.GetBillablesAsync(); //Billables.Add(new Billable //{ // BillableId = Guid.NewGuid(), // ClientName = "Jimbo Jones", // BillableDate = DateTime.Now, // BillableTime = new TimeSpan(1, 45, 0), // Notes = "Loves Beanies and breaking things" //}); //Billables.Add(new Billable //{ // BillableId = Guid.NewGuid(), // ClientName = "Nelson Muntz", // BillableDate = DateTime.Now, // BillableTime = new TimeSpan(2, 30, 0), // Notes = "Little slow .. but loves a good laugh" //}); //Billables.Add(new Billable //{ // BillableId = Guid.NewGuid(), // ClientName = "Kearney Zzyzwicz", // BillableDate = DateTime.Now, // BillableTime = new TimeSpan(2, 30, 0), // Notes = "Way to old to still be in school" //}); //Billables.Add(new Billable //{ // BillableId = Guid.NewGuid(), // ClientName = "Dolph Starbeam", // BillableDate = DateTime.Now, // BillableTime = new TimeSpan(1, 10, 0), // Notes = "Hippie parents" //}); //await FileHelper.SetBillablesAsync(Billables); } if (parameter != null && mode != NavigationMode.Back) { BillingEntry billable = (BillingEntry)parameter; BillingEntry b; try { b = Billables.First(i => i.BillableId == billable.BillableId); if (await DataHelper.UpdateBillableAsync(b)) { b.BillableDate = billable.BillableDate; b.BillableTime = billable.BillableTime; b.ClientName = billable.ClientName; b.Notes = billable.Notes; RaisePropertyChanged(); } } catch { if (await DataHelper.CreateBillableAsync(billable)) { Billables.Add(billable); } } //await FileHelper.SetBillablesAsync(Billables); } SetDisplayTotal(); await Task.CompletedTask; }
private bool NavigateCore(Uri uri, NavigationMode mode, bool suppressJournalAdd, bool isRedirect) { try { if (uri == null) { throw new ArgumentNullException("uri", Resource.NavigationService_NavigationToANullUriIsNotSupported); } // Make sure we're on the UI thread because of the DependencyProperties we use. if (!this.Host.Dispatcher.CheckAccess()) { // Move to UI thread this.Host.Dispatcher.BeginInvoke(() => this.NavigateCore(uri, mode, suppressJournalAdd, isRedirect)); return(true); } Uri mappedUri = uri; // If the Uri is only a fragment, mapping does not take place if (!UriParsingHelper.InternalUriIsFragment(uri)) { UriMapperBase mapper = this.Host.UriMapper; if (mapper != null) { Uri uriFromMapper = mapper.MapUri(uri); if (uriFromMapper != null && !String.IsNullOrEmpty(uriFromMapper.OriginalString)) { mappedUri = uriFromMapper; } else { mappedUri = uri; } } } Uri mergedUriAfterMapping = UriParsingHelper.InternalUriMerge(this._currentSourceAfterMapping, mappedUri) ?? mappedUri; Uri mergedUri = UriParsingHelper.InternalUriMerge(this._currentSource, uri) ?? uri; // If we're navigating to just a fragment (i.e. "#frag1") or to a page which differs only in the fragment // (i.e. "Page.xaml?id=123" to "Page.xaml?id=123#frag1") then complete navigation without involving the content loader bool isFragmentNavigationOnly = (mode != NavigationMode.Refresh) && (UriParsingHelper.InternalUriIsFragment(mappedUri) || UriParsingHelper.InternalUriGetAllButFragment(mergedUri) == UriParsingHelper.InternalUriGetAllButFragment(this._currentSource)); // Check to see if anyone wants to cancel if (mode == NavigationMode.New || mode == NavigationMode.Refresh) { if (this.RaiseNavigating(mergedUri, mode, isFragmentNavigationOnly) == true) { // Someone stopped us this.RaiseNavigationStopped(null, mergedUri); return(true); } } // If the ContentLoader cannot load the new URI, throw an ArgumentException if (!this.ContentLoader.CanLoad(mappedUri, _currentSourceAfterMapping)) { throw new ArgumentException(Resource.NavigationService_CannotLoadUri, "uri"); } if (isFragmentNavigationOnly && this.Host.Content == null) { // It doesn't make sense to fragment navigate when there's no content, so raise NavigationFailed throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, Resource.NavigationService_FragmentNavigationRequiresContent, "Frame")); } if (isRedirect && this._currentNavigation != null && this._currentNavigation.UriForJournal == this._currentSource) { // Do not record navigation in the journal in case of a redirection // where the original target is the current URI. suppressJournalAdd = true; } // Stop in-progress navigation this.StopLoadingCore(isRedirect); return(this.NavigateCore_StartNavigation(uri, mode, suppressJournalAdd, mergedUriAfterMapping, mergedUri, isFragmentNavigationOnly)); } catch (Exception ex) { if (this.RaiseNavigationFailed(uri, ex)) { throw; } return(true); } }
protected override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, NavigationState state) { Background background = parameter as Background; if (parameter is string data) { var split = data.Split('#'); if (split[0] == Constants.WallpaperLocalFileName && split.Length == 2) { background = new Background(Constants.WallpaperLocalId, false, false, split[1], null, new BackgroundTypeWallpaper(false, false)); } else if (split[0] == Constants.WallpaperColorFileName) { background = new Background(Constants.WallpaperLocalId, false, false, Constants.WallpaperColorFileName, null, new BackgroundTypeFill(new BackgroundFillSolid(0xdfe4e8))); } else if (Uri.TryCreate("tg://bg/" + parameter, UriKind.Absolute, out Uri uri)) { var type = TdBackground.FromUri(uri); if (type is BackgroundTypeFill) { background = new Background(0, false, false, string.Empty, null, type); } else { var response = await ProtoService.SendAsync(new SearchBackground(uri.Segments.Last())); if (response is Background) { background = response as Background; background.Type = type; } else if (response is Error error) { } } } } if (background == null) { return; } Item = background; BackgroundFill fill = null; if (background.Type is BackgroundTypeFill typeFill) { fill = typeFill.Fill; Intensity = 100; IsBlurEnabled = false; } else if (background.Type is BackgroundTypePattern typePattern) { fill = typePattern.Fill; Intensity = typePattern.IsInverted ? -typePattern.Intensity : typePattern.Intensity; IsBlurEnabled = false; } else if (background.Type is BackgroundTypeWallpaper typeWallpaper) { fill = null; Intensity = 100; IsBlurEnabled = typeWallpaper.IsBlurred; } if (fill is BackgroundFillSolid fillSolid) { Color1 = fillSolid.Color.ToColor(); Color2 = BackgroundColor.Empty; Rotation = 0; } else if (fill is BackgroundFillGradient fillGradient) { Color1 = fillGradient.TopColor.ToColor(); Color2 = fillGradient.BottomColor.ToColor(); Rotation = fillGradient.RotationAngle; } else if (fill is BackgroundFillFreeformGradient freeformGradient) { Color1 = freeformGradient.Colors[0].ToColor(); Color2 = freeformGradient.Colors[1].ToColor(); Color3 = freeformGradient.Colors[2].ToColor(); if (freeformGradient.Colors.Count > 3) { Color4 = freeformGradient.Colors[3].ToColor(); } } Delegate?.UpdateBackground(_item); if (_item.Type is BackgroundTypePattern or BackgroundTypeFill) { var response = await ProtoService.SendAsync(new GetBackgrounds()); if (response is Backgrounds backgrounds) { var patterns = backgrounds.BackgroundsValue.Where(x => x.Type is BackgroundTypePattern) .Distinct(new EqualityComparerDelegate <Background>((x, y) => { return(x.Document.DocumentValue.Id == y.Document.DocumentValue.Id); }, obj => { return(obj.Document.DocumentValue.Id); })); Patterns.ReplaceWith(new[] { new Background(0, true, false, string.Empty, null, new BackgroundTypeFill(new BackgroundFillSolid())) }.Union(patterns)); SelectedPattern = patterns.FirstOrDefault(x => x.Document?.DocumentValue.Id == background.Document?.DocumentValue.Id); } } //if (parameter is string name) //{ // if (name == Constants.WallpaperLocalFileName) // { // //Item = new Background(Constants.WallpaperLocalId, new PhotoSize[0], 0); // } // else // { // var response = await ProtoService.SendAsync(new SearchBackground(name)); // if (response is Background background) // { // } // } //} }
private async Task HandlePageNavigationAsync(Action navigationAction, object parameter = null, NavigationMode navigationMode = NavigationMode.New) { var oldViewModel = (_frame.Content as Page)?.DataContext as INavigable; navigationAction.Invoke(); if (oldViewModel != null) { await HandleDeactivationAsync(oldViewModel); } var newPage = _frame.Content as Page; if (newPage.DataContext is INavigable newViewModel) { await HandleActivationAsync(newViewModel, parameter, navigationMode); } UpdateShellBackButtonVisibility(); }
public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> state) { await UpdateSessionsAsync(); }
public override Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> state) { _settings.ShowHamburgerButton = true; return(Task.CompletedTask); }
protected override Task OnNavigatedToAsync(object parameter, NavigationMode mode, NavigationState state) { UpdatePrivacyAsync(); return(Task.CompletedTask); }
public override Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> state) { UpdateView(); return(base.OnNavigatedToAsync(parameter, mode, state)); }
/// <summary> /// When navigate to main page, update the api calls counter /// </summary> /// <param name="parameter"></param> /// <param name="mode"></param> /// <param name="state"></param> /// <returns></returns> public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> state) { ApiCallNums = App.ApiCalls; await base.OnNavigatedToAsync(parameter, mode, state); }
public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> state) { ChatFilter filter = null; if (parameter is int id) { var response = await ProtoService.SendAsync(new GetChatFilter(id)); if (response is ChatFilter result) { Id = id; Filter = result; filter = result; } else { // TODO } } else { Id = null; Filter = null; filter = new ChatFilter(); filter.PinnedChatIds = new List <long>(); filter.IncludedChatIds = new List <long>(); filter.ExcludedChatIds = new List <long>(); } if (filter == null) { return; } if (state != null && state.TryGet("included_chat_id", out long includedChatId)) { filter.IncludedChatIds.Add(includedChatId); } _pinnedChatIds = filter.PinnedChatIds; _iconPicked = !string.IsNullOrEmpty(filter.IconName); Title = filter.Title; Icon = Icons.ParseFilter(filter); Include.Clear(); Exclude.Clear(); if (filter.IncludeContacts) { Include.Add(new FilterFlag { Flag = ChatListFilterFlags.IncludeContacts }); } if (filter.IncludeNonContacts) { Include.Add(new FilterFlag { Flag = ChatListFilterFlags.IncludeNonContacts }); } if (filter.IncludeGroups) { Include.Add(new FilterFlag { Flag = ChatListFilterFlags.IncludeGroups }); } if (filter.IncludeChannels) { Include.Add(new FilterFlag { Flag = ChatListFilterFlags.IncludeChannels }); } if (filter.IncludeBots) { Include.Add(new FilterFlag { Flag = ChatListFilterFlags.IncludeBots }); } if (filter.ExcludeMuted) { Exclude.Add(new FilterFlag { Flag = ChatListFilterFlags.ExcludeMuted }); } if (filter.ExcludeRead) { Exclude.Add(new FilterFlag { Flag = ChatListFilterFlags.ExcludeRead }); } if (filter.ExcludeArchived) { Exclude.Add(new FilterFlag { Flag = ChatListFilterFlags.ExcludeArchived }); } foreach (var chatId in filter.PinnedChatIds.Union(filter.IncludedChatIds)) { var chat = CacheService.GetChat(chatId); if (chat == null) { continue; } Include.Add(new FilterChat { Chat = chat }); } foreach (var chatId in filter.ExcludedChatIds) { var chat = CacheService.GetChat(chatId); if (chat == null) { continue; } Exclude.Add(new FilterChat { Chat = chat }); } UpdateIcon(); }