Пример #1
0
 private async void ShowLinePage()
 {
     if (SelectedLine != null)
     {
         await NavService.NavigateToViewModelParm <LinePageViewModel, Line>(SelectedLine, true);
     }
 }
Пример #2
0
        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);
            }
        }
Пример #3
0
        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;
            }
        }
Пример #4
0
        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;
            }
        }
Пример #5
0
        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);
            }
        }
Пример #6
0
        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;
        }
Пример #7
0
        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;
        }
Пример #8
0
        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;
            }
        }
Пример #9
0
        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();
        }
Пример #11
0
        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));
        }
Пример #12
0
        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();
        }
Пример #14
0
 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;
            }
        }
Пример #16
0
        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;
            }
        }
Пример #17
0
        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;
        }
Пример #18
0
        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);
            }
        }
Пример #20
0
        private void Timer_Elapsed(object sender, ElapsedEventArgs e)
        {
            var vm = new IdlePageViewModel(NavService);

            NavService.ShowPage(PageType.IDLE_PAGE, false, vm);
            vm.Initialize();
        }
Пример #21
0
        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;
            }
        }
Пример #22
0
        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);
        }
Пример #24
0
        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;
                }
            }
        }
Пример #25
0
        public override async Task Init()
        {
            // Check if we have logged in and that we are running our device on iOS

            await LoadWalletDetails();

            NavService.ClearAllViewsFromStack();
        }
Пример #26
0
        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();
        }
Пример #27
0
        public override async Task Init()
        {
            await NavService.PushAlertPopupAsync("Loading...");

            MeetingName = string.Empty;
            Users       = (await DataRetrievalService.GetUsersAsync()).ToObservableCollection();

            await NavService.PopAlertPopupsAsync();
        }
Пример #28
0
 public static void NavigateToNotesPage()
 {
     if (NotesViewModel == null)
     {
         NotesViewModel = new NotesPageViewModel(new NotesPage());
     }
     NotesViewModel.UpdateNotes();
     NavService.Navigate(NotesViewModel.Page);
 }
Пример #29
0
        //ItemSelect method
        private async void ItemSelectedMethod()
        {
            if (VacItemSelected != null)
            {
                await NavService.GotoPageAsync(NavigationService.AvailablePages.VaccineInfoPage);

                VacItemSelected = null;
            }
        }
Пример #30
0
        public override async Task Init()
        {
            await NavService.PushAlertPopupAsync("Loading...");

            CurrentUser    = StateService.GetCurrentUser();
            CurrentCompany = await DataRetrievalService.GetCompanyByIdOrNull(CurrentUser.CompanyId);

            await NavService.PopAlertPopupsAsync();
        }