private void InitTimePicker(View view) { _timePickerText = view.FindViewById <EditText>(Resource.Id.event_time_text); _timePickerText.Text = DateTime.Now.ToString("hh:mm tt", CultureInfo.InvariantCulture); _timePickerText.Focusable = false; _timePickerText.Click += delegate { var dialog = new TimePickerDialogFragment(Activity, this, Convert.ToDateTime(_timePickerText.Text)); dialog.Show(FragmentManager, "time"); }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.main); SupportActionBar.SetDisplayShowHomeEnabled(true); SupportActionBar.SetIcon(Resource.Drawable.img_avast_logo_small); FindViewById(Resource.Id.message_dialog).Click += (sender, e) => { SimpleDialogFragment.CreateBuilder(this, SupportFragmentManager).SetMessage("Love. Can know all the math in the \'verse but take a boat in the air that you don\'t " + "love? She\'ll shake you off just as sure as a turn in the worlds. Love keeps her in the air when " + "she oughtta fall down...tell you she\'s hurtin\' \'fore she keens...makes her a home.").Show(); }; FindViewById(Resource.Id.message_title_dialog).Click += (sender, e) => { SimpleDialogFragment.CreateBuilder(this, SupportFragmentManager).SetTitle("More Firefly quotes:").SetMessage("Wash: \"Psychic, though? That sounds like something out of science fiction.\"\n\nZoe: \"We live" + " " + "in a space ship, dear.\"\nWash: \"Here lies my beloved Zoe, " + ("my autumn flower ... somewhat less attractive now that she's all corpsified and gross" + ".\"\n\nRiver Tam: \"Also? I can kill you with my brain.\"\n\nKayle: \"Going on a year now, nothins twixed my neathers not run on batteries.\" \n" + "Mal: \"I can't know that.\" \n" + "Jayne: \"I can stand to hear a little more.\"\n\nWash: \"I've been under fire before. " + "Well ... I've been in a fire. Actually, I was fired. I can handle myself.\"")).SetNegativeButtonText("Close").Show(); }; FindViewById(Resource.Id.message_title_buttons_dialog).Click += (sender, e) => { SimpleDialogFragment.CreateBuilder(this, SupportFragmentManager).SetTitle("Do you like this quote?").SetMessage("Jayne: \"Shiny. Let's be bad guys.\"").SetPositiveButtonText("Love").SetNegativeButtonText("Hate").SetNeutralButtonText("WTF?").SetRequestCode(REQUEST_SIMPLE_DIALOG).Show(); }; FindViewById(Resource.Id.long_buttons).Click += (sender, e) => { SimpleDialogFragment.CreateBuilder(this, SupportFragmentManager).SetMessage("How will you decide?").SetPositiveButtonText("Time for some thrillin' heroics!").SetNegativeButtonText("Misbehave").SetNeutralButtonText("Keep flying").Show(); }; FindViewById(Resource.Id.progress_dialog).Click += (sender, e) => { ProgressDialogFragment.CreateBuilder(this, SupportFragmentManager).SetMessage("Mal: I\'m just waiting to see if I pass out. Long story.").SetRequestCode(REQUEST_PROGRESS).Show(); }; FindViewById(Resource.Id.list_dialog_simple).Click += (sender, e) => { ListDialogFragment.CreateBuilder(this, SupportFragmentManager).SetTitle("Your favorite character:").SetItems(new string[] { "Jayne", "Malcolm", "Kaylee", "Wash", "Zoe", "River" }).SetRequestCode(REQUEST_LIST_SIMPLE).Show(); }; FindViewById(Resource.Id.list_dialog_single).Click += (sender, e) => { ListDialogFragment.CreateBuilder(this, SupportFragmentManager).SetTitle("Your favorite character:").SetItems(new string[] { "Jayne", "Malcolm", "Kaylee", "Wash", "Zoe", "River" }).SetRequestCode(REQUEST_LIST_SINGLE).SetChoiceMode(AbsListViewChoiceMode.Single).Show(); }; FindViewById(Resource.Id.list_dialog_multiple).Click += (sender, e) => { ListDialogFragment.CreateBuilder(this, SupportFragmentManager).SetTitle("Your favorite character:").SetItems(new string[] { "Jayne", "Malcolm", "Kaylee", "Wash", "Zoe", "River" }).SetRequestCode(REQUEST_LIST_MULTIPLE).SetChoiceMode(AbsListViewChoiceMode.Multiple).SetCheckedItems(new int[] { 1, 3 }).Show(); }; FindViewById(Resource.Id.custom_dialog).Click += (sender, e) => { JayneHatDialogFragment.Show(this); }; FindViewById(Resource.Id.time_picker).Click += (sender, e) => { TimePickerDialogFragment.CreateBuilder(this, SupportFragmentManager).SetDate(new Date()).SetPositiveButtonText(Android.Resource.String.Ok).SetNegativeButtonText(Android.Resource.String.Cancel).SetRequestCode(REQUEST_TIME_PICKER).Show(); }; FindViewById(Resource.Id.date_picker).Click += (sender, e) => { DatePickerDialogFragment.CreateBuilder(this, SupportFragmentManager).SetDate(new Date()).SetPositiveButtonText(Android.Resource.String.Ok).SetNegativeButtonText(Android.Resource.String.Cancel).SetRequestCode(REQUEST_DATE_PICKER).Show(); }; }
private void AppointmentTime_Click(object sender, EventArgs e) { try { TimePickerDialogFragment timeFragment = new TimePickerDialogFragment(this, this, DateTime.Now, ConstantsAndTypes.TIMEPICKER_CONTEXT.Appointment, "Select Appointment Time"); var transaction = FragmentManager.BeginTransaction(); timeFragment.Show(transaction, timeFragment.Tag); } catch (Exception ex) { Log.Error(TAG, "AppointmentTime_Click: Exception - " + ex.Message); if (GlobalData.ShowErrorDialog) { ErrorDisplay.ShowErrorAlert(this, ex, GetString(Resource.String.AppointmentItemTimeSelect), "ResourcesAppointmentItemActivity.AppointmentTime_Click"); } } }