private void deletePetButton_ClickedAsync(object sender, EventArgs e) { Task.Run(() => { DisableOrEnableButtons(false); string success = GlobalVariables.updatePetFragmentViewModel.DeletePet(petid); if (!string.IsNullOrEmpty(success)) { Device.BeginInvokeOnMainThread(() => { DisplayAlert(English.Failed(), success, English.OK()); }); } else { Device.BeginInvokeOnMainThread(() => { GlobalEvents.OnProfilePictureUpdated_Event(this, null); Navigation.PopToRootAsync(); }); } DisableOrEnableButtons(true); }); }
private async void galleryButton_ClickedAsync(object sender, EventArgs e) { if (!CrossMedia.Current.IsPickPhotoSupported) { await DisplayAlert(English.Failed(), English.NoPicking(), English.OK()); return; } pictureImage.IsVisible = true; var file = await CrossMedia.Current.PickPhotoAsync(); if (file == null) { return; } addedPhoto = true; f = file.GetStream(); GlobalVariables.SourceSelectedImageFromGallery = file.Path; GlobalVariables.SelectedImageFromGallery = f; pictureImage.Source = ImageSource.FromStream(() => f); }
private async System.Threading.Tasks.Task followButton_ClickedAsync(object sender, EventArgs e) { if (HaveIAlreadyFollow) { string success = GlobalVariables.petProfileFragmentViewModel.UnFollow(GlobalVariables.ActualUsersEmail, petid); HaveIAlreadyFollow = !HaveIAlreadyFollow; if (!String.IsNullOrEmpty(success)) { await DisplayAlert(English.Failed(), success, English.OK()); } else { followButton.Text = GlobalVariables.petProfileFragmentViewModel.followText; } } else { string success = GlobalVariables.petProfileFragmentViewModel.FollowAPet(GlobalVariables.ActualUsersEmail, petid); HaveIAlreadyFollow = !HaveIAlreadyFollow; if (!String.IsNullOrEmpty(success)) { await DisplayAlert(English.Failed(), success, English.OK()); } else { followButton.Text = GlobalVariables.petProfileFragmentViewModel.unfollowText; } } }
private async Task galleryButton_ClickedAsync(object sender, EventArgs e) { if (!CrossMedia.Current.IsPickPhotoSupported) { await DisplayAlert(English.Failed(), English.NoPicking(), English.OK()); return; } var file = await CrossMedia.Current.PickPhotoAsync(); GlobalVariables.mediaFile = file; if (file == null) { return; } GlobalVariables.f = file.GetStream(); GlobalVariables.pathf = file.Path; pictureImage.Source = ImageSource.FromStream(() => file.GetStream()); asdx = true; }
private async void deleteAcoountPageButton_ClickedAsync(object sender, EventArgs e) { var action = await DisplayActionSheet("Delete account", "Are you sure?", "Cancel", "Delete"); if (action == "Delete") { loguotButton.IsEnabled = false; deleteAcoountPageButton.IsEnabled = false; deleteActivity.IsRunning = true; string success = GlobalVariables.otherFragmentViewModel.DeleteAccount(); if (!String.IsNullOrEmpty(success)) { await DisplayAlert(English.Failed(), success, English.OK()); } else { await SecureStorage.SetAsync(GlobalVariables.EMAIL_TOKEN, string.Empty); App.SetRootPage(new LoginPage()); } loguotButton.IsEnabled = true; deleteAcoountPageButton.IsEnabled = true; deleteActivity.IsRunning = false; } }
private void loginButton_Clicked(object sender, EventArgs e) { Task.Run(() => { Device.BeginInvokeOnMainThread(() => { loginButton.IsEnabled = false; loginActivator.IsRunning = true; }); string success = GlobalVariables.loginPageViewModel.Login(emailEntry.Text, pwEntry.Text); if (!String.IsNullOrEmpty(success)) { Device.BeginInvokeOnMainThread(() => DisplayAlert(English.Failed(), success, English.OK()) ); } else { Device.BeginInvokeOnMainThread(() => { SecureStorage.SetAsync(GlobalVariables.EMAIL_TOKEN, emailEntry.Text.ToLower()); App.SetRootPage(new JustActivityIndicator("login")); }); } Device.BeginInvokeOnMainThread(() => { loginButton.IsEnabled = true; loginActivator.IsRunning = false; }); }); }
private void changepwButton_ClickedAsync(object sender, EventArgs e) { Task.Run(() => { DisableOrEnableButtons(false); string success = GlobalVariables.updateProfileFragmentViewModel.UpdatePassword(pwEntry.Text, newpwEntry.Text); if (!String.IsNullOrEmpty(success)) { Device.BeginInvokeOnMainThread(() => { DisplayAlert(English.Failed(), success, English.OK()); }); } else { Device.BeginInvokeOnMainThread(() => { DisplayAlert(English.Successful(), English.Successful(), English.OK()); }); } DisableOrEnableButtons(true); }); }
private async System.Threading.Tasks.Task deleteAcoountPageButton_ClickedAsync(object sender, EventArgs e) { loguotButton.IsEnabled = false; deleteAcoountPageButton.IsEnabled = false; deleteActivity.IsRunning = true; string success = GlobalVariables.otherFragmentViewModel.DeleteAccount(); if (!String.IsNullOrEmpty(success)) { await DisplayAlert(English.Failed(), success, English.OK()); } else { FileStoreAndLoading.InsertToFile(GlobalVariables.logintxt, String.Empty); var page = new LoginPage(); await Navigation.PushModalAsync(new NavigationPage(page) { Style = GlobalVariables.NavigationPageStyle }); } loguotButton.IsEnabled = true; deleteAcoountPageButton.IsEnabled = true; deleteActivity.IsRunning = false; }
private void updateMyProfileButton_ClickedAsync(object sender, EventArgs e) { Task.Run(() => { DisableOrEnableButtons(false); string success = GlobalVariables.updateProfileFragmentViewModel.UpdateProfile(firstnameEntry.Text, lastnameEntry.Text); if (!String.IsNullOrEmpty(success)) { Device.BeginInvokeOnMainThread(() => { DisplayAlert(English.Failed(), success, English.OK()); }); } else { GlobalVariables.IsUpdatedMyProfile = true; GlobalEvents.OnProfileUpdated_Event(this, null); Device.BeginInvokeOnMainThread(() => { DisplayAlert(English.Successful(), English.Successful(), English.OK()); }); } DisableOrEnableButtons(true); }); }
private void changeProfilePictureButton_ClickedAsync(object sender, EventArgs e) { Task.Run(() => { DisableOrEnableButtons(false); string success = GlobalVariables.updateProfileFragmentViewModel.UpdateProfilePicture(addedPhoto); if (!string.IsNullOrEmpty(success)) { Device.BeginInvokeOnMainThread(() => { DisplayAlert(English.Failed(), success, English.OK()); }); } else { addedPhoto = false; GlobalVariables.ActualUser.ProfilePicture = new Segédfüggvények().ReadFully(f); GlobalEvents.OnProfilePictureUpdated_Event(this, null); Device.BeginInvokeOnMainThread(() => { DisplayAlert(English.Successful(), English.Successful(), English.OK()); }); } DisableOrEnableButtons(true); }); }
private async Task addPhotoButton_ClickedAsync(object sender, EventArgs e) { uploadActivity.IsRunning = true; addPhotoButton.IsEnabled = false; galleryButton.IsEnabled = false; string success = await GlobalVariables.uploadPhotoFragmentViewModel.UploadPictureAsync(GlobalVariables.pathf, GlobalVariables.f, selectedPetId, hashtagsEntry.Text); if (!String.IsNullOrEmpty(success)) { await DisplayAlert(English.Failed(), success, English.OK()); } else { GlobalVariables.AddedPhoto = true; await Navigation.PopToRootAsync(); await Navigation.PushAsync(new SeeMyPetProfile(selectedPetId)); } galleryButton.IsEnabled = true; addPhotoButton.IsEnabled = true; uploadActivity.IsRunning = false; }
private void changeProfilePictureButton_Clicked(object sender, EventArgs e) { Task.Run(() => { DisableOrEnableButtons(false); string success = GlobalVariables.updatePetFragmentViewModel.UpdatePetProfilePictureAsync(addedPhoto, thisPet, f); if (!string.IsNullOrEmpty(success)) { Device.BeginInvokeOnMainThread(() => { DisplayAlert(English.Failed(), success, English.OK()); }); } else { addedPhoto = false; Device.BeginInvokeOnMainThread(() => { DisplayAlert(English.Successful(), English.Successful(), English.OK()); }); } DisableOrEnableButtons(true); }); }
private async void signupButton_Clicked(object sender, EventArgs e) { User user = new User() { Email = emailEntry.Text, Password = pwEntry.Text, FirstName = firstnameEntry.Text, LastName = lastnameEntry.Text, FacebookId = facebookProfile.Id, ProfilePictureURL = GlobalVariables.pathf }; if (GlobalVariables.f is null) { user.ProfilePictureURL = GlobalVariables.pathf; } else { user.ProfilePictureURL = await GlobalVariables.signupPageViewModel.UploadFileAsync(GlobalVariables.pathf, GlobalVariables.f); } string success = await GlobalVariables.signupPageViewModel.SignUpAsync(user); if (!String.IsNullOrEmpty(success)) { await DisplayAlert(English.Failed(), success, English.OK()); } else { GlobalVariables.ActualUser = user; GlobalVariables.ActualUsersEmail = user.Email; await Navigation.PopToRootAsync(); } }
private async void likeOrNotButton_ClickedAsync(object sender, EventArgs e) { if (haveiliked) { var success = GlobalVariables.seePictureFragmentViewModel.UnLikeClick(petpictures.id); if (!String.IsNullOrEmpty(success)) { await DisplayAlert(English.Failed(), success, English.OK()); } else { howmanylike = howmanylike - 1; Device.BeginInvokeOnMainThread(() => { howmanyLikesLabel.Text = howmanylike.ToString() + English.GetLike(); }); haveiliked = !haveiliked; Device.BeginInvokeOnMainThread(() => { likeornotImage.Source = GlobalVariables.likepng; }); } } else { string success = GlobalVariables.seePictureFragmentViewModel.LikeClick(petpictures.id); if (!String.IsNullOrEmpty(success)) { await DisplayAlert(English.Failed(), success, English.OK()); } else { howmanylike = howmanylike + 1; Device.BeginInvokeOnMainThread(() => { howmanyLikesLabel.Text = howmanylike.ToString() + English.GetLike(); }); haveiliked = !haveiliked; Device.BeginInvokeOnMainThread(() => { likeornotImage.Source = GlobalVariables.unlikepng; }); } } }
private void changePetButton_ClickedAsync(object sender, EventArgs e) { Task.Run(() => { DisableOrEnableButtons(false); bool isChecked = shelterpetSwitch.IsToggled; int isCheckedToInt = 1; if (isChecked) { isCheckedToInt = 0; } Pet pet = new Pet(); pet = thisPet; pet.HaveAnOwner = isCheckedToInt; if (!string.IsNullOrEmpty(nameEntry.Text)) { pet.Name = nameEntry.Text; } pet.Age = ageDatePicker.Date; if (!string.IsNullOrEmpty(typeEntry.Text)) { pet.PetType = typeEntry.Text; } string success = GlobalVariables.updatePetFragmentViewModel.UpdatePetProfile(pet); if (!string.IsNullOrEmpty(success)) { Device.BeginInvokeOnMainThread(() => { DisplayAlert(English.Failed(), success, English.OK()); }); } else { Device.BeginInvokeOnMainThread(() => { DisplayAlert(English.Successful(), English.Successful(), English.OK()); }); } DisableOrEnableButtons(true); }); }
private async void sendNewPassword_ClickedAsync(object sender, EventArgs e) { var success = await GlobalVariables.forgotPasswordPageViewModel.SendEmailAsync(emailEntry.Text); if (string.IsNullOrEmpty(success)) { await Navigation.PopToRootAsync(); } else { await DisplayAlert(English.Failed(), success, English.OK()); } }
private async void deletePetButton_ClickedAsync(object sender, EventArgs e) { string success = GlobalVariables.updatePetFragmentViewModel.DeletePet(petid); if (!String.IsNullOrEmpty(success)) { await DisplayAlert(English.Failed(), success, English.OK()); } else { await Navigation.PopToRootAsync(); } }
private async void changeProfilePictureButton_Clicked(object sender, EventArgs e) { string success = await GlobalVariables.updatePetFragmentViewModel.UpdatePetProfilePictureAsync(thisPet, GlobalVariables.f, GlobalVariables.pathf); if (!String.IsNullOrEmpty(success)) { await DisplayAlert(English.Failed(), success, English.OK()); } else { await Navigation.PopAsync(); } }
private async Task addPetButton_ClickedAsync(object sender, EventArgs e) { uploadActivity.IsRunning = true; addPetButton.IsEnabled = false; galleryButton.IsEnabled = false; bool isChecked = shelterpetSwitch.IsToggled; int isCheckedToInt = 1; if (isChecked) { isCheckedToInt = 0; } int age; try { age = Convert.ToInt32(ageEntry.Text); } catch (Exception) { await DisplayAlert(English.Failed(), English.YouHaveToFillAllEntries(), English.OK()); return; } Pet pet = new Pet() { Name = nameEntry.Text, Age = age, PetType = typeEntry.Text, HaveAnOwner = isCheckedToInt }; string success = await GlobalVariables.addpetFragmentViewModel.AddPetAsync(GlobalVariables.pathf, GlobalVariables.f, pet); if (!String.IsNullOrEmpty(success)) { await DisplayAlert(English.Failed(), success, English.OK()); } else { await Navigation.PopAsync(); } galleryButton.IsEnabled = true; addPetButton.IsEnabled = true; uploadActivity.IsRunning = false; }
private async void changePetButton_ClickedAsync(object sender, EventArgs e) { bool isChecked = shelterpetSwitch.IsToggled; int isCheckedToInt = 1; if (isChecked) { isCheckedToInt = 0; } int age; if (String.IsNullOrEmpty(ageEntry.Text)) { age = -1; } else { age = Convert.ToInt32(ageEntry.Text); } Pet pet = new Pet(); pet = thisPet; pet.HaveAnOwner = isCheckedToInt; if (!String.IsNullOrEmpty(nameEntry.Text)) { pet.Name = nameEntry.Text; } if (age != -1) { pet.Age = age; } if (!String.IsNullOrEmpty(typeEntry.Text)) { pet.PetType = typeEntry.Text; } string success = GlobalVariables.updatePetFragmentViewModel.UpdatePetProfile(pet); if (!String.IsNullOrEmpty(success)) { await DisplayAlert(English.Failed(), success, English.OK()); } else { await Navigation.PopAsync(); } }
private async Task deleteButton_ClickedAsync(object sender, EventArgs e) { if (!GlobalVariables.seePictureFragmentViewModel.DeletePicture(this.petpictures)) { await DisplayAlert(English.Failed(), English.SomethingWentWrong(), English.OK()); } else { GlobalVariables.IsPictureDeleted = true; await Navigation.PopToRootAsync(); await DisplayAlert(English.Successful(), English.SuccessfulDeletedThePicture(), English.OK()); } }
private async void MoreToolbarItem_Activated(object sender, EventArgs e) { var reported = await DisplayActionSheet("More", "Cancel", null, followOrNot, "Go to owner profile"); if (reported == followOrNot) { if (HaveIAlreadyFollow) { string success = GlobalVariables.petProfileFragmentViewModel.UnFollow(GlobalVariables.ActualUsersEmail, petid); HaveIAlreadyFollow = !HaveIAlreadyFollow; if (!string.IsNullOrEmpty(success)) { GlobalEvents.OnUnFollowUser_Event(this, null); await DisplayAlert(English.Failed(), success, English.OK()); } else { followOrNot = GlobalVariables.petProfileFragmentViewModel.followText; } } else { string success = GlobalVariables.petProfileFragmentViewModel.FollowAPet(GlobalVariables.ActualUsersEmail, petid); HaveIAlreadyFollow = !HaveIAlreadyFollow; if (!string.IsNullOrEmpty(success)) { GlobalEvents.OnUnFollowUser_Event(this, null); await DisplayAlert(English.Failed(), success, English.OK()); } else { followOrNot = GlobalVariables.petProfileFragmentViewModel.unfollowText; } } } else if (reported == "Go to owner profile") { await Navigation.PushAsync(new SeeAnOwnerPage(thisPet.Uploader)); } }
public async void OnDelete(object sender, EventArgs e) { var mi = ((MenuItem)sender); var cp = ((ListViewWithPictureAndSomeText)mi.CommandParameter); var success = GlobalVariables.blockedPeopleViewModel.DeleteBlockedPeople(cp.blockedPeople); if (!string.IsNullOrEmpty(success)) { DisplayAlert(English.Failed(), success, English.OK()); } else { await InitializeBlockedUserList(); } }
private async Task changeProfilePictureButton_ClickedAsync(object sender, EventArgs e) { changeProfilePictureButton.IsEnabled = false; string success = await GlobalVariables.updateProfileFragmentViewModel.UpdateProfilePicture(GlobalVariables.pathf, GlobalVariables.f); if (!String.IsNullOrEmpty(success)) { await DisplayAlert(English.Failed(), success, English.OK()); } else { await Navigation.PopAsync(); } changeProfilePictureButton.IsEnabled = true; }
private async Task changepwButton_ClickedAsync(object sender, EventArgs e) { changepwButton.IsEnabled = false; string success = GlobalVariables.updateProfileFragmentViewModel.UpdatePassword(pwEntry.Text, newpwEntry.Text); if (!String.IsNullOrEmpty(success)) { await DisplayAlert(English.Failed(), success, English.OK()); } else { await Navigation.PopAsync(); } changepwButton.IsEnabled = true; }
private void addPetButton_ClickedAsync(object sender, EventArgs e) { Task.Run(() => { DisableOrEnableButtons(false); bool isChecked = shelterpetSwitch.IsToggled; int isCheckedToInt = 1; if (isChecked) { isCheckedToInt = 0; } Pet pet = new Pet() { Name = nameEntry.Text, Age = ageDatePicker.Date, PetType = typeEntry.Text, HaveAnOwner = isCheckedToInt }; string success = GlobalVariables.addpetFragmentViewModel.AddPetAsync(addedPhoto, f, pet); if (!string.IsNullOrEmpty(success)) { Device.BeginInvokeOnMainThread(() => { DisplayAlert(English.Failed(), success, English.OK()); }); } else { addedPhoto = false; GlobalEvents.OnPetAdded_Event(this, null); Device.BeginInvokeOnMainThread(() => { Navigation.PopAsync(); }); } DisableOrEnableButtons(true); }); }
private async void updateMyProfileButton_ClickedAsync(object sender, EventArgs e) { updateMyProfileButton.IsEnabled = false; string success = GlobalVariables.updateProfileFragmentViewModel.UpdateProfile(firstnameEntry.Text, lastnameEntry.Text); if (!String.IsNullOrEmpty(success)) { await DisplayAlert(English.Failed(), success, English.OK()); } else { GlobalVariables.IsUpdatedMyProfile = true; await Navigation.PopAsync(); } updateMyProfileButton.IsEnabled = true; }
private void loginButton_Clicked(object sender, EventArgs e) { loginButton.IsEnabled = false; string success = GlobalVariables.loginPageViewModel.Login(emailEntry.Text, pwEntry.Text); if (!String.IsNullOrEmpty(success)) { Device.BeginInvokeOnMainThread(() => loginActivator.IsRunning = false); DisplayAlert(English.Failed(), success, English.OK()); } else { FileStoreAndLoading.InsertToFile(GlobalVariables.logintxt, emailEntry.Text); Navigation.PushModalAsync(new NotPrimaryPages.JustActivityIndicator("login")); } loginButton.IsEnabled = true; }
private async void addPhotoButton_ClickedAsync(object sender, EventArgs e) { Device.BeginInvokeOnMainThread(() => { uploadActivity.IsRunning = true; addPhotoButton.IsEnabled = false; galleryButton.IsEnabled = false; }); await Task.Run(() => { string success = GlobalVariables.uploadPhotoFragmentViewModel.UploadPictureAsync(addedPhoto, f, selectedPetId, hashtagsEntry.Text); if (!string.IsNullOrEmpty(success)) { Device.BeginInvokeOnMainThread(() => { DisplayAlert(English.Failed(), success, English.OK()); }); } else { GlobalVariables.AddedPhoto = true; addedPhoto = false; Device.BeginInvokeOnMainThread(() => { Navigation.PopToRootAsync(); Navigation.PushAsync(new SeeMyPetProfile(selectedPetId)); }); } Device.BeginInvokeOnMainThread(() => { galleryButton.IsEnabled = true; addPhotoButton.IsEnabled = true; uploadActivity.IsRunning = false; }); }); }
private async void MoreToolbarItem_Activated(object sender, EventArgs e) { var reported = await DisplayActionSheet("More", "Cancel", "Delete"); if (reported == "Delete") { await Task.Run(async() => { if (!GlobalVariables.seePictureFragmentViewModel.DeletePicture(this.petpictures)) { await DisplayAlert(English.Failed(), English.SomethingWentWrong(), English.OK()); } else { GlobalVariables.IsPictureDeleted = true; await Navigation.PopToRootAsync(); await DisplayAlert(English.Successful(), English.SuccessfulDeletedThePicture(), English.OK()); } }); } }