private void SetResultTime(TimeSpan?timespan) { if (_timePickerDialog.IsShowing) { _timePickerDialog.Dismiss(); } if (_tcsTime == null) { return; } _tcsTime.TrySetResult(timespan); _tcsTime = null; }
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(); }