private async void ShowLinePage() { if (SelectedLine != null) { await NavService.NavigateToViewModelParm <LinePageViewModel, Line>(SelectedLine, true); } }
private void NavigationView_SelectionChanged(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewSelectionChangedEventArgs args) { if (args.IsSettingsSelected) { NavService.Navigate(typeof(Views.SettingsView)); return; } if (!(args.SelectedItem is Microsoft.UI.Xaml.Controls.NavigationViewItem navItem)) { NavService.Navigate(typeof(Views.HomeView)); return; } PageInfo pageInfo = NavigationHelper.Pages.Find((info) => info.Title == navItem.Content.ToString()); if (pageInfo == null) { NavService.Navigate(typeof(Views.HomeView)); return; } if (pageInfo != null && pageInfo.PageType.BaseType == typeof(Page)) { NavService.Navigate(pageInfo.PageType); } }
public void NavigateToActionItem(ActionItem actionItem) { if (actionItem == null) { throw new ArgumentNullException("actionItem"); } var navParams = new NavigationParameters { { "ActionItem", actionItem } }; switch (actionItem.ActionType) { case ActionItemType.MissingUtilityBill: NavService.Navigate("MissingBillPage", navParams); break; case ActionItemType.PrebillingApproval: NavService.Navigate("PrebillingTabbedPage", navParams); break; case ActionItemType.UtilityAlert: NavService.Navigate("UtilityAlertPage", navParams); break; } }
private async Task Save() { if (IsBusy) { return; } IsBusy = true; try { /**/ var newItem = new TripLogEntry { Title = Title, Latitude = Latitude, Longitude = Longitude, Date = Date, Rating = Rating, Notes = Notes }; // TODO: Persist entry await Task.Delay(3000); await NavService.GoBack(); } finally { IsBusy = false; } }
private async void controlsSearchBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args) { if (args.ChosenSuggestion != null && args.ChosenSuggestion is MicrosoftStore.Models.Product product) { try { LoadingIndicator.Visibility = Visibility.Visible; var culture = CultureInfo.CurrentUICulture; var region = new RegionInfo(culture.LCID); string productId = product.Metas.First(m => m.Key == "BigCatalogId").Value; // Get the full product details var item = await Ioc.Default.GetRequiredService <MicrosoftStore.IStorefrontApi>().GetProduct(productId, region.TwoLetterISORegionName, culture.Name); var candidate = item.Convert <MicrosoftStore.Models.ProductDetails>().Payload; if (candidate?.PackageFamilyNames != null && candidate?.ProductId != null) { CurrentProduct = candidate; LoadingIndicator.Visibility = Visibility.Collapsed; NavService.Navigate(typeof(Views.ProductDetailsView), CurrentProduct); } } catch (ArgumentNullException ex) { Debug.WriteLine(ex.ParamName + ":\r\n" + ex.StackTrace); } } else if (!string.IsNullOrEmpty(args.QueryText)) { NavService.Navigate(typeof(Views.SearchResultsView), args.QueryText); } }
async Task ExecuteModificaAnnuncioCommand() { IsBusy = true; if (EmptyFields()) { await App.Current.MainPage.DisplayAlert("Errore", "Non hai riempito uno o più campi", "Ok"); return; } Annuncio.nomeOggetto = Annuncio.nomeOggetto.Trim(); Annuncio.descrizione = Annuncio.descrizione.Trim(); var response = await _annuncioService.ModifyAdDataAsync(Annuncio); if (response.hasSucceded) { StringBuilder successo = new StringBuilder(); successo.Append("Annuncio modificato con successo!"); await App.Current.MainPage.DisplayAlert("RentIT", successo.ToString(), "ok"); await NavService.NavigateToMainPage(); } else { await App.Current.MainPage.DisplayAlert("Errore", response.responseMessage, "Ok"); } IsBusy = false; }
async Task ExecuteResetPasswordCommand() { IsBusy = true; if (string.IsNullOrWhiteSpace(Email)) { StringBuilder benvenuto = new StringBuilder(); benvenuto.AppendLine("Inserisci la mail nel form qui sopra"); await App.Current.MainPage.DisplayAlert("RentIT", benvenuto.ToString(), "Ok"); IsBusy = false; return; } Email = Email.Trim(); var authResponse = await _authService.resetPassword(Email); if (authResponse.hasSucceded) { StringBuilder benvenuto = new StringBuilder(); benvenuto.AppendLine("Ti abbiamo inviato la password sostituitiva."); benvenuto.Append("Controlla la tua mail"); await App.Current.MainPage.DisplayAlert("RentIT", benvenuto.ToString(), "Ok"); await NavService.NavigateToMainPage(); } else { await App.Current.MainPage.DisplayAlert("Errore", authResponse.responseMessage, "Ok"); } IsBusy = false; }
async Task ExecuteSaveCommand() { if (IsBusy) { return; } IsBusy = true; try { var newItem = new TripLogEntry { Title = Title, Latitude = Latitude, Longitude = Longitude, Date = Date, Rating = Rating, Notes = Notes }; //Azure Data Access: Add new entry to Azure database await _tripLogDataService.AddEntryAsync(newItem); //Navigation Service : Go back to the main page await NavService.GoBack(); } finally { IsBusy = false; } }
protected override void OpenStartPage() { IdlePageViewModel vm = new IdlePageViewModel(NavService); NavService.ShowPage(PageType.IDLE_PAGE, false, vm); vm.Initialize(); }
private void ExecuteViewLoadList() { var vm = new ListViewModel(NavService); NavService.ShowPage(PageType.LOAD_LIST_PAGE, false, (BasePageViewModel)vm); vm.Initialize(); }
protected override void OnStart() { // Check what Target OS Platform we are running on whenever the app starts if (Device.RuntimePlatform.Equals(Device.Android)) { // Set the Root Page for our application MainPage = new NavigationPage(new SplashPage()); } else { // Set the Root Page and update the NavigationBar color for our app MainPage = new NavigationPage(new WalksMainPage()) { BarBackgroundColor = Color.IndianRed, BarTextColor = Color.White, }; } // Set the current main page to our Navigation Service NavService.XFNavigation = MainPage.Navigation; // Register each of our View Models on our Navigation Stack NavService.RegisterViewMapping(typeof(WalksMainPageViewModel), typeof(WalksMainPage)); NavService.RegisterViewMapping(typeof(WalkEntryPageViewModel), typeof(WalkEntryPage)); NavService.RegisterViewMapping(typeof(WalkTrailInfoPageViewModel), typeof(WalkTrailInfoPage)); NavService.RegisterViewMapping(typeof(WalkDistancePageViewModel), typeof(WalkDistancePage)); NavService.RegisterViewMapping(typeof(TwitterSignInPageViewModel), typeof(TwitterSignInPage)); }
public async Task SaveEntry(GooglePlaceAutoCompletePrediction placeA) { var place = await googleMapsApi.GetPlaceDetails(placeA.PlaceId); if (place != null) { PickupText = place.Name; Entry.Latitude = place.Latitude; Entry.Longitude = place.Longitude; Entry.Address = place.Name; if (IsBusy) { return; } IsBusy = true; try { await _cateringService.AddEntryAsync(Entry); await NavService.NavigateTo <MainViewModel>(); await NavService.ClearBackStack(); await NavService.ClearBackStack(); } finally { IsBusy = false; } } }
private void ExecuteCloseCommand() { var vm = new IdlePageViewModel(NavService); NavService.ShowPage(PageType.IDLE_PAGE, false, vm); vm.Initialize(); }
private void NavigateOnSelection() { if (selectedAsset != null) { NavService.NavigateTo <AssetDetailViewModel, AssetDto>(selectedAsset); } }
async Task ExecuteSaveCommand() { if (IsBusy) { return; } IsBusy = true; try { var newItem = new TripLogEntry { Title = Title, Latitude = Latitude, Longitude = Longitude, Date = Date, Rating = Rating, Notes = Notes }; await _tripLogService.AddEntryAsync(newItem); await NavService.GoBack(); } finally { IsBusy = false; } }
async Task ExecuteSaveCommand() { if (IsBusy) { return; } IsBusy = true; try { var newItem = new PlugEVMeEntry { Title = Title, Latitude = Latitude, Longitude = Longitude, Date = Date, Rating = Rating, Notes = Notes }; await Task.Delay(3000); await NavService.GoBack(); } finally { IsBusy = false; } }
async Task ExecuteEliminaCommand() { IsBusy = true; var choice = await App.Current.MainPage.DisplayAlert("Attenzione!", "Sei sicuro di voler eliminare il tuo account? L'operazione è irreversibile ed eliminerà anche tutti i tuoi annunci.", "Si", "No"); if (choice) { var response = await _userService.DeleteAccount(); if (response.hasSucceded) { IsBusy = false; StringBuilder successo = new StringBuilder(); successo.AppendLine("Ci dispiace che tu te ne vada!"); successo.Append("I tuoi dati sono stati eliminati correttamente"); await App.Current.MainPage.DisplayAlert("RentIT", successo.ToString(), "ok"); await NavService.NavigateToMainPage(); } else { await App.Current.MainPage.DisplayAlert("Errore", response.responseMessage, "Ok"); } } IsBusy = false; }
private async void DoNavigation() { switch (SelectedMenuItem.TargetPage) { case "AddChildPage": await NavService.GotoPageAsync(NavigationService.AvailablePages.AddChildPage); SelectedMenuItem = Filler; break; case "VaccineInfoPage": await NavService.GotoPageAsync(NavigationService.AvailablePages.VaccineInfoPage); SelectedMenuItem = Filler; break; case "MainPage": await NavService.GotoPageAsync(NavigationService.AvailablePages.MainPage); break; case "SettingsPage": await NavService.GotoPageAsync(NavigationService.AvailablePages.SettingsPage); SelectedMenuItem = Filler; break; case "HistorikPage": await NavService.GotoPageAsync(NavigationService.AvailablePages.HistorikPage); SelectedMenuItem = Filler; break; } }
private void ExecuteLookupLoad() { ShowInputError = false; //TODO VALIDATE TICKET LOAD NUMBER EXISTS if (string.IsNullOrEmpty(GinTicketLoadNumber)) { ShowInputError = true; InputErrorMessage = "Please enter a gin ticket load number."; } else { using (var dp = SimpleIoc.Default.GetInstance <IUnitOfWorkFactory>().CreateUnitOfWork()) { if (!dp.LoadScanRepository.FindMatching(m => m.GinTagLoadNumber == GinTicketLoadNumber).Any()) { ShowInputError = true; InputErrorMessage = "Load not found."; } } } if (!ShowInputError) { var vm = new LoadViewModel(NavService); NavService.ShowPage(PageType.LOAD_PAGE, false, (BasePageViewModel)vm); vm.Initialize(GinTicketLoadNumber.Trim().TrimStart('0'), false, true); } }
private void Timer_Elapsed(object sender, ElapsedEventArgs e) { var vm = new IdlePageViewModel(NavService); NavService.ShowPage(PageType.IDLE_PAGE, false, vm); vm.Initialize(); }
private async Task executeSaveCommand() { if (IsBusy) { return; } IsBusy = true; var newItem = new TripLogEntry { Title = this.Title, Latitude = this.Latitude, Longitude = this.Longitude, Date = this.Date, Rating = this.Rating, Notes = this.Notes }; try { await _tripLogService.AddEntryAsync(newItem); await NavService.GoBack(); } finally { IsBusy = false; } }
async Task ExecuteSaveCommand() { if (IsBusy) { return; } IsBusy = true; try { var newItem = new TripLogEntry { Title = Title, Latitude = Latitude, Longitude = Longitude, Date = Date, Rating = Rating, Notes = Notes }; // TODO: Persist Entry in a later chapter. // TODO: Remove this in Chapter 6 await Task.Delay(3000); await NavService.GoBack(); } finally { IsBusy = false; } }
private void ExecuteOpenCommand() { var vm = new LoadViewModel(NavService); NavService.ShowPage(PageType.LOAD_PAGE, true, (BasePageViewModel)vm); vm.Initialize(SelectedItem.GinTicketLoadNumber, false, true, true, SelectedItem.Id); }
async Task ExecuteDeleteCommand(bool answer) { if (answer) { if (IsBusy) { return; } IsBusy = true; try { await _cateringService.RemoveEntryAsync(Entry); await NavService.GoBack(); await NavService.ClearBackStack(); } finally { IsBusy = false; } } }
public override async Task Init() { // Check if we have logged in and that we are running our device on iOS await LoadWalletDetails(); NavService.ClearAllViewsFromStack(); }
public override void Load() { var navService = new NavService(); navService.RegisterViewMapping(typeof(LogDetailViewModel), typeof(LogDetailPage)); navService.RegisterViewMapping(typeof(NewEntryViewModel), typeof(NewEntryPage)); Bind <INavService>().ToMethod(x => navService).InSingletonScope(); }
public override async Task Init() { await NavService.PushAlertPopupAsync("Loading..."); MeetingName = string.Empty; Users = (await DataRetrievalService.GetUsersAsync()).ToObservableCollection(); await NavService.PopAlertPopupsAsync(); }
public static void NavigateToNotesPage() { if (NotesViewModel == null) { NotesViewModel = new NotesPageViewModel(new NotesPage()); } NotesViewModel.UpdateNotes(); NavService.Navigate(NotesViewModel.Page); }
//ItemSelect method private async void ItemSelectedMethod() { if (VacItemSelected != null) { await NavService.GotoPageAsync(NavigationService.AvailablePages.VaccineInfoPage); VacItemSelected = null; } }
public override async Task Init() { await NavService.PushAlertPopupAsync("Loading..."); CurrentUser = StateService.GetCurrentUser(); CurrentCompany = await DataRetrievalService.GetCompanyByIdOrNull(CurrentUser.CompanyId); await NavService.PopAlertPopupsAsync(); }