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 == TimeCtrlExtensions.GetAMDesignatorChar(Idx)) ? TimeCtrlExtensions.GetPMDesignatorChar(Idx) : TimeCtrlExtensions.GetAMDesignatorChar(Idx); } AM_PM_Handle(tb); }
private string GetFormatedStr(TimeEntry te) { string strFormat = ""; string strAMPM = (te.Hour >= 12) ? SystemDateInfo.PMDesignator : SystemDateInfo.AMDesignator; string AMPMShort = (te.Hour >= 12) ? TimeCtrlExtensions.GetPMDesignatorChar(TimeCtrlExtensions.Get_t_Idx()) : TimeCtrlExtensions.GetAMDesignatorChar(TimeCtrlExtensions.Get_t_Idx()); foreach (FrameworkElement fe in TimeCtrls.Children) { strFormat += fe.get_TextFormat(); } return(string.Format(strFormat, te.Hour, te.Hour.Get12Hour(), te.Minute, te.Second, strAMPM, AMPMShort)); }