private void comboBoxCalendarType_SelectedIndexChanged(object sender, EventArgs e) { if (comboBoxCalendarType.SelectedIndex == 0) { calendarTypes = Lifelength.CalendarTypes.Days; } else if (comboBoxCalendarType.SelectedIndex == 1) { calendarTypes = Lifelength.CalendarTypes.Months; } else { calendarTypes = Lifelength.CalendarTypes.Years; } if (readOnly) { //blockValidatindCalendar = true; SetTextBoxCalendarValue(Calendar.TotalDays); //blockValidatindCalendar = false; } else { double calendar; if (double.TryParse(textBoxCalendar.Text, out calendar)) { SetCalendarData(Lifelength.ParseCalendar(calendar, CalendarTypes), false); } } }
private void textBoxCalendar_TextChanged(object sender, EventArgs e) { bool applicable = (!IsNotApplicableString(textBoxCalendar.Text) && textBoxCalendar.Text != ""); if (applicable && !readOnly && takeIntoAccountLifelengthChanging) { try { lifelength.Calendar = Lifelength.ParseCalendar(textBoxCalendar.Text, CalendarTypes); } catch (Exception ex) { return; } } CalendarApplicable = applicable; }
private bool ValidateCalendar() { if (!readOnly) { string text = textBoxCalendar.Text; if (!IsNotApplicableString(text)) { try { TimeSpan value = Lifelength.ParseCalendar(text, CalendarTypes); //todo тут } catch { MessageBox.Show("Invalid value for calendar parameter", new TermsProvider()["SystemName"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } } } return(true); }