private void Inactivehourssettingspreference_PreferenceClick(object sender, Preference.PreferenceClickEventArgs e) { startTimeDialog = new TimePickerDialog(Activity, PreferencesFragmentCompat_starttimepicked, DateTime.Now.Hour, DateTime.Now.Minute, false); if (AwakeHelper.UserHasSetAwakeHours()) { int start = int.Parse(new ConfigurationManager(AppPreferences.Default).RetrieveAValue(ConfigurationParameters.StartSleepTime, "-1")); startTimeDialog.SetMessage("Start hour: "); //here it goes the set start hour, (but in a user readable way) } else { startTimeDialog.SetMessage("Start hour:"); } startTimeDialog.Show(); }
private void EditFinal_Touch(object sender, View.TouchEventArgs e) { if (e.Event.Action == MotionEventActions.Up) { TimePickerDialog timeDialog = new TimePickerDialog(this, TiempoFinal, ViewModel.Dia.Final?.Horas ?? 0, ViewModel.Dia.Final?.Minutos ?? 0, true); timeDialog.SetMessage("Hora de Final"); timeDialog.Show(); ((EditText)sender).RequestFocus(); ((EditText)sender).SetSelection(0); e.Handled = true; } }
private void PreferencesFragmentCompat_starttimepicked(object sender, TimePickerDialog.TimeSetEventArgs e) { startTimeDialog.Dismiss(); isSleepstarttimesetted = true; ConfigurationManager configurationManager = new ConfigurationManager(AppPreferences.Default); configurationManager.SaveAValue(ConfigurationParameters.StartSleepTime, string.Concat(e.HourOfDay.ToString() + e.Minute.ToString())); int end = int.Parse(new ConfigurationManager(AppPreferences.Default).RetrieveAValue(ConfigurationParameters.FinishSleepTime, "-1")); finishTimeDialog = new TimePickerDialog(Activity, PreferencesFragmentCompat_finishtimepicked, DateTime.Now.Hour, DateTime.Now.Minute, false); if (AwakeHelper.UserHasSetAwakeHours()) { finishTimeDialog.SetMessage("Finish hour: "); //here it goes the set finish hour, (but in a user readable way) } else { finishTimeDialog.SetMessage("Finish hour:"); } finishTimeDialog.Show(); }
private Task <Time?> ShowTimePickerDialog(string message = "", int initialHour = 12, int initialMinute = 0) { var tcs = new TaskCompletionSource <Time?>(); TimePickerDialog dialog = new TimePickerDialog (this, AlertDialog.ThemeHoloLight, (s, e) => { tcs.TrySetResult(new Time { Hour = (byte)e.HourOfDay, Minute = (byte)e.Minute }); }, initialHour, initialMinute, true); if (message != "") { dialog.SetMessage(message); } dialog.CancelEvent += (s, e) => { tcs.TrySetResult(null); }; dialog.DismissEvent += (s, e) => { tcs.TrySetResult(null); }; dialog.Show(); return(tcs.Task); }