private void ButtonLogin_Click(object sender, RoutedEventArgs e) { var errors = new Dictionary <string, string>(); MemberLogin mem = new MemberLogin { email = this.email.Text, password = this.password.Password }; errors = mem.Validate(); if (errors.Count == 0) { string token = memberService.Login(this.email.Text, this.password.Password); if (token == null) { //Show errors } else { //Show success //Lay info tu APi bang token: Member memberLogin = memberService.GetInformation(token); MemberLoginAction.ShowMenuIfLogged(); Frame.Navigate(typeof(MySong)); } } else { ShowError(errors); } }
public Upload() { this.memberService = new MemberServiceImp(); loginToken = memberService.ReadTokenFromLocalStorage(); if (loginToken == null) { //Not login: MemberLoginAction.HideMenuIfLogged(); } else { this.InitializeComponent(); this.songService = new SongServiceImp(); } }
public NaView() { this.InitializeComponent(); uploadNav = this.upload; mysongNav = this.mysong; listsongNav = this.listsong; profileNav = this.profile; memberService = new MemberServiceImp(); tokenLogin = memberService.ReadTokenFromLocalStorage(); if (tokenLogin == null) { MemberLoginAction.HideMenuIfLogged(); } else { Member memberLogin = memberService.GetInformation(tokenLogin); } }
public MySong() { this.memberService = new MemberServiceImp(); loginToken = memberService.ReadTokenFromLocalStorage(); if (loginToken == null) { MemberLoginAction.HideMenuIfLogged(); } else { this.InitializeComponent(); this.songService = new SongServiceImp(); LoadSongs(); if (_songs.Count == 0) { this.empty.Visibility = Visibility.Visible; this.media.Visibility = Visibility.Collapsed; } } }
private void ButtonBase_OnClick(object sender, RoutedEventArgs e) { var errors = new Dictionary <string, string>(); var member = new Member { firstName = this.firstname.Text, lastName = this.lastname.Text, password = this.password.Password, address = this.address.Text, avatar = imgUrl, birthday = this.birthday.Date.ToString("yyyy-MM-dd"), email = this.email.Text, gender = (int)this.gender.SelectedValue, introduction = this.introduction.Text, phone = this.phone.Text }; Debug.WriteLine("Birthday: " + member.birthday); errors = member.Validate(); if (errors.Count == 0) { var memberRes = memberService.Register(member); if (memberRes == null) { //Show error } else { //Show success var token = memberService.Login(this.email.Text, this.password.Password); MemberLoginAction.ShowMenuIfLogged(); Frame.Navigate(typeof(ListSong)); } } else { ShowError(errors); } }
public Profile() { memberService = new MemberServiceImp(); loginToken = memberService.ReadTokenFromLocalStorage(); if (loginToken == null) { MemberLoginAction.HideMenuIfLogged(); } else { this.InitializeComponent(); memLogged = memberService.GetInformation(loginToken); if (memLogged.gender == 0) { this.gender.Text = "Female"; } else if (memLogged.gender == 1) { this.gender.Text = "Male"; } DateTime dt = DateTime.Parse(memLogged.birthday); this.birthday.Text = String.Format("{0:ddd, MMM d, yyyy}", dt); } }