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); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); RequestedOrientation = global::Android.Content.PM.ScreenOrientation.Landscape; // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); SignaturePadView signature = FindViewById<SignaturePadView> (Resource.Id.signatureView); // Get our button from the layout resource, // and attach an event to it Button btnSave = FindViewById<Button> (Resource.Id.btnSave); btnSave.Click += delegate { if (signature.IsBlank) {//Display the base line for the user to sign on. AlertDialog.Builder alert = new AlertDialog.Builder (this); alert.SetMessage ("No signature to save."); alert.SetNeutralButton ("Okay", delegate { }); alert.Create ().Show (); } points = signature.Points; }; btnSave.Dispose (); Button btnLoad = FindViewById<Button> (Resource.Id.btnLoad); btnLoad.Click += delegate { if (points != null) signature.LoadPoints (points); }; btnLoad.Dispose (); }
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; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); button = FindViewById<Button> (Resource.Id.button); button.Click += (o, e) => { // use an array adapter to populate a spinner item from our string array ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleSpinnerItem, villains); // create the spinner and populate it with our items Spinner spinner = new Spinner(this); spinner.LayoutParameters = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); spinner.Adapter = adapter; // handle item selection spinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (ItemSelected); // build the alert dialog AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.SetView(spinner); builder.SetNeutralButton("OK", delegate {}); builder.Show(); }; }
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 (); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); FindViewById<EditText>(Resource.Id.modemPassword).RequestFocus(); FindViewById<Button>(Resource.Id.next).Click += (s,e) => { if(ModemPassword=="") { var diag=new AlertDialog.Builder(this); diag.SetTitle("Device Access Code Required!"); diag.SetMessage("A password or Device Access Code is required! It is usually a 10-digit number printed on your modem"); diag.SetIcon(Android.Resource.Drawable.IcDialogAlert); diag.SetNeutralButton("Ok", new EventHandler<DialogClickEventArgs>((s2, e2) => {} )); diag.Show(); return; } var controller = new Intent(this, typeof(ControllerActivity)); controller.PutExtra("address", ModemAddress); controller.PutExtra("password", ModemPassword); StartActivity(controller); }; // Get our button from the layout resource, // and attach an event to it //must get address and password in this context because it can change later, but other threads can't access it }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); EditText phoneNumberText = FindViewById<EditText>(Resource.Id.PhoneNumberText); Button translateButton = FindViewById<Button>(Resource.Id.TranslateButton); Button callButton = FindViewById<Button>(Resource.Id.CallButton); Button callHistoryButton = FindViewById<Button>(Resource.Id.CallHistoryButton); // "Call" を Disable にします callButton.Enabled = false; // 番号を変換するコードを追加します。 string translatedNumber = string.Empty; translateButton.Click += (object sender, EventArgs e) => { // ユーザーのアルファベットの電話番号を電話番号に変換します。 translatedNumber = Core.PhonewordTranslator.ToNumber(phoneNumberText.Text); if (String.IsNullOrWhiteSpace(translatedNumber)) { callButton.Text = "Call"; callButton.Enabled = false; } else { callButton.Text = "Call " + translatedNumber; callButton.Enabled = true; } }; callButton.Click += (object sender, EventArgs e) => { // "Call" ボタンがクリックされたら電話番号へのダイヤルを試みます。 var callDialog = new AlertDialog.Builder(this); callDialog.SetMessage("Call " + translatedNumber + "?"); callDialog.SetNeutralButton("Call", delegate { // 掛けた番号のリストに番号を追加します。 phoneNumbers.Add(translatedNumber); // Call History ボタンを有効にします。 callHistoryButton.Enabled = true; // 電話への intent を作成します。 var callIntent = new Intent(Intent.ActionCall); callIntent.SetData(Android.Net.Uri.Parse("tel:" + translatedNumber)); StartActivity(callIntent); }); callDialog.SetNegativeButton("Cancel", delegate { }); // アラートダイアログを表示し、ユーザーのレスポンスを待ちます。 callDialog.Show(); }; callHistoryButton.Click += (sender, e) => { var intent = new Intent(this, typeof(CallHistoryActivity)); intent.PutStringArrayListExtra("phone_numbers", phoneNumbers); StartActivity(intent); }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); // Set our view from the "main" layout resource. SetContentView (Resource.Layout.Main); // Get our UI controls from the loaded layout: EditText phoneNumberText = FindViewById<EditText>(Resource.Id.PhoneNumberText); Button translateButton = FindViewById<Button>(Resource.Id.TranslateButton); Button callButton = FindViewById<Button>(Resource.Id.CallButton); Button callHistoryButton = FindViewById<Button> (Resource.Id.CallHistoryButton); // Disable the "Call" button. callButton.Enabled = false; // Add code to translate number. string translatedNumber = string.Empty; translateButton.Click += (object sender, EventArgs e) => { // Translate user's alphanumeric phone number to numeric. translatedNumber = Core.PhonewordTranslator.ToNumber(phoneNumberText.Text); if (String.IsNullOrWhiteSpace(translatedNumber)) { callButton.Text = "Call"; callButton.Enabled = false; } else { callButton.Text = "Call " + translatedNumber; callButton.Enabled = true; } }; callButton.Click += (object sender, EventArgs e) => { // On "Call" button click, try to dial phone number. var callDialog = new AlertDialog.Builder(this); callDialog.SetMessage("Call " + translatedNumber + "?"); callDialog.SetNeutralButton("Call", delegate { // Add dialed number to list of called numbers. phoneNumbers.Add(translatedNumber); // Enable the Call History button. callHistoryButton.Enabled = true; // Create intent to dial phone. var callIntent = new Intent(Intent.ActionCall); callIntent.SetData(Android.Net.Uri.Parse("tel:" + translatedNumber)); StartActivity(callIntent); }); callDialog.SetNegativeButton("Cancel", delegate {}); // Show the alert dialog to the user and wait for response. callDialog.Show(); }; callHistoryButton.Click += (sender, e) => { var intent = new Intent(this, typeof(CallHistoryActivity)); intent.PutStringArrayListExtra("phone_numbers", phoneNumbers); StartActivity(intent); }; }
protected override void OnStart () { base.OnStart (); InitService (); var button1 = FindViewById<Button> (Resource.Id.buttonCalc); button1.Click += (sender, e) => { if (IsBound) { var text1 = FindViewById<EditText> (Resource.Id.value1); var text2 = FindViewById<EditText> (Resource.Id.value2); var result = FindViewById<TextView> (Resource.Id.result); int v1; int v2; int v3; if(Int32.TryParse (text2.Text, out v2) && Int32.TryParse (text1.Text, out v1)) { v3 = Service.Add (v1, v2); } else { v3 = 0; var builder = new AlertDialog.Builder(this); builder.SetMessage("Spaces or special character are not allowed"); builder.SetNeutralButton("OK", (source, eventArgs) => {}); builder.Show(); } result.Text = v3.ToString (); } else { Log.Warn (Tag, "The AdditionService is not bound"); } }; }
void CreateAndShowDialog(string message, string title) { var builder = new AlertDialog.Builder(Forms.Context); builder.SetMessage(message); builder.SetTitle(title); builder.SetNeutralButton("OK", (sender, args) => { }); builder.Create().Show(); }
private void CreateExceptionDialog() { var alert = new AlertDialog.Builder(this); alert.SetTitle("Network Error"); alert.SetMessage("Could not contact the server - please try again later."); alert.SetNeutralButton("OK", (senderAlert, args) => { }); alert.Show(); }
public void alertDebug(String msg) { // Alert user to that an invalid phoneword was entered var myAlert = new AlertDialog.Builder(this); myAlert.SetMessage(msg); myAlert.SetNeutralButton("Ok", delegate { }); myAlert.SetNegativeButton("Cancel", delegate { }); myAlert.Show(); }
void OnItemClick(object sender, AdapterView.ItemClickEventArgs e) { var marker = MarkerData.Markers[e.Position]; var dialog = new AlertDialog.Builder(this); dialog.SetMessage(marker.Title); dialog.SetNeutralButton("OK", delegate { }); dialog.Show(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); EditText phoneNumberText = FindViewById<EditText>(Resource.Id.PhoneNumberText); Button translateButton = FindViewById<Button>(Resource.Id.TranslateButton); Button callButton = FindViewById<Button>(Resource.Id.CallButton); Button callHistoryButton = FindViewById<Button>(Resource.Id.CallHistoryButton); callButton.Enabled = false; string translatedNumber = string.Empty; translateButton.Click += (object sender, EventArgs e) => { translatedNumber = Phoneword.PhoneTranslator.ToNumber(phoneNumberText.Text); if (string.IsNullOrWhiteSpace(translatedNumber)) { callButton.Text = "Call"; callButton.Enabled = false; } else { callButton.Text = "Call " + translatedNumber; callButton.Enabled = true; } }; callButton.Click += (object sender, EventArgs e) => { var callDialog = new AlertDialog.Builder(this); callDialog.SetMessage("Call " + translatedNumber + "?"); callDialog.SetNeutralButton("Call", delegate { //Ajoute le numéro à la liste des numéros appelés phoneNumbers.Add(translatedNumber); //Active le bouton callHistoryButton.Enabled = true; //Crée un Intent pour lancer un appel var callIntent = new Intent(Intent.ActionCall); callIntent.SetData(Android.Net.Uri.Parse("tel:" + translatedNumber)); StartActivity(callIntent); }); callDialog.SetNegativeButton("Cancel", delegate { }); callDialog.Show(); }; callHistoryButton.Click += (object sender, EventArgs e) => { var intent = new Intent(this, typeof(CallHistoryActivity)); intent.PutStringArrayListExtra("phone_numbers", phoneNumbers); StartActivity(intent); }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); EditText txtPhoneNumber = FindViewById<EditText>(Resource.Id.txtPhoneNumber); Button btnTranslate = FindViewById<Button>(Resource.Id.btnTranslate); Button btnCall = FindViewById<Button>(Resource.Id.btnCall); Button btnGetLocation = FindViewById<Button>(Resource.Id.btnLocation); btnCall.Enabled = false; string translatedNumber = string.Empty; btnTranslate.Click += (object o, EventArgs e)=> { translatedNumber = PhoneTranslator.ToNumber(txtPhoneNumber.Text); if (string.IsNullOrWhiteSpace(translatedNumber)) { btnCall.Text = "Call"; btnCall.Enabled = false; } else { btnCall.Text = string.Format("Call {0}", translatedNumber); btnCall.Enabled = true; } }; btnCall.Click += (object o, EventArgs e) => { //初始化对话框 var callDialog = new AlertDialog.Builder(this); //对话框内容 callDialog.SetMessage(string.Format("Call {0}?", translatedNumber)); callDialog.SetNeutralButton("Call", delegate { var callIntent = new Intent(Intent.ActionCall); callIntent.SetData(Android.Net.Uri.Parse("tel:" + translatedNumber)); StartActivity(callIntent); }); callDialog.SetNegativeButton("Cancel", delegate { }); callDialog.Show(); }; btnGetLocation.Click += (o, e) => { // Get Location LocationManager lm = (LocationManager)GetSystemService(LocationService); var tent = new Intent(this, typeof(LocationBroadCast)); var ptent = PendingIntent.GetBroadcast(this, 0, tent, PendingIntentFlags.UpdateCurrent); lm.RequestLocationUpdates(GetBestLocationProvider(lm), 5000, 100, ptent); }; }
private void Ws_RegisterCompleted(object sender, selling.RegisterCompletedEventArgs e) { var callDialog = new AlertDialog.Builder(this); callDialog.SetTitle("Notify"); callDialog.SetMessage(e.Result.Message); callDialog.SetNeutralButton("Ok", delegate { }); callDialog.Show(); }
private void NativeShowAsync() { AlertDialog.Builder dialog = new AlertDialog.Builder(UIElement.StaticContext); if (this.Content != null) { dialog.SetMessage(this.Content); } if (this.Title != null) { dialog.SetTitle(this.Title); } dialog.SetIcon(Android.Resource.Drawable.IcDialogAlert); if(this.Commands == null || this.Commands.Count() < 1) { return; } if (this.Commands.Count() > 0) { dialog.SetNeutralButton(this.Commands[0].Label, (sender, e) => { if (this.Commands[0].Action != null) { this.Commands[0].Action(this.Commands[0]); } }); } if (this.Commands.Count() > 1) { dialog.SetPositiveButton(this.Commands[1].Label, (sender, e) => { if (this.Commands[1].Action != null) { this.Commands[1].Action(this.Commands[1]); } }); } if (this.Commands.Count() > 2) { dialog.SetNegativeButton(this.Commands[2].Label, (sender, e) => { if (this.Commands[2].Action != null) { this.Commands[2].Action(this.Commands[2]); } }); } UIElement.StaticContext.RunOnUiThread( () => dialog.Show()); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Sets the layout to the "Log On" layout SetContentView(Resource.Layout.LogOn); // Sets the font for the title to Din Regular TextView title = FindViewById<TextView>(Resource.Id.textUtsHelps); Typeface titleFont = Typeface.CreateFromAsset(this.Assets, "fonts/din-regular.ttf"); title.SetTypeface(titleFont, TypefaceStyle.Normal); EditText username = FindViewById<EditText>(Resource.Id.editUtsId); EditText password = FindViewById<EditText>(Resource.Id.editPassword); com.refractored.fab.FloatingActionButton logInButton = FindViewById<com.refractored.fab.FloatingActionButton>(Resource.Id.fabLogIn); // Works the "Log-in" button logInButton.Click += async delegate { try { progressDialog = new ProgressDialog(this); ShowProgressDialog(progressDialog, true); await LogIn(username.Text, password.Text); ShowProgressDialog(progressDialog, false); } catch(System.Net.WebException e) { var logInFailAlert = new AlertDialog.Builder(this); logInFailAlert.SetMessage("Server is not responding"); logInFailAlert.SetNeutralButton("OK", delegate { }); ShowProgressDialog(progressDialog, false); logInFailAlert.Show(); } }; // Works the "Forgotten Password" button Button forgottenPasswordButton = FindViewById<Button>(Resource.Id.buttonForgotPassword); forgottenPasswordButton.Click += delegate { // Opens external UTS website where users can change their password SendToUtsResetPassword(); }; // Works the "About HELPS" button Button aboutHelpsButton = FindViewById<Button>(Resource.Id.buttonWhatHelps); aboutHelpsButton.Click += (IntentSender, e) => { ShowAboutHelps(); }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); EditText phoneNumberText = FindViewById<EditText>(Resource.Id.PhoneNumberText); Button translateButton = FindViewById<Button>(Resource.Id.TranslateButton); Button callButton = FindViewById<Button>(Resource.Id.CallButton); //Disable button callButton.Enabled = false; //Add code to translate number string translatedNumber = string.Empty; translateButton.Click += (object sender, EventArgs e) => { // Translate user’s alphanumeric phone number to numeric translatedNumber = Core.PhoneTranslator.ToNumber(phoneNumberText.Text); if (String.IsNullOrWhiteSpace(translatedNumber)) { callButton.Text = "Call"; callButton.Enabled = false; } else { callButton.Text = "Call " + translatedNumber; callButton.Enabled = true; } }; callButton.Click += (object sender, EventArgs e) => { // On "Call" button click, try to dial phone number. var callDialog = new AlertDialog.Builder(this); callDialog.SetMessage("Call "+ translatedNumber + "?"); callDialog.SetNeutralButton( "Call", delegate { // Create intent ti dial phone var callIntent = new Intent(Intent.ActionCall); callIntent.SetData(Android.Net.Uri.Parse("tel:4541139966"));//Call David regardless of actual input //translatedNumber)); StartActivity(callIntent); }); callDialog.SetNegativeButton("Cancel", delegate { }); // Show the alert dialog to the user and wait for response. callDialog.Show(); }; }
public async void ShowMessageDialog(string content, string title) { //var msg = new MessageDialog(content, title); //await msg.ShowAsync(); var dialog = new AlertDialog.Builder(ActivityBase.CurrentActivity); dialog.SetNeutralButton("OK",(sender, args) => {}); dialog.SetTitle(title); dialog.SetMessage(content); dialog.SetCancelable(false); dialog.Show(); }
public static void ShowError (this Activity activity, string title, string message) { var b = new AlertDialog.Builder (activity); b.SetMessage (message); b.SetTitle (title); b.SetNeutralButton ("OK", (s, e) => { ((AlertDialog)s).Cancel (); }); var alert = b.Create (); alert.Show (); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.StaticSurvey); this.SetOrientationBackground(Resource.Id.StaticSurvey); VM = (ParticipateStaticVM)AppModel.VM; layout = FindViewById<LinearLayout>(Resource.Id.optionLayout); btnNext = FindViewById<Button>(Resource.Id.btnNext); btnBack = FindViewById<Button>(Resource.Id.btnBack); btnQuit = FindViewById<Button>(Resource.Id.btnQuit); btnNext.Click += (e, a) => { ClearComponents(); VM.NextQuestion(); InitComponents(); }; btnBack.Click += (e, a) => { ClearComponents(); VM.BackQuestion(); InitComponents(); }; btnQuit.Click += (e, a) => { var builder1 = new AlertDialog.Builder(new ContextThemeWrapper(this, Resource.Style.AlertDialogCustom)); builder1.SetTitle("Exiting..."); builder1.SetMessage("Do you want to save your changes"); builder1.SetPositiveButton("Yes", async delegate { ShowLoading(); var result = await VM.SaveSurveyResponses(); this.progress.Dismiss(); ClearComponents(); this.Finish(); StartActivity(typeof(Home)); }); builder1.SetNegativeButton("No", delegate { ClearComponents(); this.Finish(); StartActivity(typeof(Home)); }); builder1.SetNeutralButton("Cancel", delegate { }); var alert1 = builder1.Show(); ChangeDialogColor(alert1); }; InitComponents(); }
void LoginFailed (string message) { AlertDialog.Builder builder = new AlertDialog.Builder (this); builder.SetTitle ("Ошибка!"); builder.SetMessage (message); builder.SetNeutralButton ("OK", new EventHandler<DialogClickEventArgs> (delegate(object sender, DialogClickEventArgs e) { Log.Info ("retry"); _loginET.Text = ""; _passwordET.Text = ""; })); builder.Show (); }
private void SaveButton_Click(object sender, EventArgs e) { var firstname = FindViewById<EditText>(Resource.Id.firstname); var lastname = FindViewById<EditText>(Resource.Id.lastname); var alert = new AlertDialog.Builder(this); alert.SetTitle("Hi "+firstname.Text+" "+lastname.Text+"!"); alert.SetNeutralButton("OK", (s, args) => { StartActivity(typeof(NewsActivity)); }); alert.Show(); }
public void ShowAlert(string message) { var context = DemoApplication.CurrentActivity; var appName = context.ApplicationInfo.NonLocalizedLabel.ToString(); var alert = new AlertDialog.Builder(context); alert.SetTitle(appName); alert.SetCancelable(true); alert.SetMessage(message); alert.SetNeutralButton( Constants.AlertButtonText, (sender, e) => {}); alert.Show(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); //Get our UI controls from the loaded layout var phoneNumberText = FindViewById<EditText>(Resource.Id.PhoneNumberText); var translateButton = FindViewById<Button>(Resource.Id.TranslateButton); var callButton = FindViewById<Button>(Resource.Id.CallButton); //Disable the "CALL" button callButton.Enabled = false; var translateNumber = string.Empty; translateButton.Click += (sender, args) => { translateNumber = PhonewordTranslator.ToNumber(phoneNumberText.Text); if (string.IsNullOrWhiteSpace(translateNumber)) { callButton.Text = "Call"; callButton.Enabled = false; } else { callButton.Text = $"CALL {translateNumber}"; callButton.Enabled = true; } }; callButton.Click += (sender, e) => { //On "CALL" button click, try to dial phone number var callDialog = new AlertDialog.Builder(this); callDialog.SetMessage($"Call {translateNumber}?"); callDialog.SetNeutralButton("Call", delegate { var callIntent = new Intent(Intent.ActionCall); callIntent.SetData(Android.Net.Uri.Parse($"tel:{translateNumber}")); StartActivity(callIntent); }); callDialog.SetNegativeButton("Cancel", delegate { }); callDialog.Show(); }; }
public override void ActionSheet(ActionSheetConfig config) { var array = config .Options .Select(x => x.Text) .ToArray(); var dlg = new AlertDialog .Builder(this.getTopActivity()) .SetCancelable(false) .SetTitle(config.Title); dlg.SetItems(array, (sender, args) => config.Options[args.Which].Action.TryExecute()); if (config.Destructive != null) dlg.SetNegativeButton(config.Destructive.Text, (sender, e) => config.Destructive.Action.TryExecute()); if (config.Cancel != null) dlg.SetNeutralButton(config.Cancel.Text, (sender, e) => config.Cancel.Action.TryExecute()); Utils.RequestMainThread(() => dlg.Show()); }
private void Btn_Login_Click(object sender, EventArgs e) { string uuid = Android.Provider.Settings.Secure.GetString(this.ContentResolver, Android.Provider.Settings.Secure.AndroidId); if(DataBaseController.instance().Login(uuid , edit_Password.Text) == false) { AlertDialog.Builder dlg = new AlertDialog.Builder(this); dlg.SetTitle("Password is not Correct"); dlg.SetMessage(edit_Password.Text); dlg.SetNeutralButton("OK", (send, arg) => { dlg.Dispose(); }); dlg.Show(); }else { Intent cardListIntent = new Intent(this, typeof(CardListViewActivity)); StartActivity(cardListIntent); } }
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 EditText margaku = FindViewById<EditText>(Resource.Id.margaText); EditText margaMamaku = FindViewById<EditText> (Resource.Id.margaMamaText); EditText margaDoi = FindViewById<EditText> (Resource.Id.margaDoiText); EditText margaMamaDoi = FindViewById<EditText> (Resource.Id.margaMamaDoiText); Button cekButton = FindViewById<Button> (Resource.Id.cekButton); Button koreksiButton = FindViewById<Button> (Resource.Id.koreksiButton); cekButton.Click += (object sender, EventArgs e) => { var cekDialog = new AlertDialog.Builder(this); cekDialog.SetNeutralButton("Oke",delegate { }); cekDialog.SetNegativeButton("Koreksi",delegate { }); if(Itakdo.MargaChecker.isKawinable(margaku.Text,margaMamaku.Text,margaDoi.Text,margaMamaDoi.Text)){ cekDialog.SetMessage("Kamu boleh menikah dengan dia"); } else{ cekDialog.SetMessage("Maaf, adat mengharuskan cinta kalian berakhir"); } cekDialog.Show(); }; koreksiButton.Click += ((sender, e) => { var intent = new Intent(this,typeof(KoreksiActivity)); intent.PutExtra("margaku",margaku.Text); intent.PutExtra("margaMamaku",margaMamaku.Text); intent.PutExtra("margaDoi",margaDoi.Text); intent.PutExtra("margaMamaDoi",margaMamaDoi.Text); StartActivity(intent); }); }
protected void Call_click(object o, EventArgs e) { var callDialog = new AlertDialog.Builder(this); callDialog.SetMessage("Call " + translatedNo + "?"); callDialog.SetNeutralButton("Call", delegate { // Create intent to dial phone var callIntent = new Intent(Intent.ActionCall); callIntent.SetData(Android.Net.Uri.Parse("tel:" + translatedNo)); StartActivity(callIntent); }); callDialog.SetNegativeButton("Cancel", delegate { }); // Show the alert dialog to the user and wait for response. callDialog.Show(); }