void loginBtn_TouchUpInside(object sender, EventArgs e) { try { loading = new LoadingView(); loading.ShowActivity("logging in"); SettingsMobile.Instance.User.UserName = userNameTxt.Text; SettingsMobile.Instance.User.Password = passwordTxt.Text; bool authenticate = User.Authenticate(new UserMobile() { UserName = userNameTxt.Text, Password = passwordTxt.Text }); loading.Hide(); if (authenticate) { this.NavigationController.PushViewController(new MainViewController(), true); } else { passwordTxt.Text = ""; warningTxt.Text = "Wrong login details. Try Again."; } } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.iPhone); } }
public override void ViewDidLoad() { try { base.ViewDidLoad(); this.Title = "Reply to " + initialModel.TopicTitle; View.Frame = UIScreen.MainScreen.Bounds; View.BackgroundColor = UIColor.White; View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; UIScrollView scroll = new UIScrollView(new RectangleF(0, 0, View.Bounds.Width, View.Bounds.Height)); scroll.ContentSize = new SizeF(View.Bounds.Width, 500); UILabel groupLbl = new UILabel(new RectangleF(10, 15, 200, 25)); groupLbl.Text = "Title: "; scroll.AddSubview(groupLbl); UILabel groupNameLbl = new UILabel(new RectangleF(60, 15, 200, 25)); groupNameLbl.Text = initialModel.TopicTitle; scroll.AddSubview(groupNameLbl); UILabel messageLbl = new UILabel(new RectangleF(10, 50, View.Bounds.Width, 25)); messageLbl.Text = "Message:"; scroll.AddSubview(messageLbl); messageTxt = new UITextView(new RectangleF(5, 80, View.Bounds.Width - 10, 200)); messageTxt.Layer.BorderWidth = 1; messageTxt.Layer.MasksToBounds = true; messageTxt.Layer.CornerRadius = 8; messageTxt.Layer.BorderColor = UIColor.Gray.CGColor; scroll.AddSubview(messageTxt); warningTxt = new UILabel(new RectangleF(10, 290, View.Bounds.Width - 20, 35)); warningTxt.TextColor = UIColor.Red; scroll.AddSubview(warningTxt); var button2 = new UIBarButtonItem("Send", UIBarButtonItemStyle.Plain, (sender, args) => { loading = new LoadingView(); loading.ShowActivity("sending message"); initialModel.DatePosted = DateTime.UtcNow; initialModel.MemberId = SettingsMobile.Instance.User.MemberId.ToString(); initialModel.Text = messageTxt.Text; initialModel.ForumType = "league"; initialModel.UserId = SettingsMobile.Instance.User.LoginId.ToString(); bool isSuccuessful = Forum.ReplyToTopic(initialModel); loading.Hide(); this.NavigationController.PopViewControllerAnimated(true); }); this.NavigationItem.SetRightBarButtonItem(button2, false); View.AddSubview(scroll); } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.iPhone); } }
void loginBtn_TouchUpInside(object sender, EventArgs e) { try { if (userNameTxt.Text.Length < 5) userNameTxt.Layer.BorderColor = UIColor.Red.CGColor; else userNameTxt.Layer.BorderColor = UIColor.Purple.CGColor; if (passwordTxt.Text.Length < 5) passwordTxt.Layer.BorderColor = UIColor.Red.CGColor; else passwordTxt.Layer.BorderColor = UIColor.Purple.CGColor; if (derbyNameTxt.Text.Length < 3) derbyNameTxt.Layer.BorderColor = UIColor.Red.CGColor; else derbyNameTxt.Layer.BorderColor = UIColor.Purple.CGColor; if (firstNameTxt.Text.Length < 3) firstNameTxt.Layer.BorderColor = UIColor.Red.CGColor; else firstNameTxt.Layer.BorderColor = UIColor.Purple.CGColor; if (userNameTxt.Text.Length > 4 && passwordTxt.Text.Length > 4 && derbyNameTxt.Text.Length > 2 && firstNameTxt.Text.Length > 2) { loading = new LoadingView(); loading.ShowActivity("signing up"); SettingsMobile.Instance.User.UserName = userNameTxt.Text; SettingsMobile.Instance.User.Password = passwordTxt.Text; var authenticate = User.SignUp(new UserMobile() { IsConnectedToDerby = swith.On, UserName = userNameTxt.Text, Password = passwordTxt.Text, FirstName = firstNameTxt.Text, DerbyName = derbyNameTxt.Text, Position = 1, Gender = 1 }); loading.Hide(); if (authenticate.DidSignUp) { SettingsMobile.Instance.User = authenticate; new SqlFactory().DeleteProfile().InsertProfile(new Mobile.Database.Account.SqlAccount(authenticate)); this.NavigationController.PushViewController(new MainViewController(), true); } else { warningTxt.Text = authenticate.Error; } } } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.iPhone); } }