void LoginToFacebook(bool allowCancel) { var auth = new OAuth2Authenticator( clientId: "635793476502695", scope: "", authorizeUrl: new Uri("https://m.facebook.com/dialog/oauth/"), redirectUrl: new Uri("http://www.facebook.com/connect/login_success.html")); auth.AllowCancel = allowCancel; // If authorization succeeds or is canceled, .Completed will be fired. auth.Completed += (s, ee) => { if (!ee.IsAuthenticated) { var builder = new AlertDialog.Builder(this); builder.SetMessage("Not Authenticated"); builder.SetPositiveButton("Ok", (o, e) => { }); builder.Create().Show(); return; } // Now that we're logged in, make a OAuth2 request to get the user's info. var request = new OAuth2Request("GET", new Uri("https://graph.facebook.com/me"), null, ee.Account); request.GetResponseAsync().ContinueWith(t => { var builder = new AlertDialog.Builder(this); if (t.IsFaulted) { builder.SetTitle("Error"); builder.SetMessage(t.Exception.Flatten().InnerException.ToString()); } else if (t.IsCanceled) builder.SetTitle("Task Canceled"); else { var obj = JsonValue.Parse(t.Result.GetResponseText()); builder.SetTitle("Logged in"); builder.SetMessage("Name: " + obj["name"]); //Store the account AccountStore.Create(this).Save(ee.Account, "Facebook"); StartActivity(typeof(NewA)); } builder.SetPositiveButton("Ok", (o, e) => { }); builder.Create().Show(); }, UIScheduler); }; var intent = auth.GetUI(this); StartActivity(intent); }
/// <summary> /// 检查更新(自动) /// </summary> /// <param name="a"></param> private void of_update(object a) { Activity activity; activity = a as Activity; if (!stopUpdate) { System.Threading.Thread.Sleep(4000); string ver = Update.of_update(true); string memo = Update.as_UpdateMemo; string ls_isall = Update.as_All; bool lb_MustUpdate = Update.ab_MustUpdate; int enddate = Update.ai_MustUpdateEnddate; if (ver.Substring(0, 2) != "ER") { AlertDialog.Builder builder = new AlertDialog.Builder(activity); if (ls_isall == "Y") builder.SetTitle("软件更新提示:(本次更新需重新下载所有数据)"); else builder.SetTitle("软件更新提示:"); if (!lb_MustUpdate) builder.SetMessage("当前版本为" + Core._publicfuns.of_GetMySysSet("app", "vercode") + "服务器上最新版本为 " + ver + " ,确定下载更新吗?\n" + memo); else builder.SetMessage("当前版本为" + Core._publicfuns.of_GetMySysSet("app", "vercode") + "服务器上最新版本为 " + ver + " \n在" + enddate + "日前未更新软件将不能使用,下载完成后请按提示安装\n" + memo); builder.SetPositiveButton("确定", delegate { if (ls_isall == "Y") { string filename = AccessDB.dbFile; System.IO.File.Delete(filename); } Intent intent = new Intent(); Bundle bu = new Bundle(); bu.PutString("name", "download"); intent.PutExtras(bu); intent.SetClass(activity, typeof(Loading)); activity.StartActivity(intent); }); builder.SetCancelable(false); //过期未更新(不显示取消按钮) if (lb_MustUpdate) { if (int.Parse(DateTime.Now.ToString("yyyyMMdd")) < enddate) builder.SetNegativeButton("取消", delegate { stopUpdate = true; return; }); } else builder.SetNegativeButton("取消", delegate { stopUpdate = true; return; }); activity.RunOnUiThread(() => { builder.Show(); }); } } }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); // Get our button from the layout resource, // and attach an event to it Button button = FindViewById<Button> (Resource.Id.loginButton); button.Click += delegate { //set alert for executing the task var alert = new AlertDialog.Builder (this); alert.SetTitle ("Login Popup"); alert.SetPositiveButton ("OK", (senderAlert, args) => { }); alert.SetMessage ("Logged In"); //run the alert in UI thread to display in the screen RunOnUiThread (() => { alert.Show (); }); }; }
protected override void WriteLine(string textLine, LogEvent logEvent) { if (_activity == null) return; _activity.RunOnUiThread(() => { try { var adBuilder = new AlertDialog.Builder(_activity); adBuilder.SetTitle(string.Format("LogWriter: {0}", logEvent.Logger.LoggingType.Name)); adBuilder.SetMessage(textLine); adBuilder.SetNegativeButton("OK", (s, e) => { var alertDialog = s as AlertDialog; if (alertDialog != null) { alertDialog.Dismiss(); alertDialog.Cancel(); } }); adBuilder.Create().Show(); } catch (Exception e) { // TODO detta måste fixas // something went terribly wrong } }); }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { editText = new EditText (Activity); var builder = new AlertDialog.Builder (Activity); builder.SetTitle ("Add Task") .SetView (editText) .SetPositiveButton ("Go", (e, v) => { ViewModel.SelectedTask.Title = editText.Text; if (ViewModel.SelectedTask.CreateDateTime == new DateTime ()) { ViewModel.SelectedTask.CreateDateTime = DateTime.Now; } ViewModel.SelectedTask.LastModifiedDateTime = DateTime.Now; ViewModel.CommitTask (); ViewModel.StartSelectedTask (); }) .SetNeutralButton("Save", (e, v) => { ViewModel.SelectedTask.Title = editText.Text; if (ViewModel.SelectedTask.CreateDateTime == new DateTime ()) { ViewModel.SelectedTask.CreateDateTime = DateTime.Now; } ViewModel.SelectedTask.LastModifiedDateTime = DateTime.Now; ViewModel.CommitTask (); ViewModel.UnselectTask(); }) .SetNegativeButton("Cancel", (e, v) => { ViewModel.UnselectTask(); }); return builder.Create (); }
public static AlertDialog ShowInformation(this Activity activity, string title, string message, string buttonText, Action button = null) { AlertDialog dialog = null; var builder = new AlertDialog.Builder(activity); builder.SetTitle(title); builder.SetMessage(message); builder.SetNegativeButton(buttonText, (s, e) => { if (dialog == null) { return; } dialog.Cancel(); dialog.Dismiss(); if (button != null) { button(); } }); dialog = builder.Show(); return dialog; }
public void Display (string body, string title, GoalsAvailable availableGoal, string cancelButtonTitle, string acceptButtonTitle = "", Action<GoalsAvailable, int> action = null) { EditText goalTextBox = new EditText (Forms.Context); AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder (Forms.Context); alertDialogBuilder.SetTitle (title); alertDialogBuilder.SetMessage (body); alertDialogBuilder.SetView (goalTextBox); goalTextBox.InputType = Android.Text.InputTypes.NumberFlagSigned; var inputFilter = new Android.Text.InputFilterLengthFilter (7); var filters = new Android.Text.IInputFilter[1]; filters [0] = inputFilter; goalTextBox.SetFilters (filters); goalTextBox.InputType = Android.Text.InputTypes.ClassNumber; alertDialogBuilder.SetPositiveButton ("OK", (senderAlert, args) => { if(action != null) { int goalValue; int.TryParse(goalTextBox.Text, out goalValue); action.Invoke(availableGoal, goalValue); } } ); alertDialogBuilder.SetNeutralButton ("CANCEL", (senderAlert, args) => { } ); alertDialogBuilder.Show (); }
public static void HandleException(AggregateException ex, Activity activity) { AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.SetTitle("One or more Error(s)"); builder.SetMessage("First:" + ex.InnerExceptions.First().Message); builder.Create().Show(); }
public bool Display (string body, string cancelButtonTitle, string acceptButtonTitle = "", Action action = null, bool negativeAction = false) { AlertDialog.Builder alert = new AlertDialog.Builder (Forms.Context); alert.SetTitle ("Alert"); alert.SetMessage (body); alert.SetNeutralButton (cancelButtonTitle, (senderAlert, args) => { }); if (acceptButtonTitle != "") { if (!negativeAction) { alert.SetPositiveButton (acceptButtonTitle, (senderAlert, args) => { if (action != null) { action.Invoke (); } }); } else { alert.SetNegativeButton (acceptButtonTitle, (senderAlert, args) => { if (action != null) { action.Invoke (); } }); } } ((Activity)Forms.Context).RunOnUiThread (() => { alert.Show (); }); return true; }
public MainApp(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer) { // Catch unhandled exceptions // Found at http://xandroid4net.blogspot.de/2013/11/how-to-capture-unhandled-exceptions.html // Add an exception handler for all uncaught exceptions. AndroidEnvironment.UnhandledExceptionRaiser += AndroidUnhandledExceptionHandler; AppDomain.CurrentDomain.UnhandledException += ApplicationUnhandledExceptionHandler; // Save prefernces instance Main.Prefs = new PreferenceValues(PreferenceManager.GetDefaultSharedPreferences(this)); // Get path from preferences or default path string path = Main.Prefs.GetString("filepath", Path.Combine(global::Android.OS.Environment.ExternalStorageDirectory.AbsolutePath, "WF.Player")); try { if (!Directory.Exists (path)) Directory.CreateDirectory (path); } catch { } if (!Directory.Exists (path)) { AlertDialog.Builder builder = new AlertDialog.Builder (this); builder.SetTitle (GetString (Resource.String.main_error)); builder.SetMessage(String.Format(GetString(Resource.String.main_error_directory_not_found), path)); builder.SetCancelable (true); builder.SetNeutralButton(Resource.String.ok,(obj,arg) => { }); builder.Show (); } else { Main.Path = path; Main.Prefs.SetString("filepath", path); } }
public static AlertDialog ShowQuestion(this Activity activity, string title, string message, string positiveButton, string negativeButton, Action positive, Action negative) { AlertDialog dialog = null; var builder = new AlertDialog.Builder(activity); builder.SetTitle(title); builder.SetMessage(message); builder.SetPositiveButton(positiveButton, (s, e) => { dialog.Cancel(); dialog.Dismiss(); if (positive != null) positive(); }); builder.SetNegativeButton(negativeButton, (s, e) => { dialog.Cancel(); dialog.Dismiss(); if (negative != null) negative(); }); dialog = builder.Show(); return dialog; }
protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); SetContentView (Resource.Layout.activity_events); base.debugTextView = (EditText)FindViewById (Resource.Id.debug_output_field_events); selectEventButton = (Button)FindViewById (Resource.Id.select_event_button); sendEventButton = (Button)FindViewById (Resource.Id.send_event_button); EventHandler<DialogClickEventArgs> handler = (s, o) => { // save off selected event selectEventButton.Text = items [o.Which]; lastSelectedEvent = items [o.Which]; sendEventButton.Enabled = true; }; selectEventButton.Click += (sender, e) => { AlertDialog.Builder builder = new AlertDialog.Builder (this); builder.SetTitle ("Select Event"); builder.SetItems (items, handler); builder.Show(); }; // set up click listener for when event is sent sendEventButton.Click += (sender, e) => { tapjoyEvent = new TJEvent(this, lastSelectedEvent, null, eventCallback); tapjoyEvent.EnableAutoPresent(true); tapjoyEvent.Send(); }; }
protected override async void OnResume() { base.OnResume (); Title = DataHolder.Current.CurrentCity.Name; // Load pollutions pollutionService = new PollutionService(Settings.ApiBaseUrl); var pollutions = await pollutionService.GetPollutionForCity(DataHolder.Current.CurrentCity.Zip); if (pollutions == null) { // An error occured var builder = new AlertDialog.Builder(this); builder.SetTitle(GetString(Resource.String.error_header)); builder.SetMessage(GetString(Resource.String.pollution_error_body)); builder.SetPositiveButton (GetString (Android.Resource.String.Ok), (senderAlert, args) => {}); builder.Show(); } else { DataHolder.Current.CurrentPollutions = pollutions; } // Initialize tabs AddPollutionDayTab(Resources.GetString(Resource.String.tab_today), 0); AddPollutionDayTab(Resources.GetString(Resource.String.tab_tomorrow), 1); AddPollutionDayTab(Resources.GetString(Resource.String.tab_aftertomorrow), 2); // Hide loading indicator var loading = FindViewById<ProgressBar> (Resource.Id.pbLoading); loading.Visibility = ViewStates.Gone; }
protected void CreateChatRooms(){ chatroomsAdapter = new ChatRoomsAdapter (this); var chatRoomsListView = FindViewById<ListView> (Resource.Id.chatroomsListView); chatRoomsListView.Adapter = chatroomsAdapter; chatRoomsListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => { ChatRoom currChatRoom = chatroomsAdapter.GetChatRoomAt(e.Position); var intent = new Intent(this, typeof(ChatRoomActivity)); intent.PutExtra("chatroom", currChatRoom.webID); StartActivity(intent); }; chatRoomsListView.ItemLongClick += async (object sender, AdapterView.ItemLongClickEventArgs e) => { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle("Do you want to delete this chatroom?"); alert.SetPositiveButton("Yes", (senderAlert, args) => { ChatRoom currChatRoom = chatroomsAdapter.GetChatRoomAt(e.Position); ParsePush.UnsubscribeAsync (currChatRoom.webID); ChatRoomUser cru = DatabaseAccessors.ChatRoomDatabaseAccessor.DeleteChatRoomUser(DatabaseAccessors.CurrentUser().webID, currChatRoom.webID); DatabaseAccessors.ChatRoomDatabaseAccessor.DeleteChatRoom(currChatRoom.webID); ParseChatRoomDatabase pcrd = new ParseChatRoomDatabase(); pcrd.DeleteChatRoomUserAsync(cru); Console.WriteLine("ERASED"); chatroomsAdapter.NotifyDataSetChanged(); }); alert.SetNegativeButton("No", (senderAlert, args) => { }); alert.Show(); }; }
/// <summary> /// Shows a dialog with title and message. Contains only an OK button. /// </summary> /// <param name="title">Title to display.</param> /// <param name="message">Text to display.</param> public async Task ShowMessage(string title, string message) { var builder = new AlertDialog.Builder(CurrentActivity); builder.SetTitle(title); builder.SetMessage(message); builder.Show(); }
public static void MsgBox(Context context, string msg, string Titolo = "Vegetha", string PositiveText = "OK", Action PositiveAction = null, string NegativeText ="", Action NegativeAction = null) { AlertDialog.Builder d = new AlertDialog.Builder (context); d.SetTitle(Titolo); d.SetMessage (msg); if (PositiveAction != null) { d.SetPositiveButton (PositiveText, (sender, e) => { PositiveAction.Invoke(); }); } else { d.SetPositiveButton (PositiveText, (sender, e) => { }); } if (NegativeAction != null) { d.SetNegativeButton (NegativeText, (sender, e) => { NegativeAction.Invoke (); }); } d.Show (); }
public async void Register(View view) { ProgressDialog dialog = DialogHelper.CreateProgressDialog("Registering...", this); dialog.Show(); RegisterRequest request = new RegisterRequest { FirstName = FindViewById<EditText>(Resource.Id.registerFirstName).Text, LastName = FindViewById<EditText>(Resource.Id.registerLastName).Text, StudentId = FindViewById<EditText>(Resource.Id.registerStudentId).Text, Password = FindViewById<EditText>(Resource.Id.registerPassword).Text }; GenericResponse Response = await Services.Auth.Register(request); dialog.Hide(); if (Response.Success) { AlertDialog.Builder builder = new AlertDialog.Builder(this, Resource.Style.LightDialog); builder.SetTitle("Successfully Registered"); builder.SetMessage("Please check your UTS email for instructions to confirm your account"); builder.SetCancelable(false); builder.SetPositiveButton("OK", delegate { Finish(); }); builder.Show(); } else { DialogHelper.ShowDialog(this, Response.Message, Response.Title); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); #if __ANDROID_14__ Window.RequestFeature(WindowFeatures.ActionBar); ActionBar.SetDisplayHomeAsUpEnabled(ViewModel.CanGoBack); #endif SetContentView(Resource.Layout.identityproviderlistview); _loadingToken = ViewModel.WeakSubscribe(() => ViewModel.LoadingIdentityProviders, (sender, args) => { if (ViewModel.LoadingIdentityProviders) LoadingDialog.Show(); else LoadingDialog.Dismiss(); InvalidateOptionsMenu(); }); ViewModel.LoginError += (sender, args) => { var builder = new AlertDialog.Builder(this); builder.SetTitle("Error"); builder.SetIcon(Android.Resource.Drawable.IcDialogAlert); builder.SetMessage(args.Message); builder.SetPositiveButton("Dismiss", (s, e) => { }); builder.Create().Show(); }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.identityproviderlistview); _loadingToken = ViewModel.WeakSubscribe(() => ViewModel.LoadingIdentityProviders, (sender, args) => { if (ViewModel.LoadingIdentityProviders) LoadingDialog.Show(); else LoadingDialog.Dismiss(); InvalidateOptionsMenu(); }); ViewModel.LoginError += (sender, args) => { var builder = new AlertDialog.Builder(this); builder.SetTitle("Error"); builder.SetIcon(Android.Resource.Drawable.IcDialogAlert); builder.SetMessage(args.Message); builder.SetPositiveButton("Dismiss", (s, e) => { }); builder.Create().Show(); }; }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { base.OnCreate (savedInstanceState); var builder = new AlertDialog.Builder (Activity); var inflater = Activity.LayoutInflater; var view = inflater.Inflate (Resource.Layout.NewTournamentDialogLayout, null); if (view != null) { txtUrl = view.FindViewById<EditText> (Resource.Id.txtNewTournamentURL_Edit); txtSignup = view.FindViewById<EditText> (Resource.Id.txtNewTournamentSignup_Edit); txtSignup_Text = view.FindViewById<TextView> (Resource.Id.txtNewTournamentSignup); btnView = view.FindViewById<Button> (Resource.Id.btnNewTournament_View); txtUrl.Text = json ["tournament"] ["full_challonge_url"]; if (json ["tournament"] ["sign_up_url"] == null) { txtSignup.Visibility = ViewStates.Gone; txtSignup_Text.Visibility = ViewStates.Gone; } else txtSignup.Text = json ["tournament"] ["sign_up_url"]; btnView.Click += BtnView_Click; builder.SetTitle (json ["tournament"] ["name"].ToString ()); builder.SetView (view); } var dialog = builder.Create (); return dialog; }
public static void HandleException(Exception ex, Activity activity) { AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.SetTitle("Error"); builder.SetMessage(ex.Message); builder.Create().Show(); }
public async void ForgotPassword(View view) { ProgressDialog dialog = DialogHelper.CreateProgressDialog("Please wait...", this); dialog.Show(); EditText StudentId = FindViewById<EditText>(Resource.Id.forgotStudentId); AuthService ForgotPasswordService = new AuthService(); GenericResponse Response = await ForgotPasswordService.ForgotPassword(StudentId.Text); dialog.Hide(); if (Response.Success) { AlertDialog.Builder builder = new AlertDialog.Builder(this, Resource.Style.LightDialog); builder.SetTitle("Password Reset Sent"); builder.SetMessage("Please check your emails to reset your password"); builder.SetCancelable(false); builder.SetPositiveButton("OK", delegate { Finish(); }); builder.Show(); } else { DialogHelper.ShowDialog(this, Response.Message, Response.Title); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); RequestWindowFeature(WindowFeatures.NoTitle); SetContentView(Resource.Layout.GetMain); Button back = FindViewById<Button>(Resource.Id.GetMian_cancel); ListView list = FindViewById<ListView>(Resource.Id.GetMian_items); Button save = FindViewById<Button>(Resource.Id.GetMian_save); OnBind(); save.Click += delegate { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.SetTitle("提示:"); builder.SetMessage("确认同步订单吗?"); builder.SetNegativeButton("确定", delegate { string msg = Sync.syncOrder(); AlertDialog.Builder bd = new AlertDialog.Builder(this); bd.SetTitle("提示:"); bd.SetMessage(msg); bd.SetNegativeButton("确定", delegate { }); bd.Show(); }); builder.Show(); }; back.Click += delegate { Intent intent = new Intent(); intent.SetClass(this, typeof(Index)); StartActivity(intent); Finish(); }; new Core.Menu(this); }
private void Dial() { var book = new Xamarin.Contacts.AddressBook(this); book.RequestPermission().ContinueWith(t => { if (!t.Result) { Console.WriteLine("Permission denied by user or manifest"); return; } var validContacts = book.Where(a => a.Phones.Any(b => b.Number.Any())).ToList(); var totalValidContacts = validContacts.Count; if (totalValidContacts < 1) { var alert = new AlertDialog.Builder(this); alert.SetTitle("No valid Contacts Found"); alert.SetMessage("No valid Contacts Found"); } var rnd = new Random(); Contact contact = null; while (contact == null) { contact = validContacts.Skip(rnd.Next(0, totalValidContacts)).FirstOrDefault(); } var urlNumber = Android.Net.Uri.Parse("tel:" + contact.Phones.First().Number); var intent = new Intent(Intent.ActionCall); intent.SetData(urlNumber); this.StartActivity(intent); }, TaskScheduler.FromCurrentSynchronizationContext()); }
public void AskForString(string message, string title, System.Action<string> returnString) { var activity = Mvx.Resolve<IMvxAndroidCurrentTopActivity> ().Activity; var builder = new AlertDialog.Builder(activity); builder.SetIcon(Resource.Drawable.ic_launcher); builder.SetTitle(title ?? string.Empty); builder.SetMessage(message); var view = View.Inflate(activity, Resource.Layout.dialog_add_member, null); builder.SetView(view); var textBoxName = view.FindViewById<EditText>(Resource.Id.name); builder.SetCancelable(true); builder.SetNegativeButton(Resource.String.cancel, delegate { });//do nothign on cancel builder.SetPositiveButton(Resource.String.ok, delegate { if (string.IsNullOrWhiteSpace(textBoxName.Text)) return; returnString(textBoxName.Text.Trim()); }); var alertDialog = builder.Create(); alertDialog.Show(); }
public override bool OnOptionsItemSelected(Android.Views.IMenuItem item) { if (ViewModel.IsBusy) return base.OnOptionsItemSelected(item); switch (item.ItemId) { case Resource.Id.menu_about: var builder = new AlertDialog.Builder(this); builder .SetTitle(Resource.String.menu_about) .SetMessage(Resource.String.about) .SetPositiveButton(Resource.String.ok, delegate { }); AlertDialog alert = builder.Create(); alert.Show(); return true; case Resource.Id.menu_refresh: ViewModel.RefreshLoginCommand.Execute(null); return true; } return base.OnOptionsItemSelected(item); }
public override bool OnOptionsItemSelected(IMenuItem item) { switch (item.ItemId) { case Resource.Id.actionNew: string default_game_name = "Game"; AlertDialog.Builder alert1 = new AlertDialog.Builder(this.Activity); EditText input = new EditText(this.Activity); input.Text = default_game_name; alert1.SetTitle("Game Name"); alert1.SetView(input); alert1.SetPositiveButton("OK", delegate { AddGame(input.Text); }); alert1.SetNegativeButton("Cancel", (s, e) => { }); alert1.Show(); _adapter.NotifyDataSetChanged(); return true; case Resource.Id.actionRefresh: GameData.Service.RefreshCache(); _adapter.NotifyDataSetChanged(); return true; default: return base.OnOptionsItemSelected(item); } }
public static void ShowDialog(Context context, string message, string title) { var builder = new AlertDialog.Builder(context); builder.SetMessage(message); builder.SetTitle(title); builder.Create().Show(); }
public void Login(object sender, EventArgs e) { EditText Email = FindViewById<EditText>(Resource.Id.Email); EditText Password = FindViewById<EditText>(Resource.Id.Password); TextView tex1 = FindViewById<TextView>(Resource.Id.text1); TextView tex2 = FindViewById<TextView>(Resource.Id.text2); EmailSend = Email.Text; PasswordSend = Password.Text; ConnectDatabase data; string HashText = null; if (EmailSend == "" || PasswordSend == "" || EmailSend.Length < 5 || PasswordSend.Length < 5) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetMessage("Invalid Username or Password"); alert.SetTitle("Error"); alert.SetCancelable(true); alert.SetPositiveButton("OK", (EventHandler<DialogClickEventArgs>)null); alert.Show(); } else { StartActivity(typeof(StartPageActivity)); data = new ConnectDatabase(EmailSend, PasswordSend); HashText = data.GetHash; tex1.Text = EmailSend; tex2.Text = HashText; } }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); using (var db = new SQLiteConnection (dbPath)) { db.CreateTable<LogEntry> (); } // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); // Create our database if it does not already exist // Get our button from the layout resource, // and attach an event to it Button addFood = FindViewById<Button> (Resource.Id.AddFoodButton); addFood.Click += (object sender, EventArgs e) => { AlertDialog.Builder addFoodDialogBuilder = new AlertDialog.Builder(this); addFoodDialogBuilder.SetTitle ("I had something to eat and it was:"); addFoodDialogBuilder.SetSingleChoiceItems (choices, -1, clickFoodDialogList); addFoodDialog = addFoodDialogBuilder.Create(); // Show the alert dialog to the user and wait for response. addFoodDialog.Show(); }; }