public User(int id, string name, string codigo, string password) { Id = id; Name = NameUser.FromString(name); Codigo = CodigoUsuarioValueObject.FromString(codigo); Password = PasswordUserValueObject.FromString(password); }
protected override void OnAppearing() { UserDialogs.Instance.HideLoading(); if (Xamarin.Forms.Application.Current.MainPage is MasterDetailPage masterDetailPage) { masterDetailPage.IsGestureEnabled = true; } else if (Xamarin.Forms.Application.Current.MainPage is NavigationPage navigationPage && navigationPage.CurrentPage is MasterDetailPage nestedMasterDetail) { nestedMasterDetail.IsGestureEnabled = true; } base.OnAppearing(); MessagingCenter.Subscribe <App>((App)Xamarin.Forms.Application.Current, "Login1", (sender) => { NameUser.SetBinding(Label.TextProperty, "fullname"); NameUser.BindingContext = Helper.Instance().MyAccount; Avatar.SetBinding(CachedImage.SourceProperty, "Avatar_Uri"); Avatar.BindingContext = Helper.Instance().MyAccount; AppChat.Helpers.Helper.Instiance().nameDataBase = Helper.Instance().MyAccount.Number_Id.ToString(); AppChat.Helpers.Helper.Instiance().myAccount = Helper.Instance().AccountChat; AppChat.Helpers.Helper.Instiance().myAccount.last_time_sync_contact = (int)Helper.Instance().MyAccount.Last_Time_Sync_Contact; if (AppChat.Helpers.Helper.Instiance().accountCached.ContainsKey(Helper.Instance().AccountChat.NumberId)) { AppChat.Helpers.Helper.Instiance().accountCached[Helper.Instance().AccountChat.NumberId] = Helper.Instance().AccountChat; } else { AppChat.Helpers.Helper.Instiance().accountCached.Add(Helper.Instance().AccountChat.NumberId, Helper.Instance().AccountChat); } Detail = new NavigationPage(new PersonalPage()); }); MessagingCenter.Subscribe <App>((App)Application.Current, "Logout", (sender) => { Detail = new NavigationPage(new LoginPage()); }); }
void ReleaseDesignerOutlets() { if (AddSeekiosButton != null) { AddSeekiosButton.Dispose(); AddSeekiosButton = null; } if (AddSeekiosLabel != null) { AddSeekiosLabel.Dispose(); AddSeekiosLabel = null; } if (AllSeekiosMapLabel != null) { AllSeekiosMapLabel.Dispose(); AllSeekiosMapLabel = null; } if (CreditsLabel != null) { CreditsLabel.Dispose(); CreditsLabel = null; } if (CreditsTitleLabel != null) { CreditsTitleLabel.Dispose(); CreditsTitleLabel = null; } if (EmailUser != null) { EmailUser.Dispose(); EmailUser = null; } if (FeedbackButton != null) { FeedbackButton.Dispose(); FeedbackButton = null; } if (FeedbackLabel != null) { FeedbackLabel.Dispose(); FeedbackLabel = null; } if (Head2View != null) { Head2View.Dispose(); Head2View = null; } if (HeadView != null) { HeadView.Dispose(); HeadView = null; } if (HistoriqueConsommationButton != null) { HistoriqueConsommationButton.Dispose(); HistoriqueConsommationButton = null; } if (MapButton != null) { MapButton.Dispose(); MapButton = null; } if (MyConsoLabel != null) { MyConsoLabel.Dispose(); MyConsoLabel = null; } if (NameUser != null) { NameUser.Dispose(); NameUser = null; } if (ParameterButton != null) { ParameterButton.Dispose(); ParameterButton = null; } if (ParametersLabel != null) { ParametersLabel.Dispose(); ParametersLabel = null; } if (SeekiosTutorialButton != null) { SeekiosTutorialButton.Dispose(); SeekiosTutorialButton = null; } if (SettingsImageView != null) { SettingsImageView.Dispose(); SettingsImageView = null; } if (UserGuideLabel != null) { UserGuideLabel.Dispose(); UserGuideLabel = null; } if (UserImageView != null) { UserImageView.Dispose(); UserImageView = null; } }
public override void ViewDidLoad() { base.ViewDidLoad(); // button click seekios tutorial SeekiosTutorialButton.AddGestureRecognizer(new UITapGestureRecognizer(() => { NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true); App.Locator.LeftMenu.GoToListTutorial(); })); // button click my consomation HistoriqueConsommationButton.AddGestureRecognizer(new UITapGestureRecognizer(() => { NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true); App.Locator.Credits.GoToCreditHistoric(); })); // button click on add a seekios AddSeekiosButton.AddGestureRecognizer(new UITapGestureRecognizer(() => { NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true); App.Locator.LeftMenu.GoToAddSeekios(); })); // button click on map all seekios MapButton.AddGestureRecognizer(new UITapGestureRecognizer(() => { if (App.CurrentUserEnvironment.LsSeekios.Count == 0) { AlertControllerHelper.ShowAlert(Application.LocalizedString("ZeroSeekios") , Application.LocalizedString("NeedAtLeastOneSeekios") , Application.LocalizedString("Close")); } else { if (App.CurrentUserEnvironment.LsSeekios.All(a => a.LastKnownLocation_latitude == App.DefaultLatitude && a.LastKnownLocation_longitude == App.DefaultLongitude)) { if (App.CurrentUserEnvironment.LsSeekios.Count == 1) { AlertControllerHelper.ShowAlert(Application.LocalizedString("NoPosition") , Application.LocalizedString("OneSeekiosNewlyAdded") , Application.LocalizedString("Close")); } else { AlertControllerHelper.ShowAlert(Application.LocalizedString("NoPosition") , Application.LocalizedString("PluralSeekiosNewlyAdded") , Application.LocalizedString("Close")); } } else { NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true); App.Locator.LeftMenu.GoToSeekiosMapAllSeekios(); } } })); // button click on feedback FeedbackButton.AddGestureRecognizer(new UITapGestureRecognizer(() => { var feedbackManager = BITHockeyManager.SharedHockeyManager.FeedbackManager; feedbackManager.ShowFeedbackListView(); feedbackManager.ShowFeedbackComposeView(); NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true); })); // button click on Parameter UserImageView.UserInteractionEnabled = true; UserImageView.AddGestureRecognizer(new UITapGestureRecognizer(() => { NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true); App.Locator.LeftMenu.GoToParameter(); })); EmailUser.AddGestureRecognizer(new UITapGestureRecognizer(() => { NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true); App.Locator.LeftMenu.GoToParameter(); })); NameUser.AddGestureRecognizer(new UITapGestureRecognizer(() => { NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true); App.Locator.LeftMenu.GoToParameter(); })); SettingsImageView.AddGestureRecognizer(new UITapGestureRecognizer(() => { NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true); App.Locator.LeftMenu.GoToParameter(); })); CreditsTitleLabel.AddGestureRecognizer(new UITapGestureRecognizer(() => { NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true); App.Locator.LeftMenu.GoToParameter(); })); CreditsLabel.AddGestureRecognizer(new UITapGestureRecognizer(() => { NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true); App.Locator.LeftMenu.GoToParameter(); })); }
public HomePage() { InitializeComponent(); NavigationPage.SetHasNavigationBar(this, false); listMenu = new List <MenuPage> { new MenuPage { Title = "Tin tức", Icon = "news.png", TargetType = typeof(NewsSiteHomePage) }, // new MenuPage{Title="Trang chủ cá nhân", Icon="home_menu.png",TargetType = typeof(PersonalPage) }, //new MenuPage{Title="Đăng nhập", Icon="login.png", TargetType = typeof(LoginPage) }, new MenuPage { Title = "Liên hệ", Icon = "phone.png", TargetType = typeof(Page1) }, new MenuPage { Title = "Thông tin sản phẩm", Icon = "information.png", TargetType = typeof(Page2) } }; menu.ItemsSource = listMenu; if (Helper.Instance().MyAccount != null) { Detail = new NavigationPage(new PersonalPage()); } else { Detail = new NavigationPage(new LoginPage()); } NameUser.SetBinding(Label.TextProperty, "fullname"); NameUser.BindingContext = Helper.Instance().MyAccount; Avatar.SetBinding(CachedImage.SourceProperty, "Avatar_Uri"); Avatar.BindingContext = Helper.Instance().MyAccount; if (Helper.Instance().MyAccount == null || string.IsNullOrEmpty(Helper.Instance().MyAccount.Avatar_Uri)) { avartaStack.IsVisible = false; } else { avartaStack.IsVisible = true; } avartaChange = ChangeAvarta; //if (Helper.Instance().CheckLogin()) //{ // NameUser.SetBinding(Label.TextProperty, "fullname"); // NameUser.BindingContext = Helper.Instance().MyAccount; // Avatar.SetBinding(CachedImage.SourceProperty, "Avatar_Uri"); // Avatar.BindingContext = Helper.Instance().MyAccount; // // Gán nameDataBase để khởi tạo slqLite và AccountChat // AppChat.Helpers.Helper.Instiance().nameDataBase = Helper.Instance().MyAccount.Number_Id.ToString(); // AppChat.Helpers.Helper.Instiance().myAccount = Helper.Instance().AccountChat; // var list = AppChat.Helpers.Helper.Instiance().database.GetListAcc(Helper.Instance().MyAccount.Number_Id).Result; // foreach (var item in list) // { // Helper.Instance().MyAccount.Last_Time_Sync_Contact = item.last_time_sync_contact; // } // if (AppChat.Helpers.Helper.Instiance().accountCached.ContainsKey(Helper.Instance().AccountChat.NumberId)) // AppChat.Helpers.Helper.Instiance().accountCached[Helper.Instance().AccountChat.NumberId] = Helper.Instance().AccountChat; // else AppChat.Helpers.Helper.Instiance().accountCached.Add(Helper.Instance().AccountChat.NumberId, Helper.Instance().AccountChat); // // App đến Homepage // Detail = new NavigationPage(new PersonalPage()); //} //else //{ // Detail = new NavigationPage(new LoginPage()); //} // Khởi tạo _mPosition Task.Run(() => Helper.Instance().MyPosition()); }