private async void SaveProfileSpotify() { if (string.IsNullOrEmpty(this.Name)) { await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.NameValidation, Languages.Accept); return; } if (string.IsNullOrEmpty(this.Link)) { await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.LinkValidation, Languages.Accept); return; } if (!RegexUtilities.IsValidURL(this.Link)) { await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.LinkValidation, Languages.Accept); return; } this.IsRunning = true; this.IsEnabled = false; var checkConnetion = await this.apiService.CheckConnection(); if (!checkConnetion.IsSuccess) { this.IsRunning = false; this.IsEnabled = true; await Application.Current.MainPage.DisplayAlert( Languages.Error, checkConnetion.Message, Languages.Accept); return; } var mainViewModel = MainViewModel.GetInstance(); var profileSpotify = new ProfileSM { ProfileName = this.Name, link = this.Link, UserId = mainViewModel.User.UserId, Exist = false, RedSocialId = 8 }; var apiSecurity = Application.Current.Resources["APISecurity"].ToString(); var profileSM = await this.apiService.Post( apiSecurity, "/api", "/ProfileSMs", profileSpotify); if (profileSM == default) { this.IsRunning = false; this.IsEnabled = true; await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.ErrorAddProfile, Languages.Accept); return; } var ProfileLocal = new Profile { UserId = mainViewModel.User.UserId, ProfileName = profileSM.ProfileName, value = profileSM.link, ProfileType = "Spotify", Logo = "spotify2", ProfileId = profileSM.ProfileMSId, }; using (var conn = new SQLite.SQLiteConnection(App.root_db)) { conn.CreateTable <Profile>(); conn.Insert(ProfileLocal); } this.IsRunning = false; this.IsEnabled = true; //Agregar a la lista if (mainViewModel.ProfilesBYPESM != null) { mainViewModel.ProfilesBYPESM.addProfileSM(profileSM); mainViewModel.ListOfNetworks.addProfileSM(profileSM); } else { mainViewModel.ProfilesBySpotify.addProfile(profileSM); } this.Name = string.Empty; this.Link = string.Empty; if (mainViewModel.ProfilesBYPESM != null) { await PopupNavigation.Instance.PopAsync(); } else { await App.Navigator.PopAsync(); } }
public ImageSizeViewModel() { User = MainViewModel.GetInstance().User; }
private async void GotoGIF() { MainViewModel.GetInstance().GIF = new GifViewModel("Spotify"); await PopupNavigation.Instance.PushAsync(new GifPage()); }
private async void SaveProfileWhatsApp() { if (string.IsNullOrEmpty(this.Name)) { await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.NameValidation, Languages.Accept); return; } if (string.IsNullOrEmpty(this.Number)) { await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.NumberValidation, Languages.Accept); return; } if (!(this.Number).ToCharArray().All(Char.IsDigit)) { await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.NumberValidation, Languages.Accept); return; } if (this.Number.Length != 10) { await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.PhoneValidation2, Languages.Accept); return; } this.IsRunning = true; this.IsEnabled = false; var checkConnetion = await this.apiService.CheckConnection(); if (!checkConnetion.IsSuccess) { this.IsRunning = false; this.IsEnabled = true; await Application.Current.MainPage.DisplayAlert( Languages.Error, checkConnetion.Message, Languages.Accept); return; } var mainViewModel = MainViewModel.GetInstance(); var profileWhatsApp = new ProfileWhatsapp { Name = this.Name, Number = this.Number, UserId = mainViewModel.User.UserId, Exist = false }; var apiSecurity = Application.Current.Resources["APISecurity"].ToString(); var profileWhatsapp = await this.apiService.Post( apiSecurity, "/api", "/ProfileWhatsapps", profileWhatsApp); if (profileWhatsapp == default) { this.IsRunning = false; this.IsEnabled = true; await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.ErrorAddProfile, Languages.Accept); return; } var ProfileLocal = new Profile { UserId = mainViewModel.User.UserId, ProfileName = profileWhatsApp.Name, value = profileWhatsApp.Number, ProfileType = "Whatsapp", Logo = "whatsapp2", ProfileId = profileWhatsApp.ProfileWhatsappId, }; using (var conn = new SQLite.SQLiteConnection(App.root_db)) { conn.CreateTable <Profile>(); conn.Insert(ProfileLocal); } this.IsRunning = false; this.IsEnabled = true; //Agregar a la lista if (mainViewModel.ProfilesBYPESM != null) { mainViewModel.ProfilesBYPESM.addProfileWhatsapp(profileWhatsapp); mainViewModel.ListOfNetworks.addProfileWhatsapp(profileWhatsapp); } else { mainViewModel.Profiles.addProfileWhatsapp(profileWhatsapp); } this.Name = string.Empty; this.Number = string.Empty; if (mainViewModel.ProfilesBYPESM != null) { await PopupNavigation.Instance.PopAsync(); } else { await App.Navigator.PopAsync(); } }
private void GotoAdd() { PopupNavigation.Instance.PopAsync(); MainViewModel.GetInstance().ProfileTypeSelection = new ProfileTypeSelectionViewModel(Box.BoxId); PopupNavigation.Instance.PushAsync(new ProfileTypeSelection(Box.BoxId, Box.BoxDefault, Box.Name)); }
private async void Register() { if (string.IsNullOrEmpty(this.FirstName)) { await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.FirstNameValidation, Languages.Accept); return; } if (string.IsNullOrEmpty(this.LastName)) { await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.LastNameValidation, Languages.Accept); return; } if (string.IsNullOrEmpty(this.Email)) { await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.EmailValidation, Languages.Accept); return; } if (!RegexUtilities.IsValidEmail(this.Email)) { await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.EmailValidation2, Languages.Accept); return; } if (string.IsNullOrEmpty(this.Password)) { await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.PasswordValidation, Languages.Accept); return; } if (this.Password.Length < 6) { await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.PasswordValidation2, Languages.Accept); return; } if (string.IsNullOrEmpty(this.Confirm)) { await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.ConfirmValidation, Languages.Accept); return; } if (this.Password != this.Confirm) { await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.ConfirmValidation2, Languages.Accept); return; } this.IsRunning = true; this.IsEnabled = false; var checkConnetion = await this.apiService.CheckConnection(); if (!checkConnetion.IsSuccess) { this.IsRunning = false; this.IsEnabled = true; await Application.Current.MainPage.DisplayAlert( Languages.Error, checkConnetion.Message, Languages.Accept); return; } byte[] imageArray = null; if (this.file != null) { imageArray = FilesHelper.ReadFully(this.file.GetStream()); } var user = new User { Email = this.Email, FirstName = this.FirstName, LastName = this.LastName, ImageArray = imageArray, UserTypeId = 1, Password = this.Password, }; var apiSecurity = Application.Current.Resources["APISecurity"].ToString(); var exists = await this.apiService.GetUserByEmail( apiSecurity, "/api", "/Users/GetUserByEmail", this.Email); if (exists != null) { this.IsRunning = false; this.IsEnabled = true; await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.WrongEmail, Languages.Accept); return; } var response = await this.apiService.Post2( apiSecurity, "/api", "/Users", user); if (!response.IsSuccess) { this.IsRunning = false; this.IsEnabled = true; await Application.Current.MainPage.DisplayAlert( Languages.Error, response.Message, Languages.Accept); return; } this.IsRunning = false; this.IsEnabled = true; await Application.Current.MainPage.DisplayAlert( Languages.ConfirmLabel, Languages.UserRegisteredMessage, Languages.Accept); var mainViewModel = MainViewModel.GetInstance().User; await Application.Current.MainPage.Navigation.PopAsync(); this.Email = string.Empty; this.FirstName = string.Empty; this.LastName = string.Empty; this.Password = string.Empty; this.Confirm = string.Empty; this.ImageSource = "no_image"; }
private async void Login() { try { if (string.IsNullOrEmpty(this.Email)) { await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.EmailValidation, Languages.Accept); return; } if (string.IsNullOrEmpty(this.Password)) { await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.PasswordValidation, Languages.Accept); return; } this.IsRunning = true; this.isEnabled = false; var connection = await this.apiService.CheckConnection(); if (!connection.IsSuccess) { this.IsRunning = false; this.isEnabled = true; await Application.Current.MainPage.DisplayAlert( Languages.Error, connection.Message, Languages.Accept); return; } var apiSecurity = Application.Current.Resources["APISecurity"].ToString(); var token = await this.apiService.GetToken( apiSecurity, this.Email, this.Password); if (token == null) { this.IsRunning = false; this.isEnabled = true; await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.SomethingWrong, Languages.Accept); return; } if (string.IsNullOrEmpty(token.AccessToken)) { this.IsRunning = false; this.isEnabled = true; await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.LoginError, Languages.Accept); this.Password = string.Empty; return; } var user = await this.apiService.GetUserByEmail( apiSecurity, "/api", "/Users/GetUserByEmail", token.TokenType, token.AccessToken, this.Email); var userLocal = Converter.ToUserLocal(user); userLocal.Password = this.Password; userLocal.MostrarTutorial = false; var mainViewModel = MainViewModel.GetInstance(); mainViewModel.Token = token; mainViewModel.User = userLocal; if (this.IsRemembered) { Settings.IsRemembered = "true"; } else { Settings.IsRemembered = "false"; } //Save Local User in SQLite try { using (var conn = new SQLite.SQLiteConnection(App.root_db)) { var resulForeingBox = conn.GetTableInfo("UserLocal"); if (resulForeingBox.Count < 1) { conn.CreateTable <UserLocal>(); } else { conn.DeleteAll <UserLocal>(); conn.CreateTable <UserLocal>(); } conn.Insert(userLocal); } } catch (Exception es) { Console.WriteLine(es); var error = es; } using (var conn = new SQLite.SQLiteConnection(App.root_db)) { var resulForeingBox = conn.GetTableInfo("ForeingProfile"); if (resulForeingBox.Count < 1) { conn.CreateTable <ForeingProfile>(); } } using (var conn = new SQLite.SQLiteConnection(App.root_db)) { var resulForeingBox = conn.GetTableInfo("ForeingBox"); if (resulForeingBox.Count < 1) { conn.CreateTable <ForeingBox>(); } } using (var conn = new SQLite.SQLiteConnection(App.root_db)) { var resulTokenResponse = conn.GetTableInfo("TokenResponse"); if (resulTokenResponse.Count < 1) { conn.CreateTable <TokenResponse>(); } else { conn.DeleteAll <TokenResponse>(); conn.CreateTable <TokenResponse>(); } conn.Insert(token); } using (var connSQLite = new SQLite.SQLiteConnection(App.root_db)) { var resulForeingBox = connSQLite.GetTableInfo("ForeingBox"); if (resulForeingBox.Count < 1) { connSQLite.CreateTable <ForeingBox>(); } var resulForeingProfile = connSQLite.GetTableInfo("ForeingProfile"); if (resulForeingProfile.Count < 1) { connSQLite.CreateTable <ForeingProfile>(); } } mainViewModel.Home = new HomeViewModel(); mainViewModel.Register = new RegisterViewModel(); mainViewModel.MyProfile = new MyProfileViewModel(); mainViewModel.Profiles = new ProfilesViewModel(); mainViewModel.TAG = new TAGViewModel(); mainViewModel.ListForeignBox = new ListForeignBoxViewModel(); Application.Current.MainPage = new MasterPage(); //Application.Current.MainPage = new NavigationPage(new TabbedPage1()); this.IsRunning = false; this.isEnabled = true; this.Email = string.Empty; this.Password = string.Empty; } catch (Exception e) { Console.WriteLine(e); } }
private async void Save() { if (string.IsNullOrEmpty(this.profileEmail.Name)) { await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.LastNameValidation, Languages.Accept); return; } if (string.IsNullOrEmpty(this.profileEmail.Email)) { await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.EmailValidation, Languages.Accept); return; } if (!RegexUtilities.IsValidEmail(this.profileEmail.Email)) { await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.EmailValidation2, Languages.Accept); return; } this.IsRunning = true; this.IsEnabled = false; var checkConnetion = await this.apiService.CheckConnection(); if (!checkConnetion.IsSuccess) { this.IsRunning = false; this.IsEnabled = true; await Application.Current.MainPage.DisplayAlert( Languages.Error, checkConnetion.Message, Languages.Accept); return; } var apiSecurity = Application.Current.Resources["APISecurity"].ToString(); var profile = await this.apiService.PutProfile( apiSecurity, "/api", "/ProfileEmails/PutProfileEmail", profileEmail); this.IsRunning = false; this.IsEnabled = true; //Agregar a la lista MainViewModel.GetInstance().ProfilesByEmail.updateProfile(profile); await App.Navigator.PopAsync(); }
private async void Register() { MainViewModel.GetInstance().Register = new RegisterViewModel(); await Application.Current.MainPage.Navigation.PushAsync(new RegisterPage()); }
private async void SaveBox() { if (string.IsNullOrEmpty(this.Name)) { await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.NameValidation, Languages.Accept); return; } this.IsRunning = true; this.IsEnabled = false; var checkConnetion = await this.apiService.CheckConnection(); if (!checkConnetion.IsSuccess) { this.IsRunning = false; this.IsEnabled = true; await Application.Current.MainPage.DisplayAlert( Languages.Error, checkConnetion.Message, Languages.Accept); return; } var mainViewModel = MainViewModel.GetInstance(); DateTime boxTime = DateTime.Now; bool defaultBoxExists = false; Box box; var apiSecurity = Application.Current.Resources["APISecurity"].ToString(); var BoxList = await this.apiService.GetBoxDefault <Box>( apiSecurity, "/api", "/Boxes/GetBoxDefault", MainViewModel.GetInstance().User.UserId); if (BoxList == default || BoxList == null) { defaultBoxExists = false; } else { defaultBoxExists = true; } if (defaultBoxExists) { box = new Box { Name = this.Name, BoxDefault = false, UserId = mainViewModel.User.UserId, Time = boxTime, ColorBox = "#c6c6c6" }; } else { box = new Box { Name = this.Name, BoxDefault = true, UserId = mainViewModel.User.UserId, Time = boxTime, ColorBox = "#c6c6c6" }; } var response = await this.apiService.Post2( apiSecurity, "/api", "/Boxes", box); if (!response.IsSuccess) { this.IsRunning = false; this.IsEnabled = true; await Application.Current.MainPage.DisplayAlert( Languages.Error, response.Message, Languages.Accept); return; } var A = await this.apiService.GetLastBox( apiSecurity, "/api", "/Boxes/GetLastBox", mainViewModel.User.UserId); this.IsRunning = false; this.IsEnabled = true; this.Name = string.Empty; mainViewModel.Home.AddList(A); await mainViewModel.Home.GetBoxCount(); await App.Navigator.PopAsync(); }
private async void Save() { if (string.IsNullOrEmpty(this.profilePhone.Name)) { await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.NameValidation, Languages.Accept); return; } if (string.IsNullOrEmpty(this.profilePhone.Number)) { await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.NumberValidation, Languages.Accept); return; } if (!(this.profilePhone.Number).ToCharArray().All(Char.IsDigit)) { await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.NumberValidation, Languages.Accept); return; } if (this.profilePhone.Number.Length != 10) { await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.PhoneValidation2, Languages.Accept); return; } this.IsRunning = true; this.IsEnabled = false; var checkConnetion = await this.apiService.CheckConnection(); if (!checkConnetion.IsSuccess) { this.IsRunning = false; this.IsEnabled = true; await Application.Current.MainPage.DisplayAlert( Languages.Error, checkConnetion.Message, Languages.Accept); return; } var apiSecurity = Application.Current.Resources["APISecurity"].ToString(); var profile = await this.apiService.PutProfile( apiSecurity, "/api", "/ProfilePhones/PutProfilePhone", profilePhone); this.IsRunning = false; this.IsEnabled = true; #region LastCode2 //string consultaDefault = "select * from dbo.ProfilePhones where dbo.ProfilePhones.ProfilePhoneId = " // + profilephone.ProfilePhoneId; //string cadenaConexion = @"data source=serverappmyinfonfc.database.windows.net;initial catalog=mynfo;user id=adminatxnfc;password=4dmiNFC*Atx2020;Connect Timeout=60"; //ProfilePhone _profilePhone = new ProfilePhone(); //using (SqlConnection connection = new SqlConnection(cadenaConexion)) //{ // System.Text.StringBuilder sb = new System.Text.StringBuilder(); // sb.Append(consultaDefault); // string sql = sb.ToString(); // using (SqlCommand command = new SqlCommand(sql, connection)) // { // connection.Open(); // using (SqlDataReader reader = command.ExecuteReader()) // { // while (reader.Read()) // { // _profilePhone.ProfilePhoneId = (int)reader["ProfilePhoneId"]; // _profilePhone.Name = (string)reader["Name"]; // _profilePhone.UserId = (int)reader["UserId"]; // _profilePhone.Number = (string)reader["Number"]; // } // } // connection.Close(); // } //} #endregion MainViewModel.GetInstance().Profiles.updateProfilePhone(profile); await App.Navigator.PopAsync(); }
private async void Navigate() { App.Master.IsPresented = false; var mainViewModal = MainViewModel.GetInstance(); //Logout if (this.PageName == "LoginPage") { Settings.IsRemembered = "false"; mainViewModal.Token = null; mainViewModal.User = null; using (var conn = new SQLite.SQLiteConnection(App.root_db)) { conn.DeleteAll <UserLocal>(); } using (var conn = new SQLite.SQLiteConnection(App.root_db)) { conn.DeleteAll <TokenResponse>(); } //Borrar la box local using (var conn = new SQLite.SQLiteConnection(App.root_db)) { conn.DeleteAll <BoxLocal>(); } //Borrar perfiles locales using (var conn = new SQLite.SQLiteConnection(App.root_db)) { conn.DeleteAll <ProfileLocal>(); } using (var conn = new SQLite.SQLiteConnection(App.root_db)) { conn.DeleteAll <ForeingBox>(); } //Borrar perfiles locales using (var conn = new SQLite.SQLiteConnection(App.root_db)) { conn.DeleteAll <ForeingProfile>(); } Application.Current.MainPage = new NavigationPage(new LoginPage()); } else if (this.PageName == "MyProfilePage") { MainViewModel.GetInstance().MyProfile = new MyProfileViewModel(); await App.Navigator.PushAsync(new MyProfilePage()); } else if (this.PageName == "QR") { await App.Navigator.PushAsync(new QRTabbedPage()); } else if (this.PageName == "TAGPage") { MainViewModel.GetInstance().TAG = new TAGViewModel(); await App.Navigator.PushAsync(new TAGPage()); } else if (this.PageName == "Help") { MainViewModel.GetInstance().GIF = new GifViewModel("All"); await PopupNavigation.Instance.PushAsync(new GifPage()); } else if (this.PageName == "Comments") { await Browser.OpenAsync("https://mynfo.mx/preguntas-frecuentes/", BrowserLaunchMode.SystemPreferred); } else if (this.PageName == "Store") { await Browser.OpenAsync("https://mynfo.mx/compra-tu-mytag/", BrowserLaunchMode.SystemPreferred); } else if (this.PageName == "BasicIntro") { MainViewModel.GetInstance().GIF = new GifViewModel("BasicIntro"); await PopupNavigation.Instance.PushAsync(new GifPage()); } }
public async void DeleteBox(int _BoxId) { this.IsRunning = true; var apiSecurity = Application.Current.Resources["APISecurity"].ToString(); #region Revisión de perfiles de box #region Email var EmailProfiles = await this.apiService.GetRelationBox_ProfilesEmail( apiSecurity, "/api", "/Box_ProfileEmail/GetBox_ProfileEmailBoxId", _BoxId); if (EmailProfiles.Count != 0) { var DeleteEmail = await this.apiService.DeleteProfilesEmail_Box( apiSecurity, "/api", "/Box_ProfileEmail/DeleteBox_ProfileEmailBoxRelation", _BoxId); } #endregion #region Phone var PhoneProfiles = await this.apiService.GetRelationBox_ProfilesPhone( apiSecurity, "/api", "/Box_ProfilePhone/GetBox_ProfilePhoneBoxId", _BoxId); if (PhoneProfiles.Count != 0) { var DeletePhone = await this.apiService.DeleteProfilesPhone_Box( apiSecurity, "/api", "/Box_ProfilePhone/DeleteBox_ProfilePhoneBoxRelations", _BoxId); } #endregion #region Whatsapp var WhatsappProfiles = await this.apiService.GetRelationBox_ProfilesWhatsapp( apiSecurity, "/api", "/Box_ProfileWhatsapp/GetBox_ProfileWhatsappBoxId", _BoxId); if (WhatsappProfiles.Count != 0) { var DeleteWhatsapp = await this.apiService.DeleteProfilesWhatsapp_Box( apiSecurity, "/api", "/Box_ProfileWhatsapp/DeleteBox_ProfileWhatsappBoxRelations", _BoxId); } #endregion #region SM var SMProfiles = await this.apiService.GetRelationBox_ProfilesSM( apiSecurity, "/api", "/Box_ProfileSM/GetBox_ProfileSMBoxId", _BoxId); if (SMProfiles.Count != 0) { var DeleteSM = await this.apiService.DeleteProfilesPhone_Box( apiSecurity, "/api", "/Box_ProfileSM/DeleteBox_ProfileSMBoxRelations", _BoxId); } #endregion #endregion var box = await this.apiService.GetBox( apiSecurity, "/api", "/Boxes", _BoxId); if (box.BoxDefault == true) { MainViewModel.GetInstance().Home.RemoveList(box); var LastBox = await this.apiService.GetLastBox( apiSecurity, "/api", "/Boxes/GetLastBox", _BoxId); var NewDefault = new Box { BoxId = LastBox.BoxId, UserId = LastBox.UserId, Name = LastBox.Name, Time = LastBox.Time, BoxDefault = true }; await EdithBox(NewDefault); var response = await this.apiService.Delete( apiSecurity, "/api", "/Boxes", _BoxId); } else { MainViewModel.GetInstance().Home.RemoveList(box); var response = await this.apiService.Delete( apiSecurity, "/api", "/Boxes", _BoxId); } await PopupNavigation.Instance.PopAllAsync(); //MainViewModel.GetInstance().Home = new HomeViewModel(); //Application.Current.MainPage = new MasterPage(); }
private void BackHome() { PopupNavigation.Instance.PopAllAsync(); MainViewModel.GetInstance().Home = new HomeViewModel(); Application.Current.MainPage = new MasterPage(); }
private void BackHome() { MainViewModel.GetInstance().Home = new HomeViewModel(); Application.Current.MainPage = new MasterPage(); }
async void RecoverPassword() { MainViewModel.GetInstance().PasswordRecovery = new PasswordRecoveryViewModel(); await Application.Current.MainPage.Navigation.PushAsync(new PasswordRecoveryPage()); }
private void GotoAdd() { PopupNavigation.Instance.PopAsync(); MainViewModel.GetInstance().ListOfNetworks = new ListOfNetworksViewModel(Box.BoxId); PopupNavigation.Instance.PushAsync(new ListOfNetworksPage(Box.BoxId)); }
private async void Next() { if (string.IsNullOrEmpty(this.FirstName)) { await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.FirstNameValidation, Languages.Accept); return; } //char[] A = FirstName.ToCharArray(); //foreach(char B in A) //{ // if (!Char.IsLetter(B) || !Char.IsWhiteSpace(B)) // { // await Application.Current.MainPage.DisplayAlert( // Languages.Error, // Languages.FirstNameValidation, // Languages.Accept); // return; // } //} if (string.IsNullOrEmpty(this.LastName)) { await Application.Current.MainPage.DisplayAlert( Languages.Error, Languages.LastNameValidation, Languages.Accept); return; } var checkConnetion = await this.apiService.CheckConnection(); if (!checkConnetion.IsSuccess) { this.IsRunning = false; this.IsEnabled = true; await Application.Current.MainPage.DisplayAlert( Languages.Error, checkConnetion.Message, Languages.Accept); return; } byte[] imageArray = null; if (this.file != null) { imageArray = FilesHelper.ReadFully(this.file.GetStream()); } var user = new User { Email = this.Email, FirstName = this.FirstName, LastName = this.LastName, ImageArray = imageArray, UserTypeId = 1, Password = this.Password, }; MainViewModel.GetInstance().Register2 = new Register2ViewModel(user); await Application.Current.MainPage.Navigation.PushAsync(new Register2Page()); }