コード例 #1
0
 private void NavigateOnSelection()
 {
     if (selectedAsset != null)
     {
         NavService.NavigateTo <AssetDetailViewModel, AssetDto>(selectedAsset);
     }
 }
コード例 #2
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;
                }
            }
        }
コード例 #3
0
 public override async Task Init()
 {
     if (!((App)Application.Current).IsSignedIn)
     {
         await NavService.NavigateTo <SignInViewModel>();
     }
     else
     {
         LoadEntries();
     }
 }
コード例 #4
0
 async Task ExecuteLoginCommand()
 {
     if (!IsLogged())
     {
         await NavService.NavigateTo <LoginPageViewModel>();
     }
     else //apre la pagina utente se già loggato
     {
         await NavService.NavigateTo <UtentePageViewModel>();
     }
 }
コード例 #5
0
        // ...

        async Task ExecuteSelectPlaceCommand()
        {
            var newItem = new CateringEntry
            {
                Title     = Title,
                Latitude  = Latitude,
                Longitude = Longitude,
                Date      = Date,
                Notes     = Notes
            };
            await NavService.NavigateTo <SelectPlaceViewModel, CateringEntry>(newItem);
        }
コード例 #6
0
        async Task ExecuteCercaCommand()
        {
            if (isEmpty())
            {
                await App.Current.MainPage.DisplayAlert("Errore", "Riempi entrambi i campi di ricerca", "Ok");

                return;
            }
            SearchQuery query = new SearchQuery();

            query.citta   = Citta.Trim();
            query.oggetto = Oggetto.Trim();
            await NavService.NavigateTo <AnnunciQueryViewModel, SearchQuery>(query);
        }
コード例 #7
0
ファイル: SubmitPageViewModel.cs プロジェクト: Dr-Dd/RentIT
        async Task ExecuteSignInCommand()
        {
            if (!IsValidEmail(Email))
            {
                await App.Current.MainPage.DisplayAlert("Errore", "Inserisci un indirizzo email valido", "Ok");

                return;
            }

            if (EmptyFields())
            {
                await App.Current.MainPage.DisplayAlert("Errore", "Non hai riempito uno o più campi", "Ok");

                return;
            }

            if (!PasswordsAreTheSameAndNotEmpty())
            {
                await App.Current.MainPage.DisplayAlert("Errore", "Le due password non corrispondono", "Ok");

                return;
            }

            var signUpRequest = new SignUpRequest
            {
                name     = Name.Trim(),
                surname  = Surname.Trim(),
                email    = Email.Trim(),
                password = Password.Trim()
            };

            IsBusy = true;

            var signUpResponse = await _userService.SignUpAsync(signUpRequest);

            if (signUpResponse.hasSucceded)
            {
                //c'è da fare il login da qui?
                await App.Current.MainPage.DisplayAlert("Perfetto!", "Registrazione completata con successo", "Ok");

                await NavService.NavigateTo <SearchPageViewModel>();
            }
            else
            {
                await App.Current.MainPage.DisplayAlert("Errore", signUpResponse.responseMessage, "Ok");
            }

            IsBusy = false;
        }
コード例 #8
0
ファイル: LoginPageViewModel.cs プロジェクト: Dr-Dd/RentIT
        async Task ExecuteLogInCommand()
        {
            if (string.IsNullOrWhiteSpace(Email))
            {
                StringBuilder benvenuto = new StringBuilder();
                benvenuto.Append("Non hai inserito l'email");
                await App.Current.MainPage.DisplayAlert("Fai attenzione:", benvenuto.ToString(), "Ok");

                return;
            }

            if (string.IsNullOrWhiteSpace(Password))
            {
                StringBuilder benvenuto = new StringBuilder();
                benvenuto.Append("Non hai inserito la password");
                await App.Current.MainPage.DisplayAlert("Fai attenzione:", benvenuto.ToString(), "Ok");

                return;
            }

            Email    = Email.Trim();
            Password = Password.Trim();

            IsBusy = true;
            var authResponse = await _authService.LoginAsync(Email, Password);

            if (authResponse.hasSucceded)
            {
                if (AppSettings.NewProfile)
                {
                    StringBuilder benvenuto = new StringBuilder();
                    benvenuto.AppendLine("Benvenuto su RentIT!");
                    benvenuto.Append("Completa il tuo profilo prima di continuare");
                    await App.Current.MainPage.DisplayAlert("RentIT", benvenuto.ToString(), "Ok");

                    await NavService.NavigateTo <ModificaDatiViewModel>();

                    return;
                }
                await NavService.NavigateToMainPage();
            }
            else
            {
                await App.Current.MainPage.DisplayAlert("Errore", authResponse.responseMessage, "Ok");
            }

            IsBusy = false;
        }
コード例 #9
0
ファイル: MainViewModel.cs プロジェクト: jsauve/PlugEVMe
 async Task ExecutePinsCommand(ObservableRangeCollection <PlugEVMeEntry> entries)
 {
     try
     {
         var clone = JsonConvert.DeserializeObject <ObservableRangeCollection <PlugEVMeEntry> >(JsonConvert.SerializeObject(entries));
         await NavService.NavigateTo <PinItemsSourcePageViewModel, ObservableRangeCollection <PlugEVMeEntry> >(clone);
     }
     catch (AppException e)
     {
         Debug.WriteLine("In catch block of Main method.");
         Debug.WriteLine("Caught: {0}", e.Message);
         if (e.InnerException != null)
         {
             Debug.WriteLine("Inner exception: {0}", e.InnerException);
         }
     }
 }
コード例 #10
0
        internal async Task RecordScanAsync(Guid id)
        {
            var logRecord = BuildLogRecord(id);

            if (1 == await DataRetrievalService.WriteBarcodeScanRecord(logRecord))
            {
                //Queue up the record for upload to the Azure Database
                await DataRetrievalService.QueueAsync(logRecord.BarcodeScanLogId, QueueableObjects.BarcodeScanLog);

                //See if right now is a good time to upload the data - 10 records at a time
                DataRetrievalService.StartSafeQueuedUpdates();
                //navigate
                await NavService.NavigateTo <LoyaltyBonusViewModel>();
            }
            else
            {
                //TODO: rts - everything did not work out very well - write code here
            }
        }
コード例 #11
0
        async Task ExecuteLogOutCommandAsync()
        {
            IsBusy = true;

            var response = await _authService.LogoutAsync();

            if (response)
            {
                await App.Current.MainPage.DisplayAlert("RentIT", "A presto!", "Ok");

                await NavService.NavigateTo <SearchPageViewModel>();
            }
            else
            {
                await App.Current.MainPage.DisplayAlert("Errore", "Impossibile effettuare il log out", "Ok");
            }

            IsBusy = false;
        }
コード例 #12
0
        async Task ExecuteAddAnnuncioCommandAsync()
        {
            if (!IsLogged())
            {
                await App.Current.MainPage.DisplayAlert("RentIT", "Iscriviti o effettua il login per aggiungere un annuncio!", "Ok");

                await NavService.NavigateTo <LoginPageViewModel>();

                return;
            }
            if (AppSettings.NewProfile)
            {
                await App.Current.MainPage.DisplayAlert("RentIT", "Aggiorna i tuoi dati prima di aggiungere un annuncio!", "Ok");

                await NavService.NavigateTo <ModificaDatiViewModel>();

                return;
            }
            await NavService.NavigateTo <AggiungiAnnuncioViewModel>();
        }
コード例 #13
0
        async Task ExecuteSignInCommand()
        {
            // NEW Client ID: 409009394217-p3cu602apd7vkaucmg4p1vijhqm4is6f.apps.googleusercontent.com
            // OLD Client ID: 409009394217-11dcm7db57c38qp5q47jj4p8gfmi88p1.apps.googleusercontent.com
            await _authService.SignInAsync(
                tokenCallback : async t =>
            {
                // use google token to get Azure auth token
                var response = await _tripLogService.GetAuthTokenAsync("google", t);

                // save auth token in local settings
                Helpers.Settings.TripLogApiAuthToken = response.AuthenticationToken;

                // Navigate to Main
                await NavService.NavigateTo <MainViewModel>();
                await NavService.RemoveLastView();
            },
                errorCallback : e =>
            {
                // todo: handle invalid auth here
            });
        }
コード例 #14
0
        async Task ExecuteSignInCommand()
        {
            // TODO: Update with your Facebook Client Id
            await _authService.SignInAsync("YOUR-FACEBOOK-CLIENTID",
                                           new Uri("https://m.facebook.com/dialog/oauth"),
                                           new Uri("https://<your-service-name>.azurewebsites.net/.auth/login/facebook/callback"),
                                           tokenCallback : async t =>
            {
                // Use Facebook token to get Azure auth token
                var response = await _tripLogService.GetAuthTokenAsync("facebook", t);

                // Save auth token in local settings
                Helpers.Settings.TripLogApiAuthToken = response.AuthenticationToken;

                // Navigate to Main
                await NavService.NavigateTo <MainViewModel>();
                await NavService.RemoveLastView();
            },
                                           errorCallback : e =>
            {
                // TODO: Handle invalid authentication here
            });
        }
コード例 #15
0
 async Task ExecuteNewEntryCommand()
 {
     await NavService.NavigateTo <NewEntryViewModel>();
 }
コード例 #16
0
ファイル: MainViewModel.cs プロジェクト: lipowskm/Catering
 async Task ExecuteViewCommand(CateringEntry entry)
 {
     await NavService.NavigateTo <DetailViewModel, CateringEntry>(entry);
 }
コード例 #17
0
 private async Task AddAsset()
 {
     await NavService.NavigateTo <AssetDetailViewModel, AssetDto>(null);
 }
コード例 #18
0
 public async Task HandleFeedSelection(int feedId)
 {
     await NavService.NavigateTo <VprFeedArticlesViewModel, int>(feedId);
 }
コード例 #19
0
 async Task ExecuteSubmitCommand()
 {
     await NavService.NavigateTo <SubmitPageViewModel>();
 }
コード例 #20
0
        // Momentaneamente commentato
        async Task ExecuteAnnunciPageCommand()
        {
            ObservableCollection <Ad> Annunci = await _annuncioService.GetLastAds(Citta, Oggetto);

            await NavService.NavigateTo <AnnunciPageViewModel, ObservableCollection <Ad> >(Annunci);
        }
コード例 #21
0
ファイル: MainViewModel.cs プロジェクト: jsauve/PlugEVMe
 async Task ExecuteViewCommand(PlugEVMeEntry entry)
 {
     await NavService.NavigateTo <DetailViewModel, PlugEVMeEntry>(entry);
 }
コード例 #22
0
 async Task ExecuteModificaCommandAsync()
 {
     await NavService.NavigateTo <ModificaDatiViewModel>();
 }
コード例 #23
0
 async Task ExecuteViewGestioneAnnuncio(Ad annuncio)
 {
     await NavService.NavigateTo <GestioneAnnuncioViewModel, Ad>(annuncio);
 }
コード例 #24
0
ファイル: AnnunciPageViewModel.cs プロジェクト: Dr-Dd/RentIT
 async Task ExecuteViewAnnuncio(Ad annuncio)
 {
     await NavService.NavigateTo <DettaglioAnnuncioViewModel, Ad>(annuncio);
 }
コード例 #25
0
 async Task ExecuteShowDetailsCommand(TripLogEntry entry)
 {
     await NavService.NavigateTo <EntryDetailsViewModel, TripLogEntry>(entry);
 }
コード例 #26
0
 async Task ExecuteUtenteCommand()
 {
     await NavService.NavigateTo <UtentePageViewModel>();
 }
コード例 #27
0
        async Task ExecuteVediAnnunciUtenteCommand()
        {
            ObservableCollection <Ad> asd = await _annuncioService.GetUserAds(Utente.id, false);

            await NavService.NavigateTo <AnnunciPageViewModel, Utente>(Utente);
        }
コード例 #28
0
 async Task ExecuteAnnunciUtenteCommandAsync()
 {
     await NavService.NavigateTo <AnnunciUtenteViewModel>();
 }
コード例 #29
0
 async Task ExecuteInfoUtenteCommand()
 {
     await NavService.NavigateTo <InfoUtenteViewModel, Utente>(Affittuario);
 }
コード例 #30
0
 private async Task ExecuteViewCommand(TripLogEntry entry)
 {
     await NavService.NavigateTo <DetailViewModel, TripLogEntry>(entry);
 }