protected override Dialog OnCreateDialog(int id) { switch (id) { case DIALOG_YES_NO_MESSAGE: { var builder = new AlertDialog.Builder (this); builder.SetIconAttribute (Android.Resource.Attribute.AlertDialogIcon); builder.SetTitle (Resource.String.alert_dialog_two_buttons_title); builder.SetPositiveButton (Resource.String.alert_dialog_ok, OkClicked); builder.SetNegativeButton (Resource.String.alert_dialog_cancel, CancelClicked); return builder.Create (); } case DIALOG_YES_NO_OLD_SCHOOL_MESSAGE: { var builder = new AlertDialog.Builder (this, Android.App.AlertDialog.ThemeTraditional); builder.SetIconAttribute (Android.Resource.Attribute.AlertDialogIcon); builder.SetTitle (Resource.String.alert_dialog_two_buttons_title); builder.SetPositiveButton (Resource.String.alert_dialog_ok, OkClicked); builder.SetNegativeButton (Resource.String.alert_dialog_cancel, CancelClicked); return builder.Create (); } case DIALOG_YES_NO_HOLO_LIGHT_MESSAGE: { var builder = new AlertDialog.Builder (this, Android.App.AlertDialog.ThemeHoloLight); builder.SetIconAttribute (Android.Resource.Attribute.AlertDialogIcon); builder.SetTitle (Resource.String.alert_dialog_two_buttons_title); builder.SetPositiveButton (Resource.String.alert_dialog_ok, OkClicked); builder.SetNegativeButton (Resource.String.alert_dialog_cancel, CancelClicked); return builder.Create (); } case DIALOG_YES_NO_LONG_MESSAGE: { var builder = new AlertDialog.Builder (this); builder.SetIconAttribute (Android.Resource.Attribute.AlertDialogIcon); builder.SetTitle (Resource.String.alert_dialog_two_buttons_msg); builder.SetMessage (Resource.String.alert_dialog_two_buttons_msg); builder.SetPositiveButton (Resource.String.alert_dialog_ok, OkClicked); builder.SetNegativeButton (Resource.String.alert_dialog_cancel, CancelClicked); builder.SetNeutralButton (Resource.String.alert_dialog_something, NeutralClicked); return builder.Create (); } case DIALOG_YES_NO_ULTRA_LONG_MESSAGE: { var builder = new AlertDialog.Builder (this); builder.SetIconAttribute (Android.Resource.Attribute.AlertDialogIcon); builder.SetTitle (Resource.String.alert_dialog_two_buttons_msg); builder.SetMessage (Resource.String.alert_dialog_two_buttons2ultra_msg); builder.SetPositiveButton (Resource.String.alert_dialog_ok, OkClicked); builder.SetNegativeButton (Resource.String.alert_dialog_cancel, CancelClicked); builder.SetNeutralButton (Resource.String.alert_dialog_something, NeutralClicked); return builder.Create (); } case DIALOG_LIST: { var builder = new AlertDialog.Builder (this); builder.SetTitle (Resource.String.select_dialog); builder.SetItems (Resource.Array.select_dialog_items, ListClicked); return builder.Create (); } case DIALOG_PROGRESS: { progress_dialog = new ProgressDialog (this); progress_dialog.SetIconAttribute (Android.Resource.Attribute.AlertDialogIcon); progress_dialog.SetTitle (Resource.String.select_dialog); progress_dialog.SetProgressStyle (ProgressDialogStyle.Horizontal); progress_dialog.Max = MAX_PROGRESS; progress_dialog.SetButton (Android.App.Dialog.InterfaceConsts.ButtonPositive, GetText (Resource.String.alert_dialog_ok), OkClicked); progress_dialog.SetButton (Android.App.Dialog.InterfaceConsts.ButtonNegative, GetText (Resource.String.alert_dialog_cancel), CancelClicked); return progress_dialog; } case DIALOG_SINGLE_CHOICE: { var builder = new AlertDialog.Builder (this); builder.SetIconAttribute (Android.Resource.Attribute.AlertDialogIcon); builder.SetTitle (Resource.String.alert_dialog_single_choice); builder.SetSingleChoiceItems (Resource.Array.select_dialog_items2, 0, ListClicked); builder.SetPositiveButton (Resource.String.alert_dialog_ok, OkClicked); builder.SetNegativeButton (Resource.String.alert_dialog_cancel, CancelClicked); return builder.Create (); } case DIALOG_MULTIPLE_CHOICE: { var builder = new AlertDialog.Builder (this); builder.SetIcon (Resource.Drawable.ic_popup_reminder); builder.SetTitle (Resource.String.alert_dialog_multi_choice); builder.SetMultiChoiceItems (Resource.Array.select_dialog_items3, new bool[] { false, true, false, true, false, false, false }, MultiListClicked); builder.SetPositiveButton (Resource.String.alert_dialog_ok, OkClicked); builder.SetNegativeButton (Resource.String.alert_dialog_cancel, CancelClicked); return builder.Create (); } case DIALOG_MULTIPLE_CHOICE_CURSOR: { var projection = new string[] { BaseColumns.Id, Contacts.PeopleColumns.DisplayName, Contacts.PeopleColumns.SendToVoicemail }; var cursor = ManagedQuery (ContactsContract.Contacts.ContentUri, projection, null, null, null); var builder = new AlertDialog.Builder (this); builder.SetIcon (Resource.Drawable.ic_popup_reminder); builder.SetTitle (Resource.String.alert_dialog_multi_choice_cursor); builder.SetMultiChoiceItems (cursor, Contacts.PeopleColumns.SendToVoicemail, Contacts.PeopleColumns.DisplayName, MultiListClicked); return builder.Create (); } case DIALOG_TEXT_ENTRY: { // This example shows how to add a custom layout to an AlertDialog var factory = LayoutInflater.From (this); var text_entry_view = factory.Inflate (Resource.Layout.alert_dialog_text_entry, null); var builder = new AlertDialog.Builder (this); builder.SetIconAttribute (Android.Resource.Attribute.AlertDialogIcon); builder.SetTitle (Resource.String.alert_dialog_text_entry); builder.SetView (text_entry_view); builder.SetPositiveButton (Resource.String.alert_dialog_ok, OkClicked); builder.SetNegativeButton (Resource.String.alert_dialog_cancel, CancelClicked); return builder.Create (); } } return null; }
protected override Dialog OnCreateDialog(int id) { switch(id) { case (int)Utilities.DIALOGTYPE.DIALOG_PROGRESS: // DIALOG_PROGRESS { progressDialog = new ProgressDialog (this); progressDialog.SetIconAttribute (Android.Resource.Attribute.AlertDialogIcon); progressDialog.SetTitle (Resources.GetString(Resource.String.DownloadingOffline)); progressDialog.SetProgressStyle (ProgressDialogStyle.Horizontal); progressDialog.Max = 100; return progressDialog; } default: { return base.OnCreateDialog(id); } } }