protected override void UpdateControl(object value) { if (this.EditControl != null) { if (value == null) { if (this.AllowNoneTime) { this.EditControl.Focus(); DateTimePickerInterface.SetChecked(this.EditControl, false); } } else if ((value is System.TimeSpan) || (value is string)) { DateTimePickerInterface.SetValue(this.EditControl, new DateTime(this.StringToTimeSpan(Convert.ToString(value)).Ticks)); } } }
protected override void Click(int yOffset, int parentWidth) { if (this.Enabled) { if (this.EditControl != null) { this.EditControl.Focus(); this.OnGotFocus(this, new ItemEventArgs(this, 0, base.Name)); } else { base.DisableEvents = true; Resco.Controls.DetailView.DetailView parent = base.Parent; System.Windows.Forms.Control control = base.Parent.GetControl(this.GetDateTimePickerType()); if (control != null) { control.ForeColor = base.GetTextForeColor(); control.BackColor = base.GetTextBackColor(); control.Font = base.TextFont; control.Enabled = true; DateTimePickerInterface.SetFormat(control, Resco.Controls.DetailView.DateTimePickerFormat.CustomTime); DateTimePickerInterface.SetCustomFormat(control, this.m_Format); DateTimePickerInterface.SetShowNone(control, this.AllowNoneTime); DateTimePickerInterface.SetShowUpDown(control, this.ShowTimeUpDown); DateTimePickerInterface.SetShowDropDown(control, this.ShowDropDown); DateTimePickerInterface.SetShowTimeNone(control, this.ShowTimeNone); DateTimePickerInterface.SetNoneText(control, this.NoneText); DateTimePickerInterface.SetTimePickerStartTime(control, new DateTime(1, 1, 1, this.m_startTime.Hours, this.m_startTime.Minutes, this.m_startTime.Seconds)); DateTimePickerInterface.SetTimePickerEndTime(control, new DateTime(1, 1, 1, this.m_endTime.Hours, this.m_endTime.Minutes, this.m_endTime.Seconds)); DateTimePickerInterface.SetTimePickerMinuteInterval(control, this.m_minuteInterval); DateTimePickerInterface.SetChecked(control, true); try { if (this.EditValue == null) { DateTimePickerInterface.SetValue(control, DateTime.Now); if (this.AllowNoneTime) { DateTimePickerInterface.SetChecked(control, false); } } else { DateTimePickerInterface.SetValue(control, DateTime.Today.AddTicks(this.TimeSpan.Ticks)); } } catch { DateTimePickerInterface.SetValue(control, DateTime.Now); } this.EditControl = control; DateTimePickerInterface.AddValueChangedEvent(control, new EventHandler(this.OnValueChanged)); DateTimePickerInterface.AddNoneSelectedEvent(control, new EventHandler(this.OnValueChanged)); control.Bounds = this.GetActivePartBounds(yOffset); base.DisableEvents = false; this.OnGotFocus(this, new ItemEventArgs(this, 0, base.Name)); base.DisableEvents = true; if (this.EditControl != null) { this.EditControl.Show(); this.EditControl.Focus(); if (this.DropDownClicked(parentWidth, yOffset)) { DateTimePickerInterface.SetDroppedDown(this.EditControl, true); } } } base.DisableEvents = false; base.Click(yOffset, parentWidth); } } }