Ejemplo n.º 1
0
        async Task LoginUser()
        {
            if (string.IsNullOrEmpty(User.Username) || string.IsNullOrEmpty(User.Password))
            {
                if (string.IsNullOrEmpty(User.Username) || string.IsNullOrEmpty(User.Password))
                {
                    await PageDialogService.DisplayAlertAsync("Error", "You must complete all required fields, to continue", "Ok");
                }
                return;
            }

            NavigationParameters navParams = new NavigationParameters();

            navParams.Add("UserInformation", User);
            await NavigationService.NavigateAsync("Test2Page", navParams);

            //await NavigationService.NavigateAsync(new Uri($"Test2Page?UserInformation={User}", UriKind.Relative));
        }
        public async Task LoginUser()
        {
            UserModel userModel = new UserModel();

            userModel.Login    = LoginParameter;
            userModel.Password = PasswordParameter;

            UserModel.Hash = await _login.GetUser(userModel);

            if (!string.IsNullOrEmpty(UserModel.Hash))
            {
                await NavigationService.NavigateAsync("VotingPage");
            }
            else
            {
                await PageDialogService.DisplayAlertAsync("Erro", "Usuário e/ou senha incorretos.", "OK");
            }
        }
Ejemplo n.º 3
0
        public async Task <bool> LoginAsync()
        {
            _isBusy = true;

            if (Settings.IsLoggedIn)
            {
                return(await Task.FromResult(true));
            }

            bool result = await _azureService.LoginAsync();

            if (!result)
            {
                await _pageDialogService.DisplayAlertAsync("Houve um erro ao fazer login", "Tente novamente", "OK");
            }

            return(result);
        }
Ejemplo n.º 4
0
 internal void CheckUser()
 {
     if (!string.IsNullOrEmpty(user.UserName))
     {
         if (user.UserName.ToLower() != "admin")
         {
             var user = _userRepo.QueryTable().FirstOrDefault(x => x.UserName == _user.UserName);
             if (user != null)
             {
                 ExistingUser = user;
             }
             else
             {
                 PageDialogService.DisplayAlertAsync("", "User does not exist please register to continue.", "OK");
             }
         }
     }
 }
Ejemplo n.º 5
0
        private async Task TaskPhoto()
        {
            var cameraStatus = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Camera);

            var storageStatus = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Storage);

            if (cameraStatus != PermissionStatus.Granted || storageStatus != PermissionStatus.Granted)
            {
                var results = await CrossPermissions.Current.RequestPermissionsAsync(new[] { Permission.Camera, Permission.Storage });

                cameraStatus  = results[Permission.Camera];
                storageStatus = results[Permission.Storage];
            }

            if (cameraStatus == PermissionStatus.Granted && storageStatus == PermissionStatus.Granted)
            {
                if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
                {
                    await PageDialogService.DisplayAlertAsync("No Camera", ":( No camera avaialble.", "OK");

                    return;
                }

                var file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions
                {
                    PhotoSize = PhotoSize.Full,
                    Directory = "ImageTemp",
                    Name      = "img.png",
                });

                if (file == null)
                {
                    return;
                }
                ListImagePage[CurrentPagePosition].ImageSource = file.Path;
            }
            else
            {
                await PageDialogService.DisplayAlertAsync("Permissions Denied", "Unable to take photos.", "OK");

                //On iOS you may want to send your user to the settings screen.
                //CrossPermissions.Current.OpenAppSettings();
            }
        }
Ejemplo n.º 6
0
        private async void OnItemTappedCommandExecuted(Object param)
        {
            try
            {
                ILookup selectedTtem = (ILookup)param;
                _attribute.Value        = selectedTtem.ValueMember;
                _attribute.DisplayValue = selectedTtem.DisplayMember;

                var navigationParams = new NavigationParameters
                {
                    { "LookupPicker", _attribute }
                };
                await NavigationService.GoBackAsync(navigationParams);
            }
            catch (Exception ex)
            {
                await PageDialogService.DisplayAlertAsync("Error", ex.Message, "OK");
            }
        }
        public async Task RegisterUser()
        {
            UserModel userModel = new UserModel();

            userModel.Name     = NameParameter;
            userModel.Login    = LoginParameter;
            userModel.Password = PasswordParameter;

            var resultPost = await _login.PostUser(userModel);

            if (resultPost)
            {
                await NavigationService.NavigateAsync("LoginPage");
            }
            else
            {
                await PageDialogService.DisplayAlertAsync("Erro", "Erro ao registrar usuário", "OK");
            }
        }
Ejemplo n.º 8
0
 public async Task ItemSelected(object obj)
 {
     try
     {
         var item        = (Value)obj;
         var date        = DateTime.Parse(item.Label).ToString("MMMM yyyy");
         var name        = GetUntilOrEmpty(SelectedGazette.Label, " Gazettes") + " Gazette vol";
         var searchParam = @"""" + name + @""" AND """ + date + @"""";
         var np          = new NavigationParameters
         {
             { "SearchParam", searchParam }
         };
         await NavigationService.NavigateAsync("GazetteResultsPage", np);
     }
     catch (Exception ex)
     {
         await PageDialogService.DisplayAlertAsync(Dialog.Error, ex.Message, Dialog.Ok);
     }
 }
Ejemplo n.º 9
0
        private async void OnSaveChange(object obj)
        {
            if (CanChange(obj) == false)
            {
                await PageDialogService.DisplayAlertAsync("Xác nhận", "Bạn chưa đăng nhập", "Thử lại");

                await NavigationService.NavigateAsync(nameof(VBS_LoginPage));
            }

            IsBusyBindProp = true;

            // Thuc hien cong viec tai day

            var member = await logic.GetMember(EmailBindProp);

            if (PresentPassBindProp != member.Password)
            {
                await PageDialogService.DisplayAlertAsync("Thông báo", "Mật khẩu hiện tại không đúng", "Thử lại");

                IsBusyBindProp = false;
                return;
            }
            if (NewPassBindProp != ConfirmPassBindProp)
            {
                await PageDialogService.DisplayAlertAsync("Thông báo", "Mật khẩu không giống nhau", "Thử lại");

                IsBusyBindProp = false;
                return;
            }
            member.Password = NewPassBindProp;
            var isChange = await logic.ChangePass(member);

            if (isChange)
            {
                await PageDialogService.DisplayAlertAsync("Thông báo", "Thay đổi mật khẩu thành công", "Đồng ý");
            }
            else
            {
                await PageDialogService.DisplayAlertAsync("Thông báo", "Thay đổi mật khẩu thất bại", "Thử lại");
            }
            IsBusyBindProp = false;
        }
        private async void compartilhaImagemAsync(string nome_arquivo_completo)
        {
            if (conectionHelper.testaConexao())
            {
                paciente pac = new paciente();
                pac.photo = nome_arquivo_completo;
                byte[] imagem = null;
                using (var Dialog = UserDialogs.Instance.Loading("Compartilhando...", null, null, true, MaskType.Clear))
                {
                    imagem = await apiService.getExame(pac);
                }


                try
                {
                    if (imagem == null)
                    {
                        await PageDialogService.DisplayAlertAsync("app", "Imagem nao encontrada!", "Ok");
                    }
                    else
                    {
                        MemoryStream ms = new MemoryStream(imagem);
                        Xamarin.Forms.DependencyService.Get <IFileService>().SavePicture("ImageName.jpg", ms, "Download");
                        var filePath = Xamarin.Forms.DependencyService.Get <IFileStore>().GetFilePath();

                        compartilhaImagem(filePath);
                    }
                }
                catch (Exception ex)
                {
                }
            }
            else
            {
                await PageDialogService.DisplayAlertAsync("app", "Por favor Verifique sua conexao!", "Ok");

                IsRunning = false;
                isVisible = false;

                return;
            }
        }
Ejemplo n.º 11
0
        private async Task GetDentistasasync()
        {
            isVisible = true;
            IsRunning = true;


            try
            {
                if (InternetConnectivity())
                {
                    if (Lista != null)
                    {
                        if (Lista.Any())
                        {
                            Lista.Clear();
                        }
                    }

                    Lista = await apiService.getDentistas();

                    dentistas = new ObservableCollection <Dentista>(Lista);
                }
                else
                {
                    // dentistas = new ObservableCollection<Dentista>();
                    mostra = true;

                    /* await PageDialogService.DisplayAlertAsync("app", "Sem conexao!", "Ok");
                     *
                     * return;*/
                }
            }
            catch (Exception ex)
            {
                await PageDialogService.DisplayAlertAsync("app", ex.ToString(), "Ok");

                return;
            }
            IsRunning  = false;
            isVisible  = false;
            isVisible2 = false;
        }
Ejemplo n.º 12
0
        public override async void OnNavigatedTo(INavigationParameters parameters)
        {
            var navigationMode = parameters.GetNavigationMode();

            if (navigationMode == NavigationMode.Back)
            {
                if (parameters.ContainsKey("code"))
                {
                    Code = (string)parameters["code"];
                }

                bool exist = true;

                foreach (Heritage heritage in Heritages)
                {
                    if (Code == heritage.Code)
                    {
                        heritage.State = true;

                        if (await Verification(heritage))
                        {
                            Heritages.Remove(heritage);
                            exist = true;
                            break;
                        }
                        else
                        {
                            await PageDialogService.DisplayAlertAsync("Erro", "Erro ao verificar patrimônio", "Ok");
                        }
                    }
                    else
                    {
                        exist = false;
                    }
                }

                if (exist == false)
                {
                    Xamarin.Forms.DependencyService.Get <IMessage>().LongAlert("Patrimônio não existe neste ambiente");
                }
            }
        }
Ejemplo n.º 13
0
        public async Task Vote()
        {
            SatisfactionModel satisfaction = new SatisfactionModel();
            string            Description  = string.Empty;

            switch (Index)
            {
            case 0:
                Description = "Muito Satisfeito";
                break;

            case 1:
                Description = "Satisfeito";
                break;

            case 2:
                Description = "Razoavelmente Satisfeito";
                break;

            case 3:
                Description = "Pouco Satisfeito";
                break;

            case 4:
                Description = "Insatisfeito";
                break;
            }

            satisfaction.Description = Description;
            satisfaction.HashUser    = UserModel.Hash;

            var result = await _satisfaction.PostSatisfaction(satisfaction);

            if (result.Count > 0)
            {
                VoteParameter = result;
            }
            else
            {
                await PageDialogService.DisplayAlertAsync("Erro", "Nenhum registro encontrado.", "OK");
            }
        }
Ejemplo n.º 14
0
        private async void SignInClick()
        {
            var myquery = await RepositoryService.GetAsync <UserModel>((u => u.Name.Equals(UserLogin) && u.Password.Equals(UserPassword)));

            if (myquery != null)
            {
                Settings.RememberedLogin  = UserLogin;
                Settings.RememberedUserId = myquery.Id;

                await NavigationService.NavigateAsync("/NavigationPage/MainListPage");
            }
            else
            {
                await PageDialogService.DisplayAlertAsync(AppResources.InvalidLogin, AppResources.InvalidLogin, "OK");

                Settings.RememberedLogin  = string.Empty;
                Settings.RememberedUserId = 0;
                UserPassword = string.Empty;
            }
        }
        private async Task LoadCity(City selectedCity)
        {
            var favorited = await _cityRegistrationService.GetFavoriteCityAsync(selectedCity.Id);

            selectedCity.Favorited = favorited != null;

            IsBusy = true;
            try
            {
                selectedCity.Weather = await _restService.GetWeather(selectedCity.Id);

                City = selectedCity;
            } catch (Exception)
            {
                await _pageDialogService.DisplayAlertAsync(Message.MessageText, Message.FetchWeatherDataFailed, Message.Ok);
            } finally
            {
                IsBusy = false;
            }
        }
Ejemplo n.º 16
0
        private async void SaveInfo()
        {
            var a = await PageDialogService.DisplayAlertAsync("", "Do you want to save this?", "Yes", "No");

            if (a)
            {
                if (IsNew)
                {
                    studentInfo.StudentId         = Guid.NewGuid().ToString();
                    studentInfo.UserId            = App.CurrentUser.UserId;
                    studentInfo.address.AddressId = Guid.NewGuid().ToString();
                    studentInfo.address.StudentID = studentInfo.StudentId;
                    studentInfo.Class             = "F.Y.J.C";
                }

                _studentInfoRepo.InsertOrReplace(studentInfo);
                _addressRepo.InsertOrReplace(studentInfo.address);
                await NavigationService.GoBackAsync();
            }
        }
Ejemplo n.º 17
0
        public override async void OnNavigatedTo(INavigationParameters parameters)
        {
            base.OnNavigatedTo(parameters);

            IsBusy = true;

            try
            {
                var port = await DataStoreService.GetPortAsync();

                TokenHandlerModel.Port = port;
            }
            catch
            {
                await NavigationService.NavigateAsync("../");

                await PageDialogService.DisplayAlertAsync("Hiba", "Hálózati hiba", "OK");
            }

            IsBusy = false;
        }
Ejemplo n.º 18
0
        private async void OnGoToAddMember(object obj)
        {
            if (IsBusyBindProp)
            {
                return;
            }

            IsBusyBindProp = true;

            // Thuc hien cong viec tai day
            if (EmailBindProp == "")
            {
                await PageDialogService.DisplayAlertAsync("Thông báo", "Bạn cần phải đăng nhập để thực hiện chức năng này", "Đồng ý");

                var param = new NavigationParameters();
                param.Add(Param.PARAM_TITLE, TitleBindProp);
                await NavigationService.NavigateAsync(nameof(VBS_LoginPage), param);
            }
            else
            {
                var member = await logic.GetMember(EmailBindProp);

                var role = logic.CheckRole(member);
                if (role == ConstRole.R01.ToString() || role == ConstRole.R02.ToString())
                {
                    ModeNewBindProp = true;
                    var param = new NavigationParameters();
                    param.Add(Param.PARAM_TITLE, TitleBindProp);
                    param.Add(Param.PARAM_MODE, ModeNewBindProp);
                    await NavigationService.NavigateAsync(nameof(VBS_AddMemberPage), param);
                }
                else
                {
                    await PageDialogService.DisplayAlertAsync("Thông báo", "Bạn không có quyền thực hiện chức năng này", "Đồng ý");
                }
            }


            IsBusyBindProp = false;
        }
Ejemplo n.º 19
0
        private async void OnSearchCommandExecuted()
        {
            IsBusy = true;
            if (!string.IsNullOrEmpty(SearchText))
            {
                var searchUser = tempResult.Where(a => a.Email.ToLower().Contains(SearchText.ToLower())).ToList();
                if (searchUser.Count > 0)
                {
                    searchResults.ReplaceRange(searchUser);
                }
                else
                {
                    SearchText = string.Empty;
                    searchResults.ReplaceRange(searchUser);
                    await PageDialogService.DisplayAlertAsync(null, "No Record Found", "Ok");
                }
            }



            IsBusy = false;
        }
Ejemplo n.º 20
0
        async Task ToggleLightAsync()
        {
            try
            {
                if (IsLightOn)
                {
                    await Flashlight.TurnOffAsync();

                    IsLightOn = false;
                }
                else
                {
                    await Flashlight.TurnOnAsync();

                    IsLightOn = true;
                }
            }
            catch (Exception ex)
            {
                await PageDialogService.DisplayAlertAsync("Error", $"Unable to manage lights. {ex.Message}", "Cancel");
            }
        }
Ejemplo n.º 21
0
        public async void GetLocksmithServices()
        {
            try
            {
                IsBusy = true;
                var apiRetorno = await Utils.GetApi().GetLocksmithServices(Locksmith.locksmith_id);

                Services.Clear();
                foreach (Service s in apiRetorno)
                {
                    Services.Add(s);
                }
            }
            catch (Exception ex)
            {
                await PageDialogService.DisplayAlertAsync("Erro", ex.Message, "OK");
            }
            finally
            {
                IsBusy = false;
            }
        }
Ejemplo n.º 22
0
        private async Task ExecuteFavoriteWorkshopCommand(WorkshopCellViewViewModel workshop)
        {
            if (workshop?.SelectedWorkshop == null)
            {
                return;
            }

            var response = await PageDialogService.DisplayAlertAsync("Unfavorite workshop",
                                                                     "Are you sure you want to remove this workshop from your favorites?",
                                                                     "Unfavorite",
                                                                     "Cancel");

            if (response)
            {
                var toggled = await FavoriteService.ToggleFavorite(workshop.SelectedWorkshop);

                if (toggled)
                {
                    await ExecuteLoadWorkshopsCommandAsync();
                }
            }
        }
Ejemplo n.º 23
0
        private async Task ExecuteFavoriteCommand(SessionCellViewViewModel session)
        {
            if (session?.SelectedSession == null)
            {
                return;
            }

            var response = await PageDialogService.DisplayAlertAsync("Unfavorite Session",
                                                                     "Are you sure you want to remove this session from your favorites?",
                                                                     "Unfavorite",
                                                                     "Cancel");

            if (response)
            {
                var toggled = await FavoriteService.ToggleFavorite(session.SelectedSession);

                if (toggled)
                {
                    await ExecuteLoadSessionsCommandAsync();
                }
            }
        }
Ejemplo n.º 24
0
        private async Task ExecuteSyncCommandAsync()
        {
            if (!CrossConnectivity.Current.IsConnected)
            {
                EventAggregator.GetEvent <OfflineEvent>().Publish();
                return;
            }

            Logger.Log(DevopenspaceLoggerKeys.ManualSync, Category.Info, Priority.High);

            SyncText = "Syncing...";

            try
            {
                Settings.HasSyncedData = true;
                Settings.LastSync      = DateTime.UtcNow;
                OnPropertyChanged("LastSyncDisplay");

                await StoreManager.SyncAllAsync(Settings.Current.IsLoggedIn);

                if (!Settings.Current.IsLoggedIn)
                {
                    await PageDialogService.DisplayAlertAsync("Developer Open Space Data Synced",
                                                              "You now have the latest conference data, however to sync your favorites you must sign in with your Twitter account.",
                                                              "OK");
                }
            }
            catch (Exception ex)
            {
                ex.Data["method"] = "ExecuteSyncCommandAsync";
                EventAggregator.GetEvent <ErrorEvent>().Publish(ex);
                Logger.Log(ex.Message, Category.Exception, Priority.High);
            }
            finally
            {
                SyncText = "Last sync";
            }
        }
Ejemplo n.º 25
0
        private async void OnConfirmGoBackCommand(object obj)
        {
            if (IsBusyBindProp)
            {
                return;
            }

            IsBusyBindProp = true;

            var flagCanGoBack = false;

            if (ShowConfirmGoBack)
            {
                var resultConfirm = await PageDialogService.DisplayAlertAsync("Xác nhận", "Bạn có chắc muốn thoát khỏi màn hình này quay trở về?", "Có", "Không");

                if (resultConfirm)
                {
                    flagCanGoBack = true;
                }
            }
            else
            {
                flagCanGoBack = true;
            }

            if (flagCanGoBack)
            {
                var navParam       = new NavigationParameters();
                var handleOnGoBack = await OnGoBackCommandAsync(obj, navParam);

                if (handleOnGoBack)
                {
                    await NavigationService.GoBackAsync(navParam);
                }
            }

            IsBusyBindProp = false;
        }
Ejemplo n.º 26
0
        public async Task GetCollection()
        {
            try
            {
                Loading = LoadStatus.Loading;
                var results = await _gazetteService.GetAllCountries();

                if (results != null && results.Results.Count >= 1)
                {
                    Loading        = LoadStatus.None;
                    CollectionList = new ObservableCollection <GazetteResult>(results.Results);
                }
                else
                {
                    Loading = LoadStatus.Empty;
                }
            }
            catch (Exception ex)
            {
                Loading = LoadStatus.Empty;
                await PageDialogService.DisplayAlertAsync(Dialog.Error, ex.Message, Dialog.Ok);
            }
        }
Ejemplo n.º 27
0
        private async Task LoadAsync(int page = 1)
        {
            try
            {
                IsBusy = true;

                var tanques = await _FishTechService.GetTanquesAsync(page);


                foreach (var tanque in tanques.Results)
                {
                    Tanques.Add(tanque);
                }
            }
            catch (Exception ex)
            {
                await PageDialogService.DisplayAlertAsync("Erro", "Error on Load Movies:" + ex.Message, "OK");
            }
            finally
            {
                IsBusy = false;
            }
        }
Ejemplo n.º 28
0
        async void ExecuteSignUpCommand()
        {
            await _database.SaveUserAsync(CurrentUser);

            LoginService service         = new LoginService();
            var          getLoginDetails = await service.CheckLoginIfExists(CurrentUser.Email, CurrentUser.Password);


            if (CurrentUser.FirstName == null && CurrentUser.LastName == null && CurrentUser.Email == null && CurrentUser.Password == null && CurrentUser.ConfirmPassword == null)
            {
                await PageDialogService.DisplayAlertAsync("Register Successfull", "Enter your details", "Okay", "Cancel");
            }
            else if (CurrentUser.FirstName == null && CurrentUser.Password == null)
            {
                await PageDialogService.DisplayAlertAsync("Registration failed", "Already have an account", "Okay", "Cancel");
            }
            else
            {
                await PageDialogService.DisplayAlertAsync("Registration successful", "Enjoy", "Okay", "Cancel");

                await NavigationService.NavigateAsync("LoginPage");
            }
        }
Ejemplo n.º 29
0
        private async Task OnBancoLocal()
        {
            if (GetListaLocal().Count == 0)
            {
                var resp1 = await PageDialogService.DisplayAlertAsync("Alerta", "Deseja salvar lista no banco local?", "Sim", "Não");

                if (resp1 == true)
                {
                    _dataBaseHelper.SalvarNoBancoLocalHelper();
                    Init();
                    return;
                }
            }

            var resp2 = await PageDialogService.DisplayAlertAsync("Alerta", "Deseja Excluir a lista do banco local?", "Sim", "Não");

            if (resp2 == true)
            {
                _dataBaseHelper.DeletarListaLocalHelper();
                Lista.Clear();
                Init();
            }
        }
Ejemplo n.º 30
0
        public async Task GetPublicstions()
        {
            try
            {
                Loading = LoadStatus.Loading;
                var results = await _gazetteService.FacetSearch("publication_date", Convert.ToInt32(SelectedGazette.Id));

                if (results != null && results.Results.Count >= 1)
                {
                    Loading = LoadStatus.None;
                    PublicationDatesList = new ObservableCollection <Value>(results.Facets.PublicationDate.Values);
                }
                else
                {
                    Loading = LoadStatus.Empty;
                }
            }
            catch (Exception ex)
            {
                Loading = LoadStatus.Empty;
                await PageDialogService.DisplayAlertAsync(Dialog.Error, ex.Message, Dialog.Ok);
            }
        }