Ejemplo n.º 1
0
        private async void UploadImage()
        {
            if (CrossConnectivity.Current.IsConnected)
            {
                IsBusy = true;
                await UserHandler.FileUpload(SelectedFile.GetStream(),
                                             (Response) => {
                    Debug.WriteLine("Success");
                    IsBusy = false;
                },

                                             (error) => {
                    NavigationHandler.GlobalNavigator.DisplayAlert(Constants.APP_NAME, Constants.ServerUnSuccess, Constants.OK_TEXT);
                    IsBusy = false;
                });
            }
            else
            {
                NavigationHandler.GlobalNavigator.DisplayAlert(Constants.APP_NAME, Constants.NETWORK_ERROR, Constants.OK_TEXT);
            }
        }
Ejemplo n.º 2
0
        private async Task GetProfileInfo()
        {
            if (CrossConnectivity.Current.IsConnected)
            {
                IsBusy = true;
                await UserHandler.GetProfile(App.UserName,
                                             (responseProfile) => {
                    this._userProfile = responseProfile.ProfileInfo;
                    SetProfileInfo();
                    IsBusy = false;
                },
                                             (errorResponseProfile) => {
                    NavigationHandler.LoginNavigator.DisplayAlert(Constants.APP_NAME, Constants.UpdateUnSuccess, Constants.OK_TEXT);
//						Debug.WriteLine ("Error:: /nCode: " + errorResponseProfile.ResponseCode + "/nMessage: " + errorResponseProfile.Status);
                    IsBusy = false;
                });
            }
            else
            {
                NavigationHandler.LoginNavigator.DisplayAlert(Constants.APP_NAME, Constants.NETWORK_ERROR, Constants.OK_TEXT);
            }
        }
Ejemplo n.º 3
0
 private async void GetProfileInfo()
 {
     if (CrossConnectivity.Current.IsConnected)
     {
         IsBusy = true;
         await UserHandler.GetProfile(App.UserName,
                                      (responseProfile) => {
             this._userProfile    = responseProfile.ProfileInfo;
             App.UserProfileImage = _userProfile.PersonalInfo.ProfileImage;
             SetProfileInfo();
             IsBusy = false;
         },
                                      (errorResponseProfile) => {
             NavigationHandler.GlobalNavigator.DisplayAlert(Constants.APP_NAME, Constants.ServerUnSuccess, Constants.OK_TEXT);
             IsBusy = false;
         });
     }
     else
     {
         NavigationHandler.LoginNavigator.DisplayAlert(Constants.APP_NAME, Constants.NETWORK_ERROR, Constants.OK_TEXT);
     }
 }
Ejemplo n.º 4
0
 public async void DoLogin()
 {
     if (IsValidData())
     {
         if (CrossConnectivity.Current.IsConnected)
         {
             IsBusy = true;
             if (!App.IsRegistered)
             {
                 DeviceInfoHandler.UpdateDeviceInfo((response) =>
                 {
                     Debug.WriteLine("Device info updated.");
                     App.IsRegistered = true;
                 });
             }
             await UserHandler.GetLogin(UserName, Password,
                                        (response) => {
                 try {
                     Debug.WriteLine("success:" + response.UniqueAppId);
                     App.UserName    = UserName;
                     App.UniqueAppId = response.UniqueAppId;
                     Settings.Local.Set("IsLogin", true);
                     IsBusy = false;
                     // NavigationHandler.GlobalNavigator.Navigation.PopAsync(); //Navigate to main page after successful login
                     SetupUpdatePwdPage _ChangePassword = new SetupUpdatePwdPage();
                     _ChangePassword.BindingContext     = new ProfileViewModel();
                     NavigationHandler.LoginNavigator.Navigation.PushAsync(_ChangePassword);      //navigate to update password page
                 } catch (Exception e) {
                     Debug.WriteLine("Exception is " + e.Message + " \n source: " + e.Source + " call stack :" + e.StackTrace);
                 }
             },
                                        (errorResponse) => {
                 NavigationHandler.LoginNavigator.DisplayAlert(Constants.APP_NAME, Constants.LoginUnSuccess, Constants.OK_TEXT);
                 IsBusy = false;
             });
         }
         else
         {
             NavigationHandler.LoginNavigator.DisplayAlert(Constants.APP_NAME, Constants.NETWORK_ERROR, Constants.OK_TEXT);
         }
     }
     else
     {
         if (string.IsNullOrEmpty(UserName) && string.IsNullOrEmpty(Password))
         {
             ErrorColor = Color.Red;
             ValidColor = Color.Red;
         }
         else if (string.IsNullOrEmpty(Password))
         {
             ErrorColor = Color.Red;
         }
         else if (string.IsNullOrEmpty(UserName))
         {
             ValidColor = Color.Red;
         }
         else
         {
             ValidColor = Color.FromRgb(97, 97, 97);
             ErrorColor = Color.FromRgb(97, 97, 97);
         }
         NavigationHandler.LoginNavigator.DisplayAlert(Constants.APP_NAME, Constants.InSuccess, Constants.OK_TEXT);
     }
 }