private void ManipulateValue(TextBox tb, ValueManipulator ValMan) { if (tb.get_HMSType() == HMSType.t || tb.get_HMSType() == HMSType.tt) { AM_PM_Change(tb); return; } int NewValue; if (int.TryParse(tb.Text, out NewValue)) ValMan(tb, NewValue); tb.Focus(); tb.SelectAll(); }
private void DecrementValue(TextBox tb, int NewValue) { NewValue = (NewValue > tb.get_Min()) ? NewValue - 1 : tb.get_Max() - 1; NewValue = AdjustHalfDayHour(tb, NewValue); Value = Value.ResetTime(NewValue, tb.get_HMSType()); }
void AM_PM_Change(TextBox tb) { if (tb.get_HMSType() == HMSType.tt) tb.Text = (tb.Text == SystemDateInfo.AMDesignator) ? SystemDateInfo.PMDesignator : SystemDateInfo.AMDesignator; else // tb.get_HMSType() == HMSType.t { int Idx = TimeCtrlExtensions.Get_t_Idx(); tb.Text = (tb.Text == SystemDateInfo.AMDesignator[Idx].ToString()) ? SystemDateInfo.PMDesignator[Idx].ToString() : SystemDateInfo.AMDesignator[Idx].ToString(); } AM_PM_Handle(tb); }
bool AM_PM_HandleInput(TextBox tb, string InputTxt, string AM_PM_Designator, int Idx) { if (string.Compare(InputTxt, AM_PM_Designator[Idx].ToString(), true) == 0) { if (tb.get_HMSType() == HMSType.tt) tb.Text = AM_PM_Designator; else // tb.get_HMSType() == HMSType.t tb.Text = AM_PM_Designator[Idx].ToString(); AM_PM_Handle(tb); return true; } return false; }
void AM_PM_Handle(TextBox tb) { bool IsAm; if (tb.get_HMSType() == HMSType.tt) IsAm = (tb.Text == SystemDateInfo.AMDesignator); else // tb.get_HMSType() == HMSType.t IsAm = (tb.Text == SystemDateInfo.AMDesignator[TimeCtrlExtensions.Get_t_Idx()].ToString()); Value = Value.Reset_AM_PM_Time(IsAm); tb.SelectAll(); }