public static bool IsValidName(string name, TextInputEditText NameET, Activity a) { bool Tr = true; List <string> FN = new List <string>(); FN.Add("Dick"); FN.Add("69"); FN.Add("420"); FN.Add("Sex"); FN.Add("Pussy"); FN.Add("pussy"); FN.Add("dick"); FN.Add("sex"); Tr = name.Length >= 4 && name.Length <= 16; for (int i = 0; i < FN.Count; i++) { if (name.Contains(FN[i]) || !name.All(c => Char.IsLetterOrDigit(c))) { Tr = false; } } if (!Tr) { Toasty.Error(a, "Name InValid", 5, true).Show(); return(Tr); } else { return(Tr); } }
//Makes a big TextInputEditText public bool IsValidName(string name) { bool Tr = true; List <string> FN = new List <string>(); FN.Add("Dick"); FN.Add("69"); FN.Add("420"); FN.Add("Sex"); FN.Add("Pussy"); FN.Add("pussy"); FN.Add("dick"); FN.Add("sex"); Tr = name.Length >= 4 && name.Length <= 16; for (int i = 0; i < FN.Count; i++) { if (name.Contains(FN[i])) { Tr = false; } } if (!Tr) { Toasty.Config.Instance .TintIcon(true) .SetToastTypeface(Typeface.CreateFromAsset(Assets, "Katanf.ttf")); Toasty.Error(this, "Name InValid", 5, true).Show(); return(Tr); } else { return(Tr); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); FindViewById <Button>(Resource.Id.ButtonErrorToast).Click += delegate { Toasty.Error(this, "This is an error toast").Show(); }; FindViewById <Button>(Resource.Id.ButtonSuccessToast).Click += delegate { Toasty.Success(this, "Success").Show(); }; FindViewById <Button>(Resource.Id.ButtonInfoToast).Click += delegate { Toasty.Info(this, "Here is some info for you").Show(); }; FindViewById <Button>(Resource.Id.ButtonWarningToast).Click += delegate { Toasty.Warning(this, "Beware of the dog").Show(); }; FindViewById <Button>(Resource.Id.ButtonNormalToastWithoutIcon).Click += delegate { Toasty.Normal(this, "Normal toast without icon").Show(); }; FindViewById <Button>(Resource.Id.ButtonNormalToastWithIcon).Click += delegate { var icon = ToastyUtils.GetDrawable(this, Resource.Drawable.ic_pets_white_48dp); Toasty.Normal(this, "Normal toast with icon", icon).Show(); }; }
private void OnDateSet(object sender, DatePickerDialog.DateSetEventArgs e) { string txt; if (e.Date.Month < 10 && e.Date.Day < 10) { txt = string.Format("0{0}.0{1}.{2}", e.Date.Day, e.Date.Month, e.Date.Year); } else if (e.Date.Day < 10) { txt = string.Format("0{0}.{1}.{2}", e.Date.Day, e.Date.Month, e.Date.Year); } else if (e.Date.Month < 10) { txt = string.Format("{0}.0{1}.{2}", e.Date.Day, e.Date.Month, e.Date.Year); } else { txt = string.Format("{0}.{1}.{2}", e.Date.Day, e.Date.Month, e.Date.Year); } if (MyStuff.IsDateLegit(e.Date, this)) { DateBtn.Text = txt; } else { Toasty.Config.Instance .TintIcon(true) .SetToastTypeface(Typeface.CreateFromAsset(Assets, "Katanf.ttf")); Toasty.Error(this, "InValid Date", 5, true).Show(); } }
public void BuildStudentsDialog() { StuD = new Dialog(this); StuD.SetContentView(Resource.Layout.MyDialog); StuD.SetCancelable(true); // LinearLayout OAStusLayout = StuD.FindViewById <LinearLayout>(Resource.Id.AbcDEF); // LinearLayout[] LinearList = new LinearLayout[Students.Count]; TextView[] TextViewList = new TextView[Students.Count]; TextView[] TextViewList2 = new TextView[Students.Count]; ScrollView SV = new ScrollView(this); SV.LayoutParameters = new ViewGroup.LayoutParams(950, 1500); OAStusLayout.AddView(SV); LinearLayout ll = new LinearLayout(this); ll.LayoutParameters = MatchParentParams; ll.Orientation = Orientation.Vertical; ll.SetGravity(GravityFlags.CenterHorizontal); if (Students.Count > 0) { for (int i = 0; i < Students.Count; i++) { LinearList[i] = new LinearLayout(this); LinearList[i].LayoutParameters = new LinearLayout.LayoutParams(950, 600); LinearList[i].Orientation = Orientation.Horizontal; LinearList[i].SetBackgroundResource(Resource.Drawable.BlackOutLine); // TextViewList[i] = new TextView(this); TextViewList[i].Text = "Name: " + "\nPhoneNum: " + "\nEmail: " + "\nParent1: " + "\nParent2: " + "\nNotes"; TextViewList[i].LayoutParameters = WrapContParams; TextViewList[i].TextSize = 30; TextViewList[i].Typeface = Typeface.CreateFromAsset(Assets, "Katanf.ttf"); TextViewList[i].SetTextColor(Color.Black); // TextViewList2[i] = new TextView(this); TextViewList2[i].Text = Students[i].name + "\n" + Students[i].phoneNumber + "\n" + Students[i].email + "\n" + Students[i].parentName1 + "\n" + Students[i].parentName2 + "\n" + Students[i].notes; TextViewList2[i].LayoutParameters = WrapContParams; TextViewList2[i].TextSize = 25; TextViewList2[i].Typeface = Typeface.CreateFromAsset(Assets, "Katanf.ttf"); TextViewList2[i].SetTextColor(Color.Red); // LinearList[i].AddView(TextViewList[i]); LinearList[i].AddView(TextViewList2[i]); ll.AddView(LinearList[i]); } SV.AddView(ll); StuD.Show(); } else { Toasty.Error(this, "Group Empty", 5, true).Show(); } }
// Token: 0x0600053B RID: 1339 RVA: 0x0002482C File Offset: 0x00022A2C private async void Handle_Tapped(object sender, EventArgs e) { if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported) { Toasty.Error(CrossCurrentActivity.Current.Activity, AppResource.nophoto); } else if (App.CurNavigationPage != null) { PhotoView.< > c__DisplayClass16_0 CS$ < > 8__locals1 = new PhotoView.< > c__DisplayClass16_0(); if (this.photo.Source != null) { ContentPage contentPage = new ContentPage { BackgroundColor = Color.Black, Title = AppResource.qianfengphoto }; contentPage.Content = new Image { Source = ImageSource.FromStream(() => new MemoryStream(this.File)) }; await App.CurNavigationPage.Navigation.PushAsync(contentPage); } else if (!CrossMedia.Current.IsTakePhotoSupported) { Toasty.Error(CrossCurrentActivity.Current.Activity, "当前相机不允许使用,请检查权限或手机没有摄像头"); } else { CS$ < > 8__locals1.meida = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions { SaveToAlbum = true, Directory = "RFID", CompressionQuality = 75, PhotoSize = PhotoSize.Medium, DefaultCamera = CameraDevice.Rear }); if (CS$ < > 8__locals1.meida != null) { this.photo.Source = ImageSource.FromStream(() => CS$ < > 8__locals1.meida.GetStream()); using (MemoryStream memoryStream = new MemoryStream()) { CS$ < > 8__locals1.meida.GetStream().CopyTo(memoryStream); this.File = memoryStream.ToArray(); } CS$ < > 8__locals1.meida.Dispose(); VisualElement visualElement = this.closeIcon; int num = 1; visualElement.IsVisible = (num != 0); this.HasPhoto = (num != 0); CS$ < > 8__locals1 = null; } } } }
public static bool IsValidSport(string sport, Activity a) { if (sport.Length > 3 && sport.All(c => Char.IsLetterOrDigit(c))) { return(true); } else { Toasty.Error(a, "Sport InValid", 5, true).Show(); return(false); } }
public bool IsValidID(string id) { if (id.Length != 9) { Toasty.Error(this, "ת.ז שגוי", 5, true).Show(); return(false); } else { return(true); } }
//Building the AddStudent Screen private void AddStudentButton_Click(object sender, EventArgs e) { if (IsValidName(NameAddStudentET.Text) && MyStuff.isValidEmail(EmailAddStudentET.Text, this) && currGroup != "Choose Group") { if (Parent1NameAddStudentET.Text != "" && Parent2NameAddStudentET.Text != "") { student = new Student(NameAddStudentET.Text, PhoneNumAddStudentET.Text, EmailAddStudentET.Text, Parent1NameAddStudentET.Text, Parent2NameAddStudentET.Text, AddStudentExplenationET.Text, currGroup); } if (Parent1NameAddStudentET.Text == "" && Parent2NameAddStudentET.Text != "") { student = new Student(NameAddStudentET.Text, PhoneNumAddStudentET.Text, EmailAddStudentET.Text, Parent2NameAddStudentET.Text, AddStudentExplenationET.Text, currGroup); } if (Parent1NameAddStudentET.Text != "" && Parent2NameAddStudentET.Text == "") { student = new Student(NameAddStudentET.Text, PhoneNumAddStudentET.Text, EmailAddStudentET.Text, Parent1NameAddStudentET.Text, AddStudentExplenationET.Text, currGroup); } if (Parent1NameAddStudentET.Text == "" && Parent2NameAddStudentET.Text == "") { student = new Student(NameAddStudentET.Text, PhoneNumAddStudentET.Text, EmailAddStudentET.Text, AddStudentExplenationET.Text, currGroup); } HashMap map = new HashMap(); map.Put("Name", student.name); map.Put("PhoneNum", student.phoneNumber); map.Put("Email", student.email); map.Put("Parent1", student.parentName1); map.Put("Parent2", student.parentName2); map.Put("Notes", student.notes); map.Put("Group", student.group); DocumentReference docref = database.Collection("Users").Document(admin.email).Collection("Students").Document(student.name + " " + student.phoneNumber); docref.Set(map); Toasty.Config.Instance .TintIcon(true) .SetToastTypeface(Typeface.CreateFromAsset(Assets, "Katanf.ttf")); Toasty.Success(this, "Student Added Sucesfully", 5, true).Show(); NameAddStudentET.Text = ""; PhoneNumAddStudentET.Text = "05"; EmailAddStudentET.Text = ""; Parent1NameAddStudentET.Text = ""; Parent2NameAddStudentET.Text = ""; AddStudentExplenationET.Text = ""; spin.SetSelection(0); } else { Toasty.Config.Instance .TintIcon(true) .SetToastTypeface(Typeface.CreateFromAsset(Assets, "Katanf.ttf")); Toasty.Error(this, "Input InValid", 5, true).Show(); } }
private void SendButton_Click(object sender, EventArgs e) { if (Validinput() && c) { if (!CB1.Checked || !CB2.Checked) { Toasty.Error(this, "אנא סמן ווי בשתי בתיבות", 5, false).Show(); } else { List <string> ts = new List <string>(); ts.Add("שם: " + NameET.Text); ts.Add("\nת.ז: " + IDET.Text); ts.Add("\nאגודה: " + AGUDAET.Text); ts.Add("\nמצהיר כי ערכתי היום בדיקה למדידת חום גוף, בה נמצא כי חום גופי אינו עולה על 38 מעלות צלזיוס"); ts.Add("\nוכי איני משתעל/ת וכן כי אין לי קשיים בנשימה"); string toSend = ""; for (int i = 0; i < ts.Count; i++) { toSend += ts[i]; } var content = toSend; var destinationAdd = CurrNumber; SmsManager sm = SmsManager.Default; if (content.Length >= 150) { List <string> parts = new List <string>(); var enumerable = Enumerable.Range(0, content.Length / 20).Select(i => content.Substring(i * 20, 20)); parts = enumerable.ToList(); sm.SendMultipartTextMessage(destinationAdd, null, parts, null, null); } else { sm.SendTextMessage(destinationAdd /*מספר טלפון*/, null, content /*תכולה*/, null, null); } var editor = sp.Edit(); editor.PutString("Name", NameET.Text); editor.PutString("ID", IDET.Text); editor.PutString("AGUDA", AGUDAET.Text); editor.Commit(); Toasty.Success(this, "הצהרה נשלחה בהצלחה", 5, true).Show(); var activity = (Activity)this; activity.FinishAffinity(); } } else { Toasty.Error(this, "שגיאה", 5, true).Show(); } }
public bool IsValidName(string name) { bool Tr = true; Tr = name.Length >= 4; if (!Tr) { Toasty.Error(this, "שגיאה בשם", 5, true).Show(); return(false); } else { return(Tr); } }
public static bool isValidEmail(string email, Activity c) { if (Patterns.EmailAddress.Matcher(email).Matches()) { return(true); } else { Toasty.Config.Instance .TintIcon(true); Toasty.Error(c, "MailInvalid", 5, true).Show(); return(false); } //https://www.c-sharpcorner.com/article/how-to-validate-an-email-address-in-xamarin-android-app-using-visual-studio-2015/ @Delpin Susai Raj }
//Firebase defining public static bool IsDateLegit(DateTime date, Activity a) { DateTime today = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day); DateTime EndDate = new DateTime(DateTime.Today.Year + 1, DateTime.Today.Month, DateTime.Today.Day); if (date.CompareTo(today) >= 0 && date.CompareTo(EndDate) <= 0) { return(true); } else { Toasty.Error(a, "InValid Date", 5, true); return(false); } }
//Final Send MyButton private bool InputLegit() { bool tr = false; if (currGroup != "Choose Group") { tr = true; } else { Toasty.Error(this, "Choose Group", 5, true).Show(); tr = false; } return(tr); }
//This is called after camera took a picture private void LoginButton1_Click(object sender, System.EventArgs e) { ButtonLoginLayout1.RequestFocus(); string mail = MailLoginET1.Text; if (MyStuff.isValidEmail(mail, this)) { if (MyStuff.Emails.Contains(mail)) { GetAdmin(mail); } else { Toasty.Error(this, "Email Not Found", 5, true); MailLoginET1.Text = ""; } } }
public bool Validinput() { if (NameET.Text == "") { Toasty.Error(this, "שם ריק", 3, true).Show(); return(false); } if (IDET.Text == "") { Toasty.Error(this, "ת.ז ריק", 3, true).Show(); return(false); } if (AGUDAET.Text == "") { Toasty.Error(this, "אגודה ריקה", 3, true).Show(); return(false); } return(IsValidName(NameET.Text) && IsValidID(IDET.Text)); }
private void SendBtn_Click(object sender, EventArgs e) { if (DateBtn.Text != "Date") { //add to firebase HashMap map = new HashMap(); map.Put("Date", DateBtn.Text); map.Put("Group", LocationET.Text + " " + TimeBtn.Text + " " + AgeET.Text); DocumentReference docref = database.Collection("Users").Document(admin.email).Collection("Meetings").Document(); docref.Set(map); HashMap map2 = new HashMap(); Toasty.Success(this, "Meeting Added Sucesfully", 5, true).Show(); Intent intent1 = new Intent(this, typeof(MainPageActivity)); StartActivity(intent1); } else { Toasty.Error(this, "Pick Date", 5, true).Show(); } }
//Building Register Screen private void LoginButton_Click(object sender, System.EventArgs e) { if (!MyStuff.Emails.Contains(MailLoginET.Text)) { //validation of input if (MyStuff.IsValidName(NameLoginET.Text, NameLoginET, this) && MyStuff.IsValidSport(SportLoginET.Text, this) & MyStuff.isValidEmail(MailLoginET.Text, this) && PhoneNumberLoginET.Text.Length == 10 && PhoneNumberLoginET.Text.ToString().All(c => Char.IsLetterOrDigit(c))) { string image = ""; try { image = MyStuff.ConvertBitMapToString(BitProfilePic); } catch { }; Toasty.Config.Instance .TintIcon(true) .SetToastTypeface(Typeface.CreateFromAsset(Assets, "Katanf.ttf")); admin = new Admin1(SportLoginET.Text, NameLoginET.Text, PhoneNumberLoginET.Text, MailLoginET.Text, image); HashMap map = new HashMap(); map.Put("Name", admin.name); map.Put("EMail", admin.email); map.Put("PhoneNum", admin.phoneNumber); map.Put("Sport", admin.sport); map.Put("Profile", admin.ProfilePic); DocumentReference DocRef = database.Collection("Users").Document(admin.email); DocRef.Set(map); MyStuff.PutToShared(admin); Intent intent1 = new Intent(this, typeof(MainPageActivity)); Toasty.Success(this, "Edited successfully", 5, true).Show(); // SmsManager sm = SmsManager.Default; sm.SendTextMessage(PhoneNumberLoginET.Text /*מספר טלפון*/, null, "Welcome to T-POV, " + NameLoginET.Text + "!" /*תכולה*/, null, null); // StartActivity(intent1); } } else { Toasty.Error(this, "Email Already In Database", 5, true).Show(); MailLoginET.Text = ""; } }
private bool InputValid(string location, string ageRange, string grouplvl, bool cb) { int x = -1; if (location != "" && ageRange != "" && grouplvl != "" && TimeButton.Text != "Select Time") { return(true); } else { if (location == "" && ageRange != "" && grouplvl != "" && cb) { x = 0; } else if (location != "" && ageRange == "" && grouplvl != "" && cb) { x = 1; } else if (location != "" && ageRange != "" && grouplvl == "" && cb) { x = 2; } else if (location != "" && ageRange != "" && grouplvl != "" && !cb) { x = 4; } else if (location != "" && ageRange != "" && grouplvl != "" && cb) { x = 5; } else { x = 3; } } switch (x) { case 0: Toasty.Config.Instance .TintIcon(true) .SetToastTypeface(Typeface.CreateFromAsset(Assets, "Katanf.ttf")); Toasty.Error(this, "Location InValid", 5, true).Show(); return(false); case 1: Toasty.Config.Instance .TintIcon(true) .SetToastTypeface(Typeface.CreateFromAsset(Assets, "Katanf.ttf")); Toasty.Error(this, "Age Range InValid", 5, true).Show(); return(false); case 2: Toasty.Config.Instance .TintIcon(true) .SetToastTypeface(Typeface.CreateFromAsset(Assets, "Katanf.ttf")); Toasty.Error(this, "Group Level InValid", 5, true).Show(); return(false); case 3: Toasty.Config.Instance .TintIcon(true) .SetToastTypeface(Typeface.CreateFromAsset(Assets, "Katanf.ttf")); Toasty.Error(this, "Some Imputs Are InValid", 5, true).Show(); return(false); case 4: Toasty.Config.Instance .TintIcon(true) .SetToastTypeface(Typeface.CreateFromAsset(Assets, "Katanf.ttf")); Toasty.Error(this, "The Competitivness Was'nt Clicked", 5, true).Show(); return(false); default: return(false); } }
public void ShowErrorToast(string message, bool longToast = false) { var toastLength = GetToastLength(longToast); Toasty.Error(Application.Context, message, toastLength, true).Show(); }