private async Task OnExecuteAddContactCommand() { if (null == addContactMenuItem) { addContactMenuItem = new HomeMenuItem() { Id = MenuItemType.AddContact, Title = UIConstants.AddContact }; } await RootPage.NavigateFromMenu(addContactMenuItem); }
/// <summary> /// Handles the ListViewMenu selection changed event. /// </summary> /// <param name="sender">The sender of the event.</param> /// <param name="e">The selected item changed event arguments.</param> /// <returns>A task to await.</returns> // ReSharper disable once UnusedParameter.Local protected async Task ListViewMenuOnItemSelected(object sender, SelectedItemChangedEventArgs e) { if (!(e?.SelectedItem is HomeMenuItem item)) { return; } if (RootPage != null) { await RootPage.NavigateFromMenu(item.Id).ConfigureAwait(false); } }
async void ItemSelectedMethod(object itemSelected) { if (itemSelected == null) { return; } int id = (int)((HomeMenuItem)itemSelected).Id; RootPage = Application.Current.MainPage as MainPage; await RootPage.NavigateFromMenu(id); }
private async Task GoToContactList() { await RootPage.DisplayAlert("Add Contact", $"Contact '{Name.Value}' saved", "Hmmmm"); if (null == contactListMenuItem) { contactListMenuItem = new HomeMenuItem() { Id = MenuItemType.ContactList, Title = UIConstants.ContactList }; } ResetForm(); await RootPage.NavigateFromMenu(contactListMenuItem); }
/// <summary> /// Constructor de la clase 'MenuPage' /// </summary> /// <param name="root">Parámetro RootPage.</param> public MenuPage(RootPage root) { InitializeComponent(); BindingContext = new BaseViewModel { Title = "Velocidad", Icon = "burger_naranja.png" }; menuItems = new List <HomeMenuItem> { new HomeMenuItem { Id = MenuItemType.Inicio, Title = "Inicio", Icon = "home.png", TextColor = "#636363" }, new HomeMenuItem { Id = MenuItemType.Cronometro, Icon = "cronometro_menu.png", Title = "Cronómetro", TextColor = "#636363" }, new HomeMenuItem { Id = MenuItemType.Historial, Title = "Historial", Icon = "historial.png", TextColor = "#636363" }, new HomeMenuItem { Id = MenuItemType.AcercaDe, Title = "Acerca de", Icon = "info.png", TextColor = "#636363" } }; ListViewMenu.ItemsSource = menuItems; ListViewMenu.SelectedItem = menuItems[0]; ListViewMenu.ItemSelected += async(sender, e) => { if (e.SelectedItem == null) { return; } var id = (int)((HomeMenuItem)e.SelectedItem).Id; await RootPage.NavigateFromMenu(id); }; }
private async Task ListViewMenu_ItemTapped(object sender, ItemTappedEventArgs e) { if (e.Item == null) { return; } var id = (int)(e.Item as Models.MenuItem)?.Id; if (id == (int)MenuItemType.Share) { await DependencyService.Get <IShareService>().ShareApp(); return; } await RootPage.NavigateFromMenu(id); }
public BottomTabbarViewModel() { BottomTabbarCommand = new Command(async(parameter) => { var choice = (int)parameter; switch (choice) { case 0: var homePage = (int)MenuItemType.Home; await RootPage.NavigateFromMenu(homePage); RootPage.menuPage.ChangeSelectedItemWithoutForwarding(homePage); break; case 1: var accountPage = (int)MenuItemType.Account; await RootPage.NavigateFromMenu(accountPage); RootPage.menuPage.ChangeSelectedItemWithoutForwarding(accountPage); break; } }); }
public MenuPage() { InitializeComponent(); List <HomeMenuItem> menuItems = GetMenuItems(); ListViewMenu.ItemsSource = menuItems; ListViewMenu.SelectedItem = menuItems[0]; ListViewMenu.ItemSelected += async(sender, e) => { if (e.SelectedItem == null) { return; } var id = (int)((HomeMenuItem)e.SelectedItem).Id; await RootPage.NavigateFromMenu(id); }; LoginViewModel.SignIn += LoginViewModelOnSignIn; }
public MenuPage() { InitializeComponent(); var menuItems = new List <HomeMenuItem> { new HomeMenuItem { Id = MenuItemType.MangaSelectorView, Title = "Поиск" }, new HomeMenuItem { Id = MenuItemType.Favorite, Title = "Избранное" }, new HomeMenuItem { Id = MenuItemType.History, Title = "История" }, new HomeMenuItem { Id = MenuItemType.Settings, Title = "Настройки" }, new HomeMenuItem { Id = MenuItemType.Import, Title = "Импорт" }, // new HomeMenuItem {Id = MenuItemType.About, Title = "About"}, // new HomeMenuItem {Id = MenuItemType.Browse, Title = "Browse"}, }; ListViewMenu.ItemsSource = menuItems; ListViewMenu.SelectedItem = menuItems[0]; ListViewMenu.ItemSelected += async(sender, e) => { if (e.SelectedItem == null) { return; } var id = ((HomeMenuItem)e.SelectedItem).Id; await RootPage.NavigateFromMenu(id); }; }
public MenuPage() { InitializeComponent(); menuItems = new List<HomeMenuItem> { new HomeMenuItem {Id = MenuItemType.Browse, Title="SuperHeros Dashboard" }, new HomeMenuItem {Id = MenuItemType.About, Title="Search SuperHeros" } }; ListViewMenu.ItemsSource = menuItems; ListViewMenu.SelectedItem = menuItems[0]; ListViewMenu.ItemSelected += async (sender, e) => { if (e.SelectedItem == null) return; var id = (int)((HomeMenuItem)e.SelectedItem).Id; await RootPage.NavigateFromMenu(id); }; }
public OptionsPage() //Hamburger menu contains menus { InitializeComponent(); menuItems = new List <HomeMenuItem> //Initialize the choices in the hamburger menu { new HomeMenuItem { Id = MenuItemType.Browse, Title = "Browse" }, new HomeMenuItem { Id = MenuItemType.Instructions, Title = "Instructions" }, new HomeMenuItem { Id = MenuItemType.ViewData, Title = "View Data" }, new HomeMenuItem { Id = MenuItemType.Bluetooth, Title = "Bluetooth Settings" }, new HomeMenuItem { Id = MenuItemType.About, Title = "About" } }; ListViewMenu.ItemsSource = menuItems; //Set the items in the menu to be the initialized ones above ListViewMenu.SelectedItem = menuItems[0]; ListViewMenu.ItemSelected += async(sender, e) => //Opend the required screen based upon the selected item { if (e.SelectedItem == null) { return; } int id = (int)((HomeMenuItem)e.SelectedItem).Id; await RootPage.NavigateFromMenu(id); }; }
public MenuPage() { InitializeComponent(); menuItems = new List <HomeMenuItem> { new HomeMenuItem { Id = MenuItemType.Welcome, Title = "Welcome" }, new HomeMenuItem { Id = MenuItemType.AboutNoXAML, Title = "About (No XAML)" }, new HomeMenuItem { Id = MenuItemType.AboutXAML, Title = "About (XAML)" }, new HomeMenuItem { Id = MenuItemType.AboutMVVM, Title = "About (MVVM)" }, new HomeMenuItem { Id = MenuItemType.AboutMVVMDI, Title = "About (MVVM DI)" } }; ListViewMenu.ItemsSource = menuItems; ListViewMenu.SelectedItem = menuItems[0]; ListViewMenu.ItemSelected += async(sender, e) => { if (e.SelectedItem == null) { return; } var id = (int)((HomeMenuItem)e.SelectedItem).Id; await RootPage.NavigateFromMenu(id); }; }
async void Chat_Clicked(object sender, EventArgs e) { //await Browser.OpenAsync("https://atxbot.azurewebsites.net/bot.html"); await RootPage.NavigateFromMenu(9); }
private async Task OnExecuteSelectMenuItemCommand(HomeMenuItem selectedItem) { await RootPage.NavigateFromMenu(selectedItem); }
public ForgotPasswordPageViewModel() { NewPasswordCommand = new Command(async() => { if (!string.IsNullOrWhiteSpace(NewPassword) && !string.IsNullOrWhiteSpace(NewPassword2)) { if (NewPassword == NewPassword2) { Utility.ShowIndicator = true; AESCrypt AES = new AESCrypt(sharedSecret, new byte[16]); var cipheredParameters = AES.Encrypt(JsonConvert.SerializeObject(new { NewPassword, ValidationCode })); var newPasswordResponse = JsonConvert.DeserializeObject <BaseResponseModel>( AES.Decrypt(await Helper.httpPostAsync($"{Utility.BaseURL}/api/user/SetNewPassword?username={Username}", cipheredParameters))); if (newPasswordResponse.responseVal == 0) { Utility.SharedSecret = sharedSecret; var serializedParameters = JsonConvert.SerializeObject(new { password = NewPassword }); var loginResponse = JsonConvert.DeserializeObject <LoginResponseModel>( await Helper.httpPostAsync($"{Utility.BaseURL}/api/user/login?username={Username}", serializedParameters, IsSecure: true)); if (loginResponse.responseVal == 0) { using (var con = DependencyService.Get <IDatabase>().GetConnection(ConnectionType.Login)) { var bufferUser = con.Table <User>().FirstOrDefault(each => each.accessToken == loginResponse.accessToken); string connectedHomes = Helper.ConvertCollectionToString(loginResponse.ConnectedHomes, ','); if (bufferUser != null) { con.BeginTransaction(); bufferUser.LoggedIn = true; bufferUser.Username = Username; bufferUser.UserNameSurname = loginResponse.nameSurname; bufferUser.ConnectedHomes = connectedHomes; bufferUser.CurrentHome = loginResponse.CurrentHome; bufferUser.LastLoggedInDate = DateTime.Now; con.Update(bufferUser); con.Commit(); Utility.User = bufferUser; } else { User user = new User() { accessToken = loginResponse.accessToken, LastLoggedInDate = DateTime.Now, LoggedIn = true, Username = Username, CurrentHome = loginResponse.CurrentHome, ConnectedHomes = connectedHomes, UserType = loginResponse.userType, UserNameSurname = loginResponse.nameSurname }; con.Insert(user); Utility.User = user; } } RootPage.IsGestureEnabled = true; await RootPage.NavigateFromMenu((int)MenuItemType.Home); } else { UI.DisplayCustomAlert(new KeyValuePair <string, string>("Pass", loginResponse.responseText)); } } else { UI.DisplayCustomAlert(new KeyValuePair <string, string>("Pass", newPasswordResponse.responseText)); } Utility.ShowIndicator = false; } else { UI.DisplayCustomAlert(new KeyValuePair <string, string>("Pass", "Parolarınız aynı değil")); } } else { UI.DisplayCustomAlert(new KeyValuePair <string, string>("Pass", "Parola alanı boş bırakılamaz")); } }); SendValidationCommand = new Command(async() => { int mValidationCode = 0; bool error = false; try { mValidationCode = Convert.ToInt32(ValidationCode); } catch { error = true; } if (!string.IsNullOrWhiteSpace(ValidationCode)) { if (!error) { if (mValidationCode > 99999) { Utility.ShowIndicator = true; EllipticCurve elliptic = new EllipticCurve(false); await Task.Run(() => { elliptic.KeyExchange(Username); }); if (elliptic.IsSucceeded) { sharedSecret = elliptic.SharedSecret; AESCrypt AES = new AESCrypt(sharedSecret, new byte[16]); var cipheredParameters = AES.Encrypt(JsonConvert.SerializeObject(new { ValidationCode = mValidationCode })); var validationVCodeResponse = JsonConvert.DeserializeObject <BaseResponseModel>( AES.Decrypt(await Helper.httpPostAsync($"{Utility.BaseURL}/api/user/ValidateVCode?username={Username}", cipheredParameters))); Utility.ShowIndicator = false; if (validationVCodeResponse.responseVal == 0) { UI.CallNewPasswordStackLayout(); } else { UI.DisplayCustomAlert(new KeyValuePair <string, string>("Validation", validationVCodeResponse.responseText)); } } } else { UI.DisplayCustomAlert(new KeyValuePair <string, string>("Validation", "Doğrulama kodu 6 haneli olmalıdır")); } } else { UI.DisplayCustomAlert(new KeyValuePair <string, string>("Validation", "Doğrulama kodu sadece sayı olmalıdır")); } } else { UI.DisplayCustomAlert(new KeyValuePair <string, string>("Validation", "Doğrulama kodu boş bırakılamaz")); } }); SendCommand = new Command(async() => { if (!string.IsNullOrWhiteSpace(Username)) { if (Username.Length > 3) { Utility.ShowIndicator = true; var validationResponse = JsonConvert.DeserializeObject <BaseResponseModel>(await Helper.httpGetAsync($"{Utility.BaseURL}/api/user/GetValidationCode?username={Username}")); Utility.ShowIndicator = false; if (validationResponse.responseVal == 0) { UI.CallValidationStackLayout(); } else { UI.DisplayCustomAlert(new KeyValuePair <string, string>("User", validationResponse.responseText)); } } else { UI.DisplayCustomAlert(new KeyValuePair <string, string>("User", "Kullanıcı adı 4 karakterden uzun olmalıdır")); } } else { UI.DisplayCustomAlert(new KeyValuePair <string, string>("User", "Kullanıcı adı boş bırakılamaz")); } }); }
private void SetupHomePageView() { StackLayout topSection = new StackLayout { BackgroundColor = Color.Black, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Start, Padding = 4 }; topSection.Children.Add(new Label { Text = "Pure Physicist", TextColor = Color.White, FontSize = 36, FontAttributes = FontAttributes.Bold, VerticalTextAlignment = TextAlignment.Center, VerticalOptions = LayoutOptions.Center, HorizontalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.Center }); FlexLayout flexLayout = new FlexLayout() { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, FlowDirection = FlowDirection.LeftToRight, Direction = FlexDirection.Row, JustifyContent = FlexJustify.SpaceAround, Wrap = FlexWrap.Wrap, Margin = new Thickness(0, 30, 0, 0) }; foreach (var item in this.MenuItems) { item.Icon.HeightRequest = 100; item.Icon.WidthRequest = 100; StackLayout itemLayout = new StackLayout { Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.Center, Margin = 5, BackgroundColor = Color.Transparent, Padding = 2 }; itemLayout.Children.Add(item.Icon); itemLayout.Children.Add(new Label { Text = item.Title.Replace(" ", "\n"), HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.Start, FontAttributes = FontAttributes.Bold, FontSize = 15, HeightRequest = 40 }); TapGestureRecognizer tapGesture = new TapGestureRecognizer(); bool isModal = this.IsModal; tapGesture.Tapped += async(s, e) => { if (item.IsPageReference) { MenuPage.SelectedItem = item; item.Icon.FadeTo(0.5, 100, Easing.CubicInOut); await item.Icon.ScaleTo(0.6, 50, Easing.CubicInOut); await item.Icon.ScaleTo(1, 50, Easing.CubicInOut); if (isModal) { RootPage.Navigation.PopModalAsync(); } await RootPage.NavigateFromMenu(item.Id, item.TopicColour); } }; itemLayout.GestureRecognizers.Add(tapGesture); itemLayout.AlignSelf(FlexAlignSelf.Center); flexLayout.Children.Add(itemLayout); } StackLayout stackLayout = new StackLayout { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, }; ScrollView scroller = new ScrollView { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, }; scroller.Content = flexLayout; stackLayout.Children.Add(topSection); stackLayout.Children.Add(scroller); if (this.IsModal) { //Add back button! Button backBtn = new Button { Style = Application.Current.Resources["CoolStuffBackButton"] as Style, Text = "Back", HorizontalOptions = LayoutOptions.Center }; backBtn.Clicked += (e, s) => { this.Navigation.PopModalAsync(); }; stackLayout.Children.Add(backBtn); } this.Content = stackLayout; }
async void Chat_Clicked(object sender, EventArgs e) { await RootPage.NavigateFromMenu(9); }
public RegisterPageViewModel() { ButtonText = AppConfigurationModel.Instance.RegisterPageContent.ButtonText1; RegisterCommand = new Command(async() => { switch (CurrentPage) { case 0: if (!IsEmailValidationRunning) { if (ValidEmail) { var returnVal = ControlPageValues(); if (returnVal.Key == "Ok") { CurrentPage = 1; UI.CallNextPage(); ButtonText = AppConfigurationModel.Instance.RegisterPageContent.ButtonText2; } else { UI.DisplayCustomAlert(returnVal); } } else { UI.TriggerInvalidEmailAnimation(); } } else { await PopupNavigation.Instance.PushAsync(new ErrorPopup("Lütfen Bekleyiniz")); } break; case 1: if (!IsUsernameValidationRunning) { if (ValidUsername) { var returnVal2 = ControlSecondPageValues(); if (returnVal2.Key == "Ok") { string errorLog = null; Utility.ShowIndicator = true; await Task.Run(() => { EllipticCurve elliptic = new EllipticCurve(true); var buffer = elliptic.KeyExchange(Username); if (elliptic.IsSucceeded) { Utility.SharedSecret = elliptic.SharedSecret; var serializedRegisterParameters = JsonConvert.SerializeObject(new { Email, Password, NameSurname, phoneNumber = PhoneNumber, }); try { var response = JsonConvert.DeserializeObject <BaseResponseModel>( Helper.httpPostAsync($"{Utility.BaseURL}/api/user/register?username={Username}", serializedRegisterParameters, IsSecure: true).Result); if (response.responseVal == 0) { var serializedLoginParameters = JsonConvert.SerializeObject(new { password = Password }); var loginResponse = JsonConvert.DeserializeObject <LoginResponseModel>( Helper.httpPostAsync($"{Utility.BaseURL}/api/user/login?username={Username}", serializedLoginParameters, IsSecure: true).Result); if (loginResponse.responseVal == 0) { Utility.ShowIndicator = false; using (var con = DependencyService.Get <IDatabase>().GetConnection(ConnectionType.Login)) { User bufferUser = new User() { accessToken = loginResponse.accessToken, LastLoggedInDate = DateTime.Now, ConnectedHomes = Helper.ConvertCollectionToString(loginResponse.ConnectedHomes, ','), CurrentHome = loginResponse.CurrentHome, LoggedIn = true, Username = Username, UserType = loginResponse.userType, UserNameSurname = loginResponse.nameSurname }; con.Insert(bufferUser); Utility.User = bufferUser; } } else { errorLog = loginResponse.responseText; } } else { errorLog = response.responseText; } } catch (Exception) { errorLog = Utility.UnexpectedMessage; } } else { errorLog = elliptic.Response.responseText; } }); Utility.ShowIndicator = false; if (errorLog != null) { UI.DisplayCustomAlert(new KeyValuePair <string, string>(errorLog, null), true); } else { RootPage.IsGestureEnabled = true; await RootPage.NavigateFromMenu((int)MenuItemType.Home); } } else { UI.DisplayCustomAlert(returnVal2); } } else { UI.TriggerInvalidUsernameAnimation(); } } else { await PopupNavigation.Instance.PushAsync(new ErrorPopup("Lütfen bekleyiniz.")); } break; } }); }