GetFormatPattern ( SimpleDateTimeFormat simpleDateTimeFormat ) { DateTimeFormatInfo oDateTimeFormatInfo = CultureInfo.CurrentCulture.DateTimeFormat; switch (simpleDateTimeFormat) { case SimpleDateTimeFormat.Date: return(oDateTimeFormatInfo.ShortDatePattern); case SimpleDateTimeFormat.Time: return(oDateTimeFormatInfo.ShortTimePattern); case SimpleDateTimeFormat.DateAndTime: return(oDateTimeFormatInfo.ShortDatePattern + " " + oDateTimeFormatInfo.ShortTimePattern); default: Debug.Assert(false); return(null); } }
GetFormatPattern ( SimpleDateTimeFormat simpleDateTimeFormat ) { DateTimeFormatInfo oDateTimeFormatInfo = CultureInfo.CurrentCulture.DateTimeFormat; switch (simpleDateTimeFormat) { case SimpleDateTimeFormat.Date: return (oDateTimeFormatInfo.ShortDatePattern); case SimpleDateTimeFormat.Time: return (oDateTimeFormatInfo.ShortTimePattern); case SimpleDateTimeFormat.DateAndTime: return (oDateTimeFormatInfo.ShortDatePattern + " " + oDateTimeFormatInfo.ShortTimePattern); default: Debug.Assert(false); return (null); } }
EnableControls() { AssertValid(); ExcelColumnFormat eSelectedVertexColumnFormat = this.SelectedVertexColumnFormat; Boolean bEnableMinimumValueToAddTextBox = false; SimpleDateTimeFormat eSimpleDateTimeFormat = SimpleDateTimeFormat.Date; switch (eSelectedVertexColumnFormat) { case ExcelColumnFormat.Other: case ExcelColumnFormat.Number: bEnableMinimumValueToAddTextBox = true; break; case ExcelColumnFormat.Date: break; case ExcelColumnFormat.Time: eSimpleDateTimeFormat = SimpleDateTimeFormat.Time; break; case ExcelColumnFormat.DateAndTime: eSimpleDateTimeFormat = SimpleDateTimeFormat.DateAndTime; break; default: Debug.Assert(false); break; } // Note that the txbMinimumValueToAdd TextBox and the // dtpMinimumValueToAdd DateTimePicker have the same size and location. // Only one is visible at any given time. txbMinimumValueToAdd.Enabled = txbMinimumValueToAdd.Visible = bEnableMinimumValueToAddTextBox; dtpMinimumValueToAdd.Enabled = dtpMinimumValueToAdd.Visible = !bEnableMinimumValueToAddTextBox; dtpMinimumValueToAdd.SimpleFormat = eSimpleDateTimeFormat; btnRemoveSelected.Enabled = (lbxMinimumValues.SelectedIndices.Count > 0); btnRemoveAll.Enabled = (lbxMinimumValues.Items.Count > 0); grpMinimumValues.Enabled = !String.IsNullOrEmpty(cbxVertexColumnName.Text) && (eSelectedVertexColumnFormat != ExcelColumnFormat.Other); }
SetCustomProperties ( DynamicFilterParameters dynamicFilterParameters ) { AssertValid(); Debug.Assert(dynamicFilterParameters is DateTimeFilterParameters); DateTimeFilterParameters oDateTimeFilterParameters = (DateTimeFilterParameters)dynamicFilterParameters; // Set the format of the wrapped control based on the Excel column // format. SimpleDateTimeFormat eDateTimeRangeTrackBarFormat = SimpleDateTimeFormat.Date; switch (oDateTimeFilterParameters.Format) { case ExcelColumnFormat.Date: break; case ExcelColumnFormat.Time: eDateTimeRangeTrackBarFormat = SimpleDateTimeFormat.Time; break; case ExcelColumnFormat.DateAndTime: eDateTimeRangeTrackBarFormat = SimpleDateTimeFormat.DateAndTime; break; default: Debug.Assert(false); break; } this.Format = eDateTimeRangeTrackBarFormat; this.SmallChangeMinutes = Math.Max(1, (Decimal)((base.AvailableMaximum - base.AvailableMinimum). TotalMinutes / 100.0)); }