public override async void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { base.OnNavigatedTo(e, viewModelState); await this.Model.SetSelectedShopByIdAsync(e.Parameter as string); this.Disposable = new CompositeDisposable(); this.Name = this.Model .ObserveProperty(x => x.SelectedShop) .Select(x => x?.name) .ToReadOnlyReactiveProperty() .AddTo(this.Disposable); this.Kana = this.Model .ObserveProperty(x => x.SelectedShop) .Select(x => x?.name_kana) .ToReadOnlyReactiveProperty() .AddTo(this.Disposable); this.Image = this.Model .ObserveProperty(x => x.SelectedShop) .Select(x => x?.photo?.pc?.l) .ToReadOnlyReactiveProperty() .AddTo(this.Disposable); }
public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState) { base.OnNavigatedTo(e, viewModelState); this.DeviceGestureService.GoBackRequested += this.DeviceGestureService_GoBackRequested; this.DeviceGestureService.CameraButtonPressed += this.DeviceGestureService_CameraButtonPressed; this.DeviceGestureService.MouseMoved += this.DeviceGestureService_MouseMoved; }
public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { base.OnNavigatedTo(e, viewModelState); var pageParameters = PinStartPageParameters.Deserialize(e.Parameter) as PinStartPageParameters; if (pageParameters != null) { this.nextPage = pageParameters.PageTarget.ToString(); } else if (e.Parameter is string) { this.nextPage = e.Parameter as string; } else { this.nextPage = PageToken.DirectoryList.ToString(); } }
private void NavigationService_NavigatedTo(object sender, NavigatedToEventArgs e) { if (e.Page == Constants.PageType.Location) { Title = ((Location)e.Parameter).Name; } }
public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { Tracks = Tracks ?? new SimpleStateSupportCollection <JumpListGroup <VKSaverTrack> >(LoadTracks); Artists = Artists ?? new SimpleStateSupportCollection <JumpListGroup <VKSaverArtist> >(LoadArtists); Albums = Albums ?? new SimpleStateSupportCollection <JumpListGroup <VKSaverAlbum> >(LoadAlbums); Genres = Genres ?? new SimpleStateSupportCollection <JumpListGroup <VKSaverGenre> >(LoadGenres); Folders = Folders ?? new SimpleStateSupportCollection <VKSaverFolder>(LoadFolders); Cached = Cached ?? new SimpleStateSupportCollection <JumpListGroup <VKSaverTrack> >(LoadCachedTracks); if (_libraryDatabaseService.NeedReloadLibraryView) { Tracks.Clear(); Artists.Clear(); Albums.Clear(); Genres.Clear(); Folders.Clear(); Cached.Clear(); _libraryDatabaseService.NeedReloadLibraryView = false; } if (viewModelState.Count > 0) { CurrentPivotIndex = (int)viewModelState[nameof(CurrentPivotIndex)]; } else { string viewName = (string)e.Parameter; SetPivotIndex(viewName); } base.OnNavigatedTo(e, viewModelState); }
public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { if (Artists == null && viewModelState.Count > 0) { var items = JsonConvert.DeserializeObject <List <LastArtist> >( viewModelState[nameof(Artists)].ToString(), _lastImageSetConverter); if (items.Count == 0) { Artists = new PaginatedCollection <LastArtist>(LoadMoreArtists); } else { Artists = new PaginatedCollection <LastArtist>(items, LoadMoreArtists) { Page = 1 } }; } else if (Artists == null) { Artists = new PaginatedCollection <LastArtist>(LoadMoreArtists); } base.OnNavigatedTo(e, viewModelState); }
public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { base.OnNavigatedTo(e, viewModelState); foreach (var path in Directory.PathStack) { PathStack.Add(path); } var parameters = FileInfoPageParameters.Deserialize(e.Parameter); var resourceInfo = parameters?.ResourceInfo; if (resourceInfo == null) { return; } PathStack.Add(new PathInfo { ResourceInfo = resourceInfo }); ResourceInfo = resourceInfo; FileExtension = Path.GetExtension(ResourceInfo.Name); FileName = Path.GetFileNameWithoutExtension(ResourceInfo.Name); var converter = new BytesToHumanReadableConverter(); FileSizeString = LocalizationService.Instance.GetString( "FileSizeString", converter.Convert(ResourceInfo.Size, typeof(string), null, CultureInfo.CurrentCulture.ToString()), ResourceInfo.Size ); DownloadPreviewImages(); }
public void OnNavigatedTo(NavigatedToEventArgs e) { if (e.State != null && e.State.ContainsKey("aTextBox")) { aTextBox.Text = (string)e.State["aTextBox"]; } }
public async override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState) { base.OnNavigatedTo(e, viewModelState); int parentCategoryId = int.Parse(e.Parameter.ToString()); ICollection<Category> subCategories = null; string errorMessage = string.Empty; try { subCategories = await _productCatalogRepository.GetSubcategoriesAsync(parentCategoryId, 5); } catch (Exception ex) { errorMessage = string.Format(CultureInfo.CurrentCulture, _resourceLoader.GetString("GeneralServiceErrorMessage"), Environment.NewLine, ex.Message); } if (!string.IsNullOrWhiteSpace(errorMessage)) { await _alertMessageService.ShowAsync(errorMessage, _resourceLoader.GetString("ErrorServiceUnreachable")); return; } if (string.IsNullOrEmpty(Title)) { Title = _productCatalogRepository.GetCategoryName(parentCategoryId); } var subCategoryViewModels = new List<CategoryViewModel>(); foreach (var subCategory in subCategories) { subCategoryViewModels.Add(new CategoryViewModel(subCategory, _navigationService)); } Subcategories = new ReadOnlyCollection<CategoryViewModel>(subCategoryViewModels); }
public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { base.OnNavigatedTo(e, viewModelState); var parameter = ParameterBase.ToObject <DetailByIdParameter>((string)e?.Parameter); Initialie(parameter); }
public override async void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { base.OnNavigatedTo(e, viewModelState); await this.model.AuthAsync(async (authorizeUri, callbackUri) => { var response = await WebAuthenticationBroker.AuthenticateAsync( WebAuthenticationOptions.None, authorizeUri, callbackUri); if (response.ResponseStatus != WebAuthenticationStatus.Success) { return(null); } try { // 手抜き実装 return(response.ResponseData.Split('&')[1].Split('=')[1]); } catch { return(null); } }); this.model.User.Connect(); }
public override async void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { base.OnNavigatedTo(e, viewModelState); CurrentGameName = e.Parameter.ToString(); // Game name. if (e.NavigationMode == Windows.UI.Xaml.Navigation.NavigationMode.Back || (_sessionStateService.SessionState.ContainsKey("latestLoadedGame") && _sessionStateService.SessionState["latestLoadedGame"].Equals(CurrentGameName))) { return; } // Loading mechanism could be better. IsBusy = true; StreamInformations = await _twitchRepository.GetGameDetails(_currentGameName); _twitchRepository.SetLatestLoadedGames(StreamInformations); IsBusy = false; // Store latest loaded game for caching. if (_sessionStateService.SessionState.ContainsKey("latestLoadedGame")) { _sessionStateService.SessionState["latestLoadedGame"] = CurrentGameName; } else { _sessionStateService.SessionState.Add("latestLoadedGame", CurrentGameName); } this.PropertyChanged += PropChanged; }
public async override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState) { string errorMessage = string.Empty; ICollection<Category> rootCategories = null; try { LoadingData = true; rootCategories = await _productCatalogRepository.GetRootCategoriesAsync(5); } catch (Exception ex) { errorMessage = string.Format(CultureInfo.CurrentCulture, _resourceLoader.GetString("GeneralServiceErrorMessage"), Environment.NewLine, ex.Message); } finally { LoadingData = false; } if (!string.IsNullOrWhiteSpace(errorMessage)) { await _alertMessageService.ShowAsync(errorMessage, _resourceLoader.GetString("ErrorServiceUnreachable")); return; } var rootCategoryViewModels = new List<CategoryViewModel>(); foreach (var rootCategory in rootCategories) { rootCategoryViewModels.Add(new CategoryViewModel(rootCategory, _navigationService)); } RootCategories = new ReadOnlyCollection<CategoryViewModel>(rootCategoryViewModels); }
public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { if (e.Parameter is string && e.NavigationMode == NavigationMode.New) { SearchOption = PagePayloadBase.FromParameterString <TagSearchPagePayloadContent>(e.Parameter as string); } SelectedSearchTarget.Value = SearchOption?.SearchTarget ?? SearchTarget.Tag; SelectedSearchSort.Value = VideoSearchOptionListItems.First(x => x.Sort == SearchOption.Sort && x.Order == SearchOption.Order); Database.SearchHistoryDb.Searched(SearchOption.Keyword, SearchOption.SearchTarget); TagSearchBookmark = Database.BookmarkDb.Get(Database.BookmarkType.SearchWithTag, SearchOption.Keyword) ?? new Database.Bookmark() { BookmarkType = Database.BookmarkType.SearchWithTag, Label = SearchOption.Keyword, Content = SearchOption.Keyword }; FollowButtonService.SetFollowTarget(this); RaisePropertyChanged(nameof(TagSearchBookmark)); base.OnNavigatedTo(e, viewModelState); }
public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState) { orderInfoViewModel = new OrderInfoViewModel(); this.OrderVMs = orderRepository.GetOrderVMs(2000); this.OrderDetailVMs = this.OrderVMs.Take(100).ToList<OrderViewModel>(); base.OnNavigatedTo(e, viewModelState); }
public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { if (e.Parameter is string && e.NavigationMode == NavigationMode.New) { SearchOption = PagePayloadBase.FromParameterString <LiveSearchPagePayloadContent>(e.Parameter as string); } SelectedSearchTarget.Value = SearchOption?.SearchTarget ?? SearchTarget.Niconama; if (SearchOption == null) { var oldOption = viewModelState[nameof(SearchOption)] as string; SearchOption = PagePayloadBase.FromParameterString <LiveSearchPagePayloadContent>(oldOption); if (SearchOption == null) { throw new Exception(); } } _NowNavigatingTo = true; SelectedSearchSort.Value = LiveSearchSortOptionListItems.FirstOrDefault(x => x.Sort == SearchOption.Sort && x.Order == SearchOption.Order); SelectedSearchMode.Value = LiveSearchModeOptionListItems.FirstOrDefault(x => x.Mode == SearchOption.Mode) ?? LiveSearchModeOptionListItems.First(); SelectedProvider.Value = LiveSearchProviderOptionListItems.FirstOrDefault(x => x.Provider == SearchOption.Provider); _NowNavigatingTo = false; Database.SearchHistoryDb.Searched(SearchOption.Keyword, SearchOption.SearchTarget); base.OnNavigatedTo(e, viewModelState); }
public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState) { ReLoadPlanetVMs(); if ((PlanetViewModel)e.Parameter != null) { SelectedPlanetVM = e.Parameter as PlanetViewModel; } base.OnNavigatedTo(e, viewModelState); }
public override void OnNavigatedTo(NavigatedToEventArgs e) { base.OnNavigatedTo(e); this.JoinedGroupList = this.CurrentUser.JoinedGroupList; this.ManagedGroupList = this.CurrentUser.ManagedGroupList; }
public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { base.OnNavigatedTo(e, viewModelState); BandsManagerViewModel.OnNavigatedTo(e, viewModelState); TilesManagerViewModel.OnNavigatedTo(e, viewModelState); }
public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { Login = "******"; Password = ""; DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait; base.OnNavigatedTo(e, viewModelState); }
public async override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState) { var categoryId = Convert.ToInt32(e.Parameter); string errorMessage = string.Empty; try { var category = await _productCatalogRepository.GetCategoryAsync(categoryId); Title = category.Title; var products = await _productCatalogRepository.GetProductsAsync(categoryId); Items = new ReadOnlyCollection<ProductViewModel>(products .Select(product => new ProductViewModel(product)) .ToList()); } catch (Exception ex) { errorMessage = string.Format(CultureInfo.CurrentCulture, _resourceLoader.GetString("GeneralServiceErrorMessage"), Environment.NewLine, ex.Message); } if (!string.IsNullOrWhiteSpace(errorMessage)) { await _alertMessageService.ShowAsync(errorMessage, _resourceLoader.GetString("ErrorServiceUnreachable")); } }
public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { base.OnNavigatedTo(e, viewModelState); base.OnNavigatedTo(e, viewModelState); ResourceInfo = null; ResourceInfos = null; var parameters = MoveFileOrFolderPageParameters.Deserialize(e.Parameter); var resourceInfo = parameters?.ResourceInfo; var resourceInfos = parameters?.ResourceInfos; if (resourceInfo != null) { ResourceInfo = resourceInfo; } else if (resourceInfos != null) { ResourceInfos = resourceInfos; } else { return; } Directory = DirectoryService.Instance; StartDirectoryListing(); _isNavigatingBack = false; SelectedFileOrFolder = null; }
protected override Task NavigatedToAsync(CancellationToken cancelToken, NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { HohoemaSettingsKind?selectRequestKind = null; if (e.Parameter is HohoemaSettingsKind) { selectRequestKind = (HohoemaSettingsKind)e.Parameter; } else if (e.Parameter is string) { HohoemaSettingsKind kind; if (Enum.TryParse(e.Parameter as string, out kind)) { selectRequestKind = kind; } } if (selectRequestKind.HasValue) { SelectContent(selectRequestKind.Value); } return(Task.CompletedTask); }
public void OnNavigatedTo(NavigatedToEventArgs e) { if (e.State != null && e.State.ContainsKey("IsChecked")) { IsChecked = (bool)e.State["IsChecked"]; } }
public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { if (viewModelState.Count > 0) { Lyrics = viewModelState[nameof(Lyrics)].ToString(); Track = JsonConvert.DeserializeObject <PlayerTrack>( viewModelState[nameof(Track)].ToString()); _artistImage = viewModelState[nameof(_artistImage)] as string; if (_artistImage != null) { ArtistImage = new BitmapImage(new Uri(_artistImage)); } } else if (e.Parameter != null) { var data = JsonConvert.DeserializeObject <KeyValuePair <string, string> >(e.Parameter.ToString()); Track = JsonConvert.DeserializeObject <PlayerTrack>(data.Key); if (data.Value != null) { ArtistImage = new BitmapImage(new Uri(data.Value)); _artistImage = data.Value; } } if (String.IsNullOrEmpty(Lyrics)) { LoadLyrics(); } base.OnNavigatedTo(e, viewModelState); }
public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { if (e.Parameter is string) { SearchOption = PagePayloadBase.FromParameterString <TagSearchPagePayloadContent>(e.Parameter as string); } _NowProcessFavorite = true; IsFavoriteTag.Value = false; CanChangeFavoriteTagState.Value = false; _NowProcessFavorite = false; if (SearchOption == null) { throw new Exception(); } Models.Db.SearchHistoryDb.Searched(SearchOption.Keyword, SearchOption.SearchTarget); var target = "タグ"; var optionText = Util.SortHelper.ToCulturizedText(SearchOption.Sort, SearchOption.Order); UpdateTitle($"{SearchOption.Keyword} - {target}/{optionText}"); base.OnNavigatedTo(e, viewModelState); }
public override async void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { base.OnNavigatedTo(e, viewModelState); VersionDescription = GetVersionDescription(); User = await _userDataService.GetUserFromCacheAsync(); }
public override async void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { base.OnNavigatedTo(e, viewModelState); if (_locationService != null) { _locationService.PositionChanged += LocationServicePositionChanged; var initializationSuccessful = await _locationService.InitializeAsync(); if (initializationSuccessful) { await _locationService.StartListeningAsync(); } if (initializationSuccessful && _locationService.CurrentPosition != null) { Center = _locationService.CurrentPosition.Coordinate.Point; } else { Center = new Geopoint(_defaultPosition); } } var mapIcon = new MapIcon() { Location = Center, NormalizedAnchorPoint = new Point(0.5, 1.0), Title = "Map_YourLocation".GetLocalized(), Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/map.png")), ZIndex = 0 }; MapIcons.Add(mapIcon); }
public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { base.OnNavigatedTo(e, viewModelState); Directory = DirectoryService.Instance; StartDirectoryListing(); _isNavigatingBack = false; }
public async override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { string errorMessage = string.Empty; try { var productNumber = e.Parameter as string; var selectedProduct = await _productCatalogRepository.GetProductAsync(productNumber); var productViewModels = (await _productCatalogRepository.GetProductsAsync(selectedProduct.SubcategoryId)) .Select(product => new ProductViewModel(product, _shoppingCartRepository, _alertService, _resourceLoader)); var items = new ReadOnlyCollection <ProductViewModel>(productViewModels.ToList()); Items = items; SelectedProduct = Items.First(p => p.ProductNumber == productNumber); SelectedIndex = items.IndexOf(SelectedProduct); Title = SelectedProduct.Title; } catch (Exception ex) { errorMessage = string.Format(CultureInfo.CurrentCulture, _resourceLoader.GetString("GeneralServiceErrorMessage"), Environment.NewLine, ex.Message); } if (!string.IsNullOrWhiteSpace(errorMessage)) { await _alertService.ShowAsync(errorMessage, _resourceLoader.GetString("ErrorServiceUnreachable")); } if (e.NavigationMode != NavigationMode.New) { base.OnNavigatedTo(e, viewModelState); } }
public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { base.OnNavigatedTo(e, viewModelState); var client = ServiceLocator.Current.GetInstance <IApiClient>(); client.ApiRecipesGetWithHttpMessagesAsync().ContinueWith(task => Loaded(task.Result.Body)).GetAwaiter().GetResult(); }
public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> dictionary) { base.OnNavigatedTo(e, dictionary); if (!ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar")) { return; } var statusBar = StatusBar.GetForCurrentView(); if (statusBar == null) { return; } var applicationView = ApplicationView.GetForCurrentView(); applicationView.SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow); _statusBarBackgroundColor = statusBar.BackgroundColor; _statusBarForegroundColor = statusBar.ForegroundColor; statusBar.BackgroundOpacity = 0; statusBar.BackgroundColor = Color.FromArgb(255, 0, 130, 201); statusBar.ForegroundColor = Colors.White; InputPane.GetForCurrentView().Showing += OnShowing; InputPane.GetForCurrentView().Hiding += OnHiding; }
public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState) { base.OnNavigatedTo(e, viewModelState); BandsManagerViewModel.OnNavigatedTo(e, viewModelState); TilesManagerViewModel.OnNavigatedTo(e, viewModelState); }
public async override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { var categoryId = Convert.ToInt32(e.Parameter); string errorMessage = string.Empty; try { var category = await _productCatalogRepository.GetCategoryAsync(categoryId); Title = category.Title; var products = await _productCatalogRepository.GetProductsAsync(categoryId); Items = new ReadOnlyCollection <ProductViewModel>(products .Select(product => new ProductViewModel(product)) .ToList()); } catch (Exception ex) { errorMessage = string.Format(CultureInfo.CurrentCulture, _resourceLoader.GetString("GeneralServiceErrorMessage"), Environment.NewLine, ex.Message); } if (!string.IsNullOrWhiteSpace(errorMessage)) { await _alertMessageService.ShowAsync(errorMessage, _resourceLoader.GetString("ErrorServiceUnreachable")); } }
public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { if (e.Parameter == null) { Time = new TimeDto(); } }
public async override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { base.OnNavigatedTo(e, viewModelState); if (e.Parameter is string result) { Item = await Json.ToObjectAsync <Result>(result); } }
protected override async Task LoadDataAsync(NavigatedToEventArgs navigatedToEventArgs) { this.BindingModel.PlaylistType = (PlaylistType)navigatedToEventArgs.Parameter; this.BindingModel.Title = this.resources.GetPluralTitle(this.BindingModel.PlaylistType); await this.LoadPlaylistsAsync(); await this.Dispatcher.RunAsync(() => this.BindingModel.ClearSelectedItems()); }
public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState) { int id = (int)e.Parameter; if (id == 0) { SelectedPlanetVM = new PlanetViewModel(); SelectedPlanetVM.Id = id; } base.OnNavigatedTo(e, viewModelState); }
public async override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState) { if (e.NavigationMode != Windows.UI.Xaml.Navigation.NavigationMode.Back) { Loading = true; List<PersonVM> personVMs = await personRepository.GetPersonsAsync(); PersonVMs = new ObservableCollection<PersonVM>(personVMs.OrderBy(p => p.LastName)); SelectedPersonVM = null; Loading = false; } base.OnNavigatedTo(e, viewModelState); }
public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState) { base.OnNavigatedTo(e, viewModelState); CurrentSetup = _database.GetSetup(); _eventAggregator.GetEvent<SitemapEvents.TappedEvent>().Unsubscribe(SitemapTapped); _eventAggregator.GetEvent<SitemapEvents.TappedEvent>().Subscribe(SitemapTapped); LoadSitemaps(); }
public async override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState) { base.OnNavigatedTo(e, viewModelState); HighlightsParameters hp = e.Parameter as HighlightsParameters; AwayNickName = hp.AwayNickName; HomeNickName = hp.HomeNickName; CurrentSeason = hp.CurrentSeason; CurrentWeek = hp.CurrentWeek; await LoadSearchItems(string.Format("{0} vs {1} Week {2} Highlights NFL 2015", AwayNickName, HomeNickName, int.Parse(CurrentWeek).ToString())); SearchItem = string.Format("Week {0} Highlights", int.Parse(CurrentWeek).ToString()); }
public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState) { MainText = e.Parameter.ToString(); _eventAggr.GetEvent<Messages.LogoutMsg>().Subscribe(async (string msg) => { var msgDialog = new Windows.UI.Popups.MessageDialog(msg); await msgDialog.ShowAsync(); }); }
public override void OnNavigatedTo( NavigatedToEventArgs args, Dictionary<string, object> viewModelState) { base.OnNavigatedTo(args, viewModelState); if (_sessionStateService.SessionState.ContainsKey(nameof(ServiceInformation))) { Service = _sessionStateService.SessionState[nameof(ServiceInformation)] as ServiceInformation; } }
public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState) { base.OnNavigatedTo(e, viewModelState); if (e.NavigationMode == Windows.UI.Xaml.Navigation.NavigationMode.Back) { if (ApplicationData.Current.LocalSettings.Values.ContainsKey("Age")) { this.Age = (int)ApplicationData.Current.LocalSettings.Values["Age"]; ApplicationData.Current.LocalSettings.Values.Remove("Age"); } } }
public async override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState) { SelectedFeed = (Feed)e.Parameter; IsBusy = true; await Task.Delay(1); FeedData feedData = await feedService.GetFeedAsync(SelectedFeed.Link); Title = feedData.Title; Description = feedData.Description; PubDate = feedData.PubDate; FeedItems = new ObservableCollection<FeedItem>(feedData.Items); IsBusy = false; base.OnNavigatedTo(e, viewModelState); }
public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState) { IsBusy = true; FeedType = "Comic"; List<Feed> feeds = null; Task.Run(async () => { feeds = await comicsService.GetFeedsAsync(link); }).Wait(); feeds.Add(new Feed { FeedName = "0 Political Cartoons", Link = "http://editorialcartoonists.com/rss/daily.xml", LastUpdated = "" }); Feeds = new ObservableCollection<Feed>(feeds); FeedGroups = ((ComicsService)comicsService).GetFeedGroups(Feeds.ToList()); IsBusy = false; base.OnNavigatedTo(e, viewModelState); }
public override async void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState) { string errorMessage = string.Empty; try { LoadingData = true; var db = Database.DbConnection; var accountsList = new ObservableCollection<AccountViewModel>(); { var result = await db.QueryAsync<AccountViewModel>("select Id, Name from Accounts"); AccountsList = new ObservableCollection<AccountViewModel>(); foreach (var accountViewModel in result) { AccountsList.Add(accountViewModel); } } FolderTree = new FolderTreeViewModel(); await FolderTree.Refresh(); FolderItems = FolderTree.Children; if (FolderItems.Count == 0) { _navigationService.Navigate("EmailProvider",new AccountPageParameters() {FolderTree = _folderTree}); return; } var currentAccount = await SettingsMethods.GetSetting("default account") ?? await SettingsMethods.GetSetting("last used account") ?? "0"; SelectedAccountIndex = Convert.ToInt32(currentAccount); var account = await db.FindAsync<Accounts>(AccountsList[SelectedAccountIndex].Id); foreach (var folder in FolderItems) { if (folder.Expand(account.InFolderId, true)) break; } } catch (Exception ex) { errorMessage = string.Format(CultureInfo.CurrentCulture, "GeneralServiceErrorMessage", Environment.NewLine, ex.Message); } finally { LoadingData = false; } }
// Loads items from data repository. // Subscribes to collection changes. // Starts refresh data timer. public override async void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState) { IsBusy = true; var feed = await dataRepository.GetFeedAsync(); IsBusy = false; lastOperationId = feed.LastOperationId; Items.Init(feed.Items, OnStatusChanged); Items.CollectionChanged += OnCollectionChanged; timer.Tick += Refresh; timer.Start(); }
public async override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState) { FileService fileService = new FileService(); ObservableCollection<Team> teams = await fileService.GetTeamsAsync(); BoxScoreParameters parms = (BoxScoreParameters)e.Parameter; CurrentSeason = parms.SelectedSeason; CurrentWeek = parms.SelectedWeek; string gameId = parms.GamePageVM.GameId; Game game = await NFLService.GetGameFromUrlAsync(string.Format("http://www.nfl.com/liveupdate/game-center/{0}/{0}_gtd.json", gameId)); string imagePath = string.Empty; string nickName = string.Empty; if (game == null || game.Away == null || game.Home == null) { var messageDialog = new MessageDialog("Please try again later.", "Sorry, stats not available yet."); await messageDialog.ShowAsync(); } else { FindTeamValues(game.Away.Abbr, teams, ref imagePath, ref nickName); AwayImagePath = imagePath; // needed because Image not deep binding to AwayImagePath AwayNickName = nickName; AwayQ1 = game.Away.Score.Q1.ToString(); AwayQ2 = game.Away.Score.Q2.ToString(); AwayQ3 = game.Away.Score.Q3.ToString(); AwayQ4 = game.Away.Score.Q4.ToString(); AwayQ5 = game.Away.Score.Q5 == 0 ? string.Empty : game.Away.Score.Q5.ToString(); AwayTotal = game.Away.Score.Total.ToString(); FindTeamValues(game.Home.Abbr, teams, ref imagePath, ref nickName); HomeImagePath = imagePath; // needed because Image not deep binding to BoxScoreVM.HomeImagePath HomeNickName = nickName; HomeQ1 = game.Home.Score.Q1.ToString(); HomeQ2 = game.Home.Score.Q2.ToString(); HomeQ3 = game.Home.Score.Q3.ToString(); HomeQ4 = game.Home.Score.Q4.ToString(); HomeQ5 = game.Home.Score.Q5 == 0 ? string.Empty : game.Home.Score.Q5.ToString(); HomeTotal = game.Home.Score.Total.ToString(); if (game.Qtr == null) { Qtr = "Qtr N/A"; } else { Qtr = game.Qtr.ToLower() != "final" ? string.Format("Q{0} {1}", game.Qtr, game.Clock) : game.Qtr; } } base.OnNavigatedTo(e, viewModelState); }
public override async void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewState) { // The States collection needs to be populated before setting the State property await PopulateStatesAsync(); if (viewState != null) { base.OnNavigatedTo(e, viewState); if (e.NavigationMode == NavigationMode.Refresh) { // Restore the errors collection manually var errorsCollection = RetrieveEntityStateValue<IDictionary<string, ReadOnlyCollection<string>>>("errorsCollection", viewState); if (errorsCollection != null) { _address.SetAllErrors(errorsCollection); } } } if (e.NavigationMode == NavigationMode.New) { _addressId = e.Parameter as string; if (_addressId != null) { Address = await _checkoutDataRepository.GetShippingAddressAsync(_addressId); return; } if (_loadDefault) { var defaultAddress = await _checkoutDataRepository.GetDefaultShippingAddressAsync(); if (defaultAddress != null) { // Update the information and validate the values Address.FirstName = defaultAddress.FirstName; Address.MiddleInitial = defaultAddress.MiddleInitial; Address.LastName = defaultAddress.LastName; Address.StreetAddress = defaultAddress.StreetAddress; Address.OptionalAddress = defaultAddress.OptionalAddress; Address.City = defaultAddress.City; Address.State = defaultAddress.State; Address.ZipCode = defaultAddress.ZipCode; Address.Phone = defaultAddress.Phone; } } } }
public override async void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState) { if (await _accountService.VerifyUserAuthenticationAsync() == null) { return; } var addressId = e.Parameter as string; HeaderLabel = string.IsNullOrWhiteSpace(addressId) ? _resourceLoader.GetString("AddBillingAddressTitle") : _resourceLoader.GetString("EditBillingAddressTitle"); BillingAddressViewModel.OnNavigatedTo(e, viewModelState); }
public async override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState) { if (e.SourcePageType != null) { string sourcePageType = e.SourcePageType.Name; int len = sourcePageType.Length; FeedType = sourcePageType.Substring(0, len - 4); } IsBusy = true; await Task.Delay(1); List<Feed> feeds = null; feeds = await feedService.GetFeedsAsync(link); Feeds = new ObservableCollection<Feed>(feeds); IsBusy = false; base.OnNavigatedTo(e, viewModelState); }
public void OnNavigatedTo_With_RestorableStateAttribute() { var viewModelState = new Dictionary<string, object>(); viewModelState.Add("Title", "MyMock"); viewModelState.Add("Description", "MyDescription"); var vm = new MockViewModelWithRestorableStateAttributes(); NavigatedToEventArgs args = new NavigatedToEventArgs(); args.NavigationMode = NavigationMode.Back; vm.OnNavigatedTo(args, viewModelState); Assert.AreEqual(vm.Title, viewModelState["Title"]); Assert.AreEqual(vm.Description, viewModelState["Description"]); }
public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState) { Title = "NFL Schedule"; YearItemsSelectionChangedCommand = new DelegateCommand(ExecuteYearItemsSelectionChangedCommand, CanExecuteYearItemsSelectionChangedCommand); SeasonItemsSelectionChangedCommand = new DelegateCommand(ExecuteSeasonItemsSelectionChangedCommand, CanExecuteSeasonItemsSelectionChangedCommand); WeekItemsSelectionChangedCommand = new DelegateCommand(ExecuteWeekItemsSelectionChangedCommand, CanExecuteWeekItemsSelectionChangedCommand); GameViewModelsSelectionChangedCommand = new DelegateCommand(ExecuteGameViewModelsSelectionChangedCommand, CanExecuteGameViewModelsSelectionChangedCommand); RefreshCommand = new DelegateCommand(ExecuteRefreshCommand, CanExecuteRefreshCommand); if (e.NavigationMode != Windows.UI.Xaml.Navigation.NavigationMode.Back) { InitializeWeekScheduleComboBoxes(); } base.OnNavigatedTo(e, viewModelState); }
public async override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState) { base.OnNavigatedTo(e, viewModelState); var queryText = e.Parameter as String; string errorMessage = string.Empty; this.SearchTerm = queryText; this.QueryText = '\u201c' + queryText + '\u201d'; try { Collection<Product> products; if (queryText == PreviousSearchTerm) { products = PreviousResults; } else { var searchResults = await _productCatalogRepository.GetFilteredProductsAsync(queryText, 0); products = searchResults.Products; TotalCount = searchResults.TotalCount; PreviousResults = products; } var productViewModels = new List<ProductViewModel>(); foreach (var product in products) { productViewModels.Add(new ProductViewModel(product)); } // Communicate results through the view model this.Results = new ReadOnlyCollection<ProductViewModel>(productViewModels); this.NoResults = !this.Results.Any(); // Update VM status PreviousSearchTerm = SearchTerm; } catch (Exception ex) { errorMessage = string.Format(CultureInfo.CurrentCulture, _resourceLoader.GetString("GeneralServiceErrorMessage"), Environment.NewLine, ex.Message); } if (!string.IsNullOrWhiteSpace(errorMessage)) { await _alertMessageService.ShowAsync(errorMessage, _resourceLoader.GetString("ErrorServiceUnreachable")); } }
public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState) { if (e.Parameter is string) Parametro = e.Parameter as string; else { var plan = e.Parameter as PlanMenuModel; if (plan != null) { Parametro = plan.Name; } else { Parametro = "Error del carajo"; } } base.OnNavigatedTo(e, viewModelState); }
public void OnNavigatedTo_With_No_RestorableStateAttributes() { var viewModelState = new Dictionary<string, object>(); viewModelState.Add("Title", "MyMock"); viewModelState.Add("Description", "MyDescription"); var viewState = new Dictionary<string, object>(); viewState.Add("Tests.Mocks.MockViewModelWithNoResumableStateAttributes1", viewModelState); var vm = new MockViewModelWithNoRestorableStateAttributes(); NavigatedToEventArgs args = new NavigatedToEventArgs(); args.NavigationMode = NavigationMode.Back; vm.OnNavigatedTo(args, viewState); Assert.IsNull(vm.Title); Assert.IsNull(vm.Description); }
public async override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState) { var list = await GetIdeasToday(); foreach (var item in list) { Ideas.Add(item); } foreach (var task in BackgroundTaskRegistration.AllTasks) { task.Value.Unregister(true); } var builder = new BackgroundTaskBuilder(); builder.Name = "ThinkWiseTask"; builder.TaskEntryPoint = "BackgroundTasks.NotifierBackgroundTask"; builder.SetTrigger(new TimeTrigger(15, false)); var ret = builder.Register(); base.OnNavigatedTo(e, viewModelState); }
public override async void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState) { if (await _accountService.VerifyUserAuthenticationAsync() == null) { return; } var paymentMethodId = e.Parameter as string; HeaderLabel = string.IsNullOrWhiteSpace(paymentMethodId) ? _resourceLoader.GetString("AddPaymentMethodTitle") : _resourceLoader.GetString("EditPaymentMethodTitle"); if (!string.IsNullOrWhiteSpace(paymentMethodId)) { // Update PaymentMethod information PaymentMethodViewModel.PaymentMethod = await _checkoutDataRepository.GetPaymentMethodAsync(paymentMethodId); } PaymentMethodViewModel.OnNavigatedTo(e, viewModelState); }
public override async void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewState) { if (viewState != null) { base.OnNavigatedTo(e, viewState); if (e.NavigationMode == NavigationMode.Refresh) { // Restore the errors collection manually var errorsCollection = RetrieveEntityStateValue<IDictionary<string, ReadOnlyCollection<string>>>("errorsCollection", viewState); if (errorsCollection != null) { _paymentMethod.SetAllErrors(errorsCollection); } } } if (e.NavigationMode == NavigationMode.New) { if (_loadDefault) { 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(); } } } }