Esempio n. 1
0
 protected virtual void OnValueChanged(object sender, EventArgs e)
 {
     if (!this.DisableEvents)
     {
         if ((this.GetDate() == null) && (this.Style != RescoDateTimePickerStyle.Time))
         {
             this.m_TimeCombo.Enabled = false;
         }
         else
         {
             this.m_TimeCombo.Enabled = true;
         }
         if (this.AllowNone)
         {
             DateTimePickerInterface.InvokeSetProperty(this.m_TimeCombo, "IsNone", DateTimePickerInterface.InvokeGetProperty(this.m_DateTime, "IsNone"));
         }
         else
         {
             DateTimePickerInterface.InvokeSetProperty(this.m_DateTime, "IsNone", false);
             DateTimePickerInterface.InvokeSetProperty(this.m_TimeCombo, "IsNone", false);
         }
         this.m_TimeCombo.Invalidate();
         if (this.ValueChanged != null)
         {
             this.ValueChanged(this, EventArgs.Empty);
         }
     }
 }
Esempio n. 2
0
 protected override void Hide()
 {
     if (this.EditControl != null)
     {
         DateTimePickerInterface.SetDroppedDown(this.EditControl, false);
         this.EditControl.Hide();
         DateTimePickerInterface.RemoveValueChangedEvent(this.EditControl, new EventHandler(this.OnValueChanged));
         DateTimePickerInterface.RemoveNoneSelectedEvent(this.EditControl, new EventHandler(this.OnValueChanged));
     }
     base.Hide();
     this.EditControl = null;
 }
Esempio n. 3
0
 private bool SetFormat(string strFormat)
 {
     try
     {
         DateTimePickerInterface.InvokeSetProperty(this.m_DateTime, "Format", 8);
         DateTimePickerInterface.InvokeSetProperty(this.m_DateTime, "CustomFormat", strFormat);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Esempio n. 4
0
 private void SetDate(object objNewDate)
 {
     DateTimePickerInterface.InvokeSetProperty(this.m_DateTime, "IsNone", false);
     DateTimePickerInterface.InvokeSetProperty(this.m_TimeCombo, "IsNone", false);
     DateTimePickerInterface.InvokeSetProperty(this.m_DateTime, "Value", Convert.ToDateTime(objNewDate));
     try
     {
         DateTimePickerInterface.InvokeSetProperty(this.m_TimeCombo, "Value", Convert.ToDateTime(objNewDate));
     }
     catch
     {
         DateTimePickerInterface.InvokeSetProperty(this.m_TimeCombo, "Value", DateTime.Now);
     }
 }
Esempio n. 5
0
 private void OnValueChanged(object sender, EventArgs e)
 {
     if (this.EditControl != null)
     {
         if (this.AllowNoneTime && !DateTimePickerInterface.GetChecked(this.EditControl))
         {
             this.EditValue = null;
         }
         else
         {
             this.TimeSpan = DateTimePickerInterface.GetValue(this.EditControl).TimeOfDay;
         }
     }
 }
Esempio n. 6
0
        private object GetDate()
        {
            if (this.AllowNone && ((bool)DateTimePickerInterface.InvokeGetProperty(this.m_DateTime, "IsNone")))
            {
                return(null);
            }
            DateTime time = (DateTime)DateTimePickerInterface.InvokeGetProperty(this.m_DateTime, "Value");

            if (this.Style == RescoDateTimePickerStyle.Date)
            {
                return(time);
            }
            DateTime time2 = (DateTime)DateTimePickerInterface.InvokeGetProperty(this.m_TimeCombo, "Value");

            return(new DateTime(time.Year, time.Month, time.Day, time2.Hour, time2.Minute, time2.Second, time2.Millisecond));
        }
Esempio n. 7
0
 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));
         }
     }
 }
Esempio n. 8
0
 internal DVTouchDateTimePicker()
 {
     DateTimePickerInterface.InvokeSetProperty(this.m_DateTime, "BorderStyle", BorderStyle.FixedSingle);
     DateTimePickerInterface.InvokeSetProperty(this.m_DateTime, "ShowFocus", false);
     DateTimePickerInterface.InvokeAddEvent(this.m_DateTime, "ValueChanged", new EventHandler(this.OnValueChanged));
     base.Controls.Add(this.m_DateTime);
     this.m_DateTime.BringToFront();
     this.m_TimeCombo         = Activator.CreateInstance(DateTimePickerInterface.GetTouchDateTimePickerType()) as Control;
     this.m_TimeCombo.Visible = false;
     this.m_TimeCombo.Bounds  = new Rectangle(0, 0, 60, 0);
     DateTimePickerInterface.InvokeSetProperty(this.m_TimeCombo, "Format", 0x10);
     DateTimePickerInterface.InvokeSetProperty(this.m_TimeCombo, "BorderStyle", BorderStyle.FixedSingle);
     DateTimePickerInterface.InvokeSetProperty(this.m_TimeCombo, "ShowFocus", false);
     DateTimePickerInterface.InvokeAddEvent(this.m_TimeCombo, "ValueChanged", new EventHandler(this.OnValueChanged));
     base.Controls.Add(this.m_TimeCombo);
     this.Style     = RescoDateTimePickerStyle.DateTime;
     this.Format    = DateTimeFormatInfo.CurrentInfo.ShortDatePattern;
     this.AllowNone = true;
     this.NoneText  = "None";
 }
Esempio n. 9
0
 public void Show()
 {
     base.Visible = true;
     base.Focus();
     if (this.Style == RescoDateTimePickerStyle.Time)
     {
         this.m_DateTime.Hide();
         this.m_TimeCombo.Left  = 0;
         this.m_TimeCombo.Width = base.Width;
         DateTimePickerInterface.InvokeSetProperty(this.m_TimeCombo, "CustomFormat", this.Format);
     }
     else
     {
         this.m_DateTime.Size = new Size(ItemDateTime.DTWidth, base.Height);
         this.m_DateTime.Show();
         this.m_TimeCombo.Left  = ItemDateTime.DTWidth;
         this.m_TimeCombo.Width = base.Width - ItemDateTime.DTWidth;
     }
     if (this.Style == RescoDateTimePickerStyle.Date)
     {
         this.m_TimeCombo.Hide();
         this.m_DateTime.Size = new Size(base.Width, base.Height);
         this.m_DateTime.Show();
         this.m_DateTime.Focus();
     }
     else
     {
         this.m_TimeCombo.Show();
     }
     if (this.Style == RescoDateTimePickerStyle.DateTime)
     {
         this.SetFormat(ItemDateTime.GetDateFormatPart(this.Format));
         DateTimePickerInterface.InvokeSetProperty(this.m_TimeCombo, "CustomFormat", ItemDateTime.GetTimeFormatPart(this.Format));
         this.m_DateTime.Focus();
     }
     else if (this.Style == RescoDateTimePickerStyle.Time)
     {
         this.m_TimeCombo.Focus();
     }
 }
Esempio n. 10
0
 internal override Type GetDateTimePickerType()
 {
     return(DateTimePickerInterface.GetTouchDateTimePickerType());
 }
Esempio n. 11
0
 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);
         }
     }
 }