public override Dialog OnCreateDialog(Bundle bundle) { base.OnCreateDialog (bundle); catalogs = new CheckinShared.CatalogDB (); LayoutInflater inflater = Activity.LayoutInflater; View view = inflater.Inflate (Resource.Layout.AddCatalog, null); EditText textName = view.FindViewById<EditText> (Resource.Id.txtAgregarCatalogo); AlertDialog.Builder builder = new AlertDialog.Builder(Activity); builder.SetTitle ("Crear catálogo"); builder.SetView (view); builder.SetPositiveButton ("Crear", delegate (object sender, DialogClickEventArgs e) { Catalog catalog = new Catalog (); if (textName.Text.Length != 0) { catalog.Name = textName.Text; catalog.Quantity = 0; catalog.UserId = AppHelper.GetCurrentUser(Activity).Id; catalogs.Insert(catalog); catalog.SaveToParse(); Console.WriteLine("ParentFragment: " + ParentFragment); ((CatalogsFragment) ((MainActivity) Activity).CurrentFragment()).AddCatalog(catalog); } }); builder.SetNegativeButton ("Salir", delegate (object sender, DialogClickEventArgs e) { }); return builder.Create (); }
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); }; }
public void DeleteConfirmAlert(string failMessage, int position) { //build incorrect username/password alert and display when called AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle("Confirm Deletion"); alert.SetMessage(failMessage); alert.SetNegativeButton("No", (senderAlert, args) => { //do nothing, return to view }); alert.SetPositiveButton("Yes", (senderAlert, args) => { //delete appointment from database, return to view Core myCore = new Core(persistentData); List<string> myList = new List<string>(); List<string> recieved = new List<string>(); myList.Add("03"); myList.Add(apptID[position]); recieved = myCore.messageHandler(myList); deleteAppointmentEntry(position); }); RunOnUiThread(() => { alert.Show(); }); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); // Set our view from the "main" layout resource SetContentView ( Resource.Layout.Main ); // Resources Button Button1 = FindViewById <Button> (Resource.Id.Button1); Button Button2 = FindViewById <Button> (Resource.Id.Button2); Button Button3 = FindViewById <Button> (Resource.Id.Button3); // Resource CallBacks Button1.Click += delegate { StartActivity ( typeof ( Game ) ); Finish (); }; Button2.Click += delegate { StartActivity ( typeof ( Instructions ) ); Finish (); }; Button3.Click += delegate { AlertDialog.Builder MessageBox = new AlertDialog.Builder ( this ); MessageBox.SetNegativeButton ( "OK", delegate {} ); MessageBox.SetMessage ("Xamarin Studio\n-Hussain Al-Homedawy."); MessageBox.Show (); }; }
public static void Alert(Activity context, string title, string message, bool CancelButton, Action<Result> callback = null) { context.RunOnUiThread(() => { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.SetTitle(title); builder.SetMessage(message); if (callback != null) { builder.SetPositiveButton("Ok", (sender, e) => { callback(Result.Ok); }); if (CancelButton) { builder.SetNegativeButton("Cancel", (sender, e) => { callback(Result.Canceled); }); } } else { builder.SetPositiveButton("OK", (sender, e) => { }); } builder.Show(); }); }
void GetInfo() { // создаем xml-документ XmlDocument xmlDocument = new XmlDocument (); // делаем запрос на получение имени пользователя WebRequest webRequest = WebRequest.Create ("https://api.vk.com/method/users.get.xml?&access_token=" + token); WebResponse webResponse = webRequest.GetResponse (); Stream stream = webResponse.GetResponseStream (); xmlDocument.Load (stream); string name = xmlDocument.SelectSingleNode ("response/user/first_name").InnerText; // делаем запрос на проверку, webRequest = WebRequest.Create ("https://api.vk.com/method/groups.isMember.xml?group_id=20629724&access_token=" + token); webResponse = webRequest.GetResponse (); stream = webResponse.GetResponseStream (); xmlDocument.Load (stream); bool habrvk = (xmlDocument.SelectSingleNode ("response").InnerText =="1"); // выводим диалоговое окно var builder = new AlertDialog.Builder (this); // пользователь состоит в группе "хабрахабр"? if (!habrvk) { builder.SetMessage ("Привет, "+name+"!\r\n\r\nТы не состоишь в группе habrahabr.Не хочешь вступить?"); builder.SetPositiveButton ("Да", (o, e) => { // уточнив, что пользователь желает вступить, отправим запрос webRequest = WebRequest.Create ("https://api.vk.com/method/groups.join.xml?group_id=20629724&access_token=" + token); webResponse = webRequest.GetResponse (); }); builder.SetNegativeButton ("Нет", (o, e) => { }); } else { builder.SetMessage ("Привет, "+name+"!\r\n\r\nОтлично! Ты состоишь в группе habrahabr."); builder.SetPositiveButton ("Ок", (o, e) => { }); } builder.Create().Show(); }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Build Set Meals Dialog var builder = new AlertDialog.Builder(Activity); // Get Layout Inflater var inflator = Activity.LayoutInflater; // Inflate Layout For Password Dialog var dialogView = inflator.Inflate(Resource.Layout.SetMealsDialogFragment, null); // Initialize Properties breakfastEditText = dialogView.FindViewById<EditText>(Resource.Id.editTextBreakfast); lunchEditText = dialogView.FindViewById<EditText>(Resource.Id.editTextLunch); dinnerEditText = dialogView.FindViewById<EditText>(Resource.Id.editTextDinner); // Set Text To Current Meal Values breakfastEditText.Text = MealItem.Breakfast; lunchEditText.Text = MealItem.Lunch; dinnerEditText.Text = MealItem.Dinner; // Set Positive & Negative Buttons builder.SetView(dialogView); builder.SetPositiveButton("Set Meals", HandlePositiveButtonClick); // builder.SetNeutralButton("Clear Meals", HandleNeutralButtonClick); builder.SetNegativeButton("Cancel", HandleNegativeButtonClick); // Build And Return Dialog var dialog = builder.Create(); return dialog; }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Build Password Dialog var builder = new AlertDialog.Builder(Activity); // Get Layout Inflater var inflator = Activity.LayoutInflater; // Inflate Layout For Password Dialog var dialogView = inflator.Inflate(Resource.Layout.AddReminderDialogFragment, null); // Initialize Properties ReminderEditText = dialogView.FindViewById<EditText>(Resource.Id.editTextReminder); // Set Positive & Negative Buttons builder.SetView(dialogView); builder.SetPositiveButton("Add Reminder", HandlePositiveButtonClick); builder.SetNegativeButton("Cancel", HandleNegativeButtonClick); // Build And Return Dialog var dialog = builder.Create(); return dialog; }
public static void AlertYesOrNo(Activity context, string title, string message, Action<Result> callback) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.SetTitle(title); builder.SetMessage(message); if (callback != null) { builder.SetPositiveButton("Yes", (sender, e) => { callback(Result.Ok); }); builder.SetNegativeButton("No", (sender, e) => { callback(Result.Canceled); }); } else { builder.SetPositiveButton("OK", (sender, e) => { }); } builder.Show(); }
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(); }; }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.Splash); new Handler ().PostDelayed (() => { //LoadActivity(); var updateManager = new UpdateManager(this,true); if (updateManager.CheckUpdate()) { var builder = new AlertDialog.Builder (this).SetTitle ("软件升级").SetMessage ("发现新版本,建议更新使用新版本").SetOnKeyListener(this).SetCancelable(false); builder.SetPositiveButton ("下载", (sender, e) => { noticeDialog.Dismiss(); //显示下载对话框,下载 updateManager.ShowDownloadDialog(); }); builder.SetNegativeButton ("以后再说", (sender, e) => { noticeDialog.Dismiss(); LoadActivity(); }); noticeDialog= builder.Create (); noticeDialog.Show(); } else { LoadActivity(); } },2000); // Create your application here }
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 (); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Page_Dialog); var yesNoDialogbutton = FindViewById<Button>(Resource.Id.YesNoDialogButton); yesNoDialogbutton.Click += delegate { var builder = new AlertDialog.Builder(this); builder.SetMessage(Resource.String.knigts_dialog_title); builder.SetPositiveButton(Resource.String.yes, (s, e) => { }); builder.SetNegativeButton(Resource.String.no, (s, e) => { }).Create(); builder.Show(); }; var alertDialogButton = FindViewById<Button>(Resource.Id.AlertDialogButton); alertDialogButton.Click += delegate { ShowDialog(AlertDialog); }; var listDialogButton = FindViewById<Button>(Resource.Id.ListDialogButton); listDialogButton.Click += delegate { ShowDialog(ListDialog); }; var multiChoiceDialogButton = FindViewById<Button>(Resource.Id.MultiChoiceDialogButton); multiChoiceDialogButton.Click += delegate { ShowDialog(MultiChoiceDialog); }; var customViewDialogButton = FindViewById<Button>(Resource.Id.CustomViewDialogButton); customViewDialogButton.Click += delegate { ShowDialog(CustomViewDialog); }; var fragmentDialogsButton = FindViewById<Button>(Resource.Id.FragmentDialogsButton); fragmentDialogsButton.Click += delegate { var intent = new Intent(this, typeof (DialogFragmentActivity)); intent.AddFlags(ActivityFlags.ClearTop); 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); }; }
public bool showConfirmDialog(Context context, string info) { if (!prepareModal()) return false; // reset choice mChoice = false; AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.SetMessage(info); builder.SetCancelable(false); builder.SetPositiveButton("OK", (object o, Android.Content.DialogClickEventArgs e) => { this.mQuitModal = true; this.mChoice = true; builder.Dispose(); }); builder.SetNegativeButton("Cancel", (object o, Android.Content.DialogClickEventArgs e) => { mQuitModal = true; mChoice = false; builder.Dispose(); // probably wrong }); AlertDialog alert = builder.Create(); alert.Show(); doModal(); return mChoice; }
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 } }); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); this.Window.AddFlags(WindowManagerFlags.Fullscreen); // Create your application here ActionBar.NavigationMode = ActionBarNavigationMode.Tabs; SetContentView(Resource.Layout.MainTabLayout); AddTab(Resource.String.tabMain, new MainTabFragment(this)); AddTab(Resource.String.tabCreate, new CreateTabFragment(this)); AddTab(Resource.String.tabSettings, new SettingsTabFragment(this)); //testing tab for layouts - not used //AddTab(Resource.String.tabSettings, new TestTabFragment(this)); LoadPreferences(); if (gVar.apiKey_ == "") { var dlgNoApi = new AlertDialog.Builder(this); dlgNoApi.SetMessage(Resource.String.noAPI); dlgNoApi.SetNegativeButton(Resource.String.ok, delegate { ActionBar.SetSelectedNavigationItem(2); }); dlgNoApi.Show(); } }
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 override bool OnOptionsItemSelected(IMenuItem item) { switch (item.ItemId) { case Resource.Id.mmenu_back: BackupDatabase (); return true; case Resource.Id.mmenu_downdb: var builderd = new AlertDialog.Builder(this); builderd.SetMessage("Confirm to download database from server ? All local data will be overwritten by the downloaded data."); builderd.SetPositiveButton("OK", (s, e) => { DownlooadDb ();;}); builderd.SetNegativeButton("Cancel", (s, e) => { /* do something on Cancel click */ }); builderd.Create().Show(); return true; // case Resource.Id.mmenu_Reset: // //do something // return true; case Resource.Id.mmenu_setting: StartActivity (typeof(SettingActivity)); return true; case Resource.Id.mmenu_logoff: RunOnUiThread(() =>ExitAndLogOff()) ; return true; case Resource.Id.mmenu_downcompinfo: DownloadCompInfo (); return true; case Resource.Id.mmenu_clear: ClearPostedInv (); return true; } return base.OnOptionsItemSelected(item); }
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 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(); }
private void OnLogin(bool p_isLogedIn) { if (p_isLogedIn == false) { RunOnUiThread(() => { AlertDialog.Builder l_alert = new AlertDialog.Builder(this); l_alert.SetMessage("Connection failed..."); l_alert.SetNegativeButton("Cancel", delegate { }); Console.WriteLine("Failed to connect"); l_alert.Show(); }); } else { if (m_checkBox.Checked == true) { m_dataManager.StoreData<string>("login", m_login.Text); m_dataManager.StoreData<string>("password", m_password.Text); } else { m_dataManager.RemoveData("login"); m_dataManager.RemoveData("password"); } m_dataManager.StoreData<bool>("loginCheckBox", m_checkBox.Checked); Console.WriteLine("success to connect"); StartActivity(typeof(ChatActivity)); } }
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); } }
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); }
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 bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.Main); //Vraag om bericht te sturen na het terugkomen van een telefoon if (Globals.CALLED == true){ AlertDialog.Builder sendMessage = new AlertDialog.Builder(this); sendMessage.SetTitle("gegevens verzenden?"); sendMessage.SetMessage("Wil je je naam en Chirogroep per sms versturen?."); sendMessage.SetPositiveButton("Ja", delegate { sendSms(); }); sendMessage.SetNegativeButton("Neen", delegate {}); sendMessage.Show (); } TabHost.TabSpec spec; // Resusable TabSpec for each tab Intent intent; // Reusable Intent for each tab // Create an Intent to launch an Activity for the tab (to be reused) intent = new Intent (this, typeof (Activity1)); intent.AddFlags (ActivityFlags.NewTask); // Initialize a TabSpec for each tab and add it to the TabHost spec = TabHost.NewTabSpec ("Op Bivak"); spec.SetIndicator ("", Resources.GetDrawable (Resource.Drawable.tab_main)); //spec.SetIndicator ("Main", null); spec.SetContent (intent); TabHost.AddTab (spec); // Do the same for the other tabs intent = new Intent (this, typeof (EmergencyActivity)); intent.AddFlags (ActivityFlags.NewTask); spec = TabHost.NewTabSpec ("Emergency"); spec.SetIndicator ("", Resources.GetDrawable (Resource.Drawable.tab_sos_red)); //spec.SetIndicator ("Settings", null); spec.SetContent (intent); TabHost.AddTab (spec); intent = new Intent (this, typeof (FaqActivity)); intent.AddFlags (ActivityFlags.NewTask); spec = TabHost.NewTabSpec ("FAQ"); spec.SetIndicator ("", Resources.GetDrawable (Resource.Drawable.tab_faq)); //spec.SetIndicator ("Settings", null); spec.SetContent (intent); TabHost.AddTab (spec); intent = new Intent (this, typeof (SettingsActivity)); intent.AddFlags (ActivityFlags.NewTask); spec = TabHost.NewTabSpec ("Settings"); spec.SetIndicator ("", Resources.GetDrawable (Resource.Drawable.tab_settings)); //spec.SetIndicator ("Settings", null); spec.SetContent (intent); TabHost.AddTab (spec); TabHost.CurrentTab = 0; }
//keluar bila poster da kena vote public void UnvoteDialog() { var builder = new AlertDialog.Builder (context); builder.SetMessage ("Batalkan undi?"); builder.SetPositiveButton ("Yes", UnlikeOkClicked); builder.SetNegativeButton ("No", (s, e) => Log.Debug ("Vote Cancel", "You have cancel your vote")); builder.Create ().Show (); }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.SetMessage(dlgMessage); builder.SetPositiveButton(dlgYesResID, (s, e) => dlgDidEndDelegate(AndroidDialogResult.Yes)); builder.SetNegativeButton(dlgNoResID, (s, e) => dlgDidEndDelegate(AndroidDialogResult.No)); return builder.Create(); }
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(); }
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); }; }