/// <summary> /// Sets the date-time value in the specified date-time picker /// </summary> /// <param name="dateTimePicker">The date-time picker</param> /// <param name="date">The date to set to</param> public static void SetValue(IDateTimePicker dateTimePicker, DateTime date) { //PropertyInfo propInfo = // dateTimePicker.GetType().GetProperty("Value", BindingFlags.Instance | BindingFlags.Public); //propInfo.SetValue(dateTimePicker, date, new object[] { }); dateTimePicker.Value = date; }
///<summary> /// Returns the current date format, expressed as a string. ///</summary> ///<param name="dateTimePicker"></param> ///<returns>Returns the current date format, expressed as a string.</returns> public static string GetDateFormatString(IDateTimePicker dateTimePicker) { string format = null; switch (dateTimePicker.Format) { case DateTimePickerFormat.Long: format = "D"; break; case DateTimePickerFormat.Short: format = "d"; break; case DateTimePickerFormat.Time: format = "T"; break; case DateTimePickerFormat.Custom: format = dateTimePicker.CustomFormat; break; } if (String.IsNullOrEmpty(format)) { format = "d"; } return(format); }
protected IDateTimePicker GetDateTimePicker(out DateTimePickerMapper dtpMapper, string propertyName) { IDateTimePicker dateTimePicker = GetControlFactory().CreateDateTimePicker(); dtpMapper = new DateTimePickerMapper(dateTimePicker, propertyName, false, GetControlFactory()); return(dateTimePicker); }
///<summary> /// An overridden constructor for controlFactory, propertyName and filterClauseOperator. ///</summary> ///<param name="controlFactory"></param> ///<param name="propertyName"></param> ///<param name="filterClauseOperator"></param> public DateTimePickerFilter(IControlFactory controlFactory, string propertyName, FilterClauseOperator filterClauseOperator) { _controlFactory = controlFactory; _propertyName = propertyName; _filterClauseOperator = filterClauseOperator; _dateTimePicker = _controlFactory.CreateDateTimePicker(); _dateTimePicker.ValueChanged += (sender, e) => FireValueChanged(); }
/// <summary> /// Constructor to initialise a new instance of the class /// </summary> /// <param name="picker">The DateTimePicker control to which the property is mapped</param> /// <param name="propName">The property name</param> /// <param name="isReadOnly">Whether this control is read only</param> /// <param name="factory">The control factory to be used when creating the controlMapperStrategy</param> public DateTimePickerMapper(IDateTimePicker picker, string propName, bool isReadOnly, IControlFactory factory) : base(picker, propName, isReadOnly, factory) { _picker = picker; PropertyName = propName; _dateTimePickerMapperStrategy = factory.CreateDateTimePickerMapperStrategy(); if (_dateTimePickerMapperStrategy == null) return; _dateTimePickerMapperStrategy.AddUpdateBoPropOnValueChangedHandler(this); }
public void TestCreateDateTimePicker() { //---------------Set up test pack------------------- //---------------Execute Test ---------------------- IDateTimePicker dateTimePicker = CreateDateTimePicker(); //---------------Test Result ----------------------- Assert.IsNotNull(dateTimePicker); //---------------Tear Down ----------------------- }
protected IDateTimePicker CreateDateTimePicker() { IDateTimePicker dateTimePicker = GetControlledLifetimeFor(GetControlFactory().CreateDateTimePicker()); DisposeOnTearDown(dateTimePicker); //IFormHabanero form = GetControlFactory().CreateForm(); //form.Controls.Add(dateTimePicker); //form.Visible = true; return(dateTimePicker); }
/// <summary> /// Gets a date-time value from the provided picker /// </summary> /// <param name="dateTimePicker">A date-time picker</param> /// <returns>Returns the DateTime value or null if none was chosen</returns> public static object GetValue(IDateTimePicker dateTimePicker) { PropertyInfo propInfo = dateTimePicker.GetType().GetProperty("Value", BindingFlags.Instance | BindingFlags.Public); object val = propInfo.GetValue(dateTimePicker, new object[] { }); if (val != null) { return (DateTime)val; } return null; }
//private ILabel _displayText; //private event EventHandler _valueChanged; ///<summary> /// The Constructor for the <see cref="DateTimePickerManager"/> ///</summary> ///<param name="controlFactory"></param> ///<param name="dateTimePicker"></param> ///<param name="valueGetter"></param> ///<param name="valueSetter"></param> ///<exception cref="ArgumentNullException"></exception> public DateTimePickerManager(IControlFactory controlFactory, IDateTimePicker dateTimePicker, ValueGetter<DateTime> valueGetter, ValueSetter<DateTime> valueSetter) { if (valueGetter == null) throw new ArgumentNullException("valueGetter"); if (valueSetter == null) throw new ArgumentNullException("valueSetter"); _controlFactory = controlFactory; _dateTimePicker = dateTimePicker; _valueGetter = valueGetter; _valueSetter = valueSetter; SetupNullDisplayBox(); ApplyBlankFormat(); }
private IControlHabanero GetNullDisplayControl(IDateTimePicker dateTimePicker) { if (dateTimePicker == null) { return(null); } if (dateTimePicker.Controls.Count == 0) { return(null); } return(dateTimePicker.Controls[0]); }
/// <summary> /// Gets a date-time value from the provided picker /// </summary> /// <param name="dateTimePicker">A date-time picker</param> /// <returns>Returns the DateTime value or null if none was chosen</returns> public static object GetValue(IDateTimePicker dateTimePicker) { PropertyInfo propInfo = dateTimePicker.GetType().GetProperty("Value", BindingFlags.Instance | BindingFlags.Public); object val = propInfo.GetValue(dateTimePicker, new object[] { }); if (val != null) { return((DateTime)val); } return(null); }
public void TestSetValue() { //---------------Set up test pack------------------- IDateTimePicker dateTimePicker = CreateDateTimePicker(); DateTime testDate = new DateTime(2008, 01, 01, 01, 01, 01); //---------------Execute Test ---------------------- dateTimePicker.Value = testDate; //---------------Test Result ----------------------- Assert.AreEqual(testDate, dateTimePicker.Value); //---------------Tear Down ------------------------- }
/// <summary> /// Constructor to initialise a new instance of the class /// </summary> /// <param name="picker">The DateTimePicker control to which the property is mapped</param> /// <param name="propName">The property name</param> /// <param name="isReadOnly">Whether this control is read only</param> /// <param name="factory">The control factory to be used when creating the controlMapperStrategy</param> public DateTimePickerMapper(IDateTimePicker picker, string propName, bool isReadOnly, IControlFactory factory) : base(picker, propName, isReadOnly, factory) { _picker = picker; PropertyName = propName; _dateTimePickerMapperStrategy = factory.CreateDateTimePickerMapperStrategy(); if (_dateTimePickerMapperStrategy == null) { return; } _dateTimePickerMapperStrategy.AddUpdateBoPropOnValueChangedHandler(this); }
public void TestClick_WhenNotNullStaysAtValue() { //---------------Set up test pack------------------- IDateTimePicker dateTimePicker = CreateDateTimePicker(); dateTimePicker.ValueOrNull = DateTime.Now; //-------------Assert Preconditions ------------- Assert.IsTrue(dateTimePicker.ValueOrNull.HasValue); //---------------Execute Test ---------------------- EventHelper.RaiseEvent(dateTimePicker, "Click"); //---------------Test Result ----------------------- Assert.IsTrue(dateTimePicker.ValueOrNull.HasValue); }
public void TestClick_ChangesNullToValue() { //---------------Set up test pack------------------- IDateTimePicker dateTimePicker = CreateDateTimePicker(); dateTimePicker.ValueOrNull = null; //-------------Assert Preconditions ------------- Assert.IsFalse(dateTimePicker.ValueOrNull.HasValue); //---------------Execute Test ---------------------- EventHelper.RaiseEvent(dateTimePicker, "Click"); //---------------Test Result ----------------------- Assert.IsTrue(dateTimePicker.ValueOrNull.HasValue); }
public void TestKeyPress_BackSpaceChangesValueToNull() { //---------------Set up test pack------------------- IDateTimePicker dateTimePicker = CreateDateTimePicker(); dateTimePicker.ValueOrNull = DateTime.Now; //-------------Assert Preconditions ------------- Assert.IsTrue(dateTimePicker.ValueOrNull.HasValue); //---------------Execute Test ---------------------- EventHelper.RaiseEvent(dateTimePicker, "KeyDown", GetKeyDownEventArgsForBackspaceKey()); //---------------Test Result ----------------------- Assert.IsFalse(dateTimePicker.ValueOrNull.HasValue); }
public void TestVisualState_WhenCreated() { //---------------Set up test pack------------------- //---------------Execute Test ---------------------- IDateTimePicker dateTimePicker = CreateDateTimePicker(); //---------------Test Result ----------------------- IControlHabanero nullDisplayControl = GetNullDisplayControl(dateTimePicker); Assert.IsNotNull(nullDisplayControl, "DateTimePicker should have a null display control."); Assert.IsTrue(nullDisplayControl.Visible, "Null display value control should be visible when there is a null value."); }
public void TestKeyPress_ChangesNullToValue() { //---------------Set up test pack------------------- IDateTimePicker dateTimePicker = CreateDateTimePicker(); dateTimePicker.ValueOrNull = null; //-------------Assert Preconditions ------------- Assert.IsFalse(dateTimePicker.ValueOrNull.HasValue); //---------------Execute Test ---------------------- EventHelper.RaiseEvent(dateTimePicker, "KeyDown", GetKeyDownEventArgsForOtherKey()); //---------------Test Result ----------------------- Assert.IsTrue(dateTimePicker.ValueOrNull.HasValue); }
public void TestCreateDateTimePickermapper() { //---------------Set up test pack------------------- IDateTimePicker dateTimePicker = GetControlFactory().CreateDateTimePicker(); //---------------Verify test pack------------------- //---------------Execute Test ---------------------- string propertyName = "SampleDateProperty"; DateTimePickerMapper dtpMapper = new DateTimePickerMapper(dateTimePicker, propertyName, false, GetControlFactory()); //---------------Verify Result ----------------------- Assert.AreEqual(dateTimePicker, dtpMapper.DateTimePicker); Assert.AreEqual(propertyName, dtpMapper.PropertyName); //---------------Tear Down ------------------------- }
public void TestSetBaseValue_ChangesValueForIDateTimePicker() { //---------------Set up test pack------------------- IDateTimePicker dateTimePicker = CreateDateTimePicker(); DateTime dateTime = DateTime.Now; dateTimePicker.Value = dateTime; DateTime dateTimeNew = dateTime.AddDays(1); //---------------Execute Test ---------------------- SetBaseDateTimePickerValue(dateTimePicker, dateTimeNew); //---------------Test Result ----------------------- Assert.AreEqual(dateTimeNew, dateTimePicker.Value); }
public void TestShowDatePickerForm() { //---------------Set up test pack------------------- IFormHabanero formWin = new FormWin(); IDateTimePicker dateTimePicker = GetControlFactory().CreateDateTimePicker(); dateTimePicker.Format = Habanero.Faces.Base.DateTimePickerFormat.Custom; dateTimePicker.CustomFormat = @"Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: dd MMM yyyy"; dateTimePicker.NullDisplayValue = "Please Click"; //dateTimePicker.ShowCheckBox = true; ITextBox textBox = GetControlFactory().CreateTextBox(); IButton button = GetControlFactory().CreateButton("Check/Uncheck", delegate { //dateTimePicker.Checked = !dateTimePicker.Checked; if (dateTimePicker.ValueOrNull.HasValue) { dateTimePicker.ValueOrNull = null; } else { dateTimePicker.ValueOrNull = dateTimePicker.Value; } }); IButton enableButton = GetControlFactory().CreateButton("Enable/Disable", delegate { dateTimePicker.Enabled = !dateTimePicker.Enabled; }); GridLayoutManager gridLayoutManager = new GridLayoutManager(formWin, GetControlFactory()); gridLayoutManager.SetGridSize(5, 1); gridLayoutManager.AddControl(dateTimePicker); gridLayoutManager.AddControl(button); gridLayoutManager.AddControl(textBox); gridLayoutManager.AddControl(enableButton); gridLayoutManager.AddControl(GetControlFactory().CreateButton("ChangeColor", delegate { Random random = new Random(); dateTimePicker.ForeColor = Color.FromArgb(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255)); dateTimePicker.BackColor = Color.FromArgb(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255)); })); dateTimePicker.ValueChanged += delegate { textBox.Text = dateTimePicker.ValueOrNull.HasValue ? dateTimePicker.Value.ToString() : ""; }; //---------------Execute Test ---------------------- formWin.ShowDialog(); //---------------Test Result ----------------------- //---------------Tear down ------------------------- }
public void TestAddDatePicker_NullDefaultValue() { //---------------Set up test pack------------------- IControlFactory factory = GetControlFactory(); DateTime testDate = DateTime.Now; IFilterControl filterControl = factory.CreateFilterControl(); //---------------Execute Test ---------------------- IDateTimePicker dtPicker = filterControl.AddDateFilterDateTimePicker("test:", "testcolumn", null, FilterClauseOperator.OpGreaterThan, true); //---------------Test Result ----------------------- Assert.IsNotNull(dtPicker); Assert.AreEqual(null, dtPicker.ValueOrNull); }
public void TestVisualState_WhenNotNull() { //---------------Set up test pack------------------- IDateTimePicker dateTimePicker = CreateDateTimePicker(); dateTimePicker.ShowCheckBox = false; //---------------Execute Test ---------------------- dateTimePicker.ValueOrNull = DateTime.Now; //---------------Test Result ----------------------- IControlHabanero nullDisplayControl = GetNullDisplayControl(dateTimePicker); Assert.IsNotNull(nullDisplayControl, "DateTimePicker should have a null display control."); Assert.IsFalse(nullDisplayControl.Visible, "Null display value control should not be visible when there is a value."); }
public void TestClick_OnDisplayControlChangesNullToValue() { //---------------Set up test pack------------------- IDateTimePicker dateTimePicker = CreateDateTimePicker(); dateTimePicker.ValueOrNull = null; IControlHabanero nullDisplayControl = GetNullDisplayControl(dateTimePicker); //-------------Assert Preconditions ------------- Assert.IsFalse(dateTimePicker.ValueOrNull.HasValue); //---------------Execute Test ---------------------- EventHelper.RaiseEvent(nullDisplayControl, "Click"); //---------------Test Result ----------------------- Assert.IsTrue(dateTimePicker.ValueOrNull.HasValue); }
public void TestUsesGlobalUIRegistryDefaultDateTimePickerFormat() { //---------------Set up test pack------------------- GlobalUIRegistry.DateDisplaySettings = new DateDisplaySettings() { DateTimePickerDefaultFormat = "yyyy/mm/dd" }; //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- IDateTimePicker picker = CreateDateTimePicker(); //---------------Test Result ----------------------- Assert.AreEqual(picker.CustomFormat, GlobalUIRegistry.DateDisplaySettings.DateTimePickerDefaultFormat); }
public void TestDefaultValue() { //-------------Setup Test Pack ------------------ //-------------Execute test --------------------- DateTime beforeCreate = DateTime.Now.AddMilliseconds(-1); IDateTimePicker dateTimePicker = CreateDateTimePicker(); DateTime afterCreate = DateTime.Now.AddMilliseconds(1); //-------------Test Result ---------------------- Assert.IsFalse(dateTimePicker.ValueOrNull.HasValue); DateTime dateTime = dateTimePicker.Value; Assert.LessOrEqual(beforeCreate, dateTime, "Default value should be Now"); Assert.GreaterOrEqual(afterCreate, dateTime, "Default value should be Now"); //Assert.IsFalse(dateTimePicker.ShowCheckBox, "Default should not show checkbox"); }
public void TestSetValueToNull() { //---------------Set up test pack------------------- IDateTimePicker dateTimePicker = CreateDateTimePicker(); DateTime dateTime = DateTime.Now; dateTimePicker.Value = dateTime; //---------------Assert Precondition---------------- Assert.IsTrue(dateTimePicker.ValueOrNull.HasValue); //---------------Execute Test ---------------------- dateTimePicker.ValueOrNull = null; //---------------Test Result ----------------------- Assert.IsNull(dateTimePicker.ValueOrNull); Assert.IsFalse(dateTimePicker.ValueOrNull.HasValue); Assert.AreEqual(dateTime, dateTimePicker.Value); }
public void TestAdd_TwoStringFilterTextBox_DateTime__GetControl() { //---------------Set up test pack------------------- IFilterControl filterControl = GetControlFactory().CreateFilterControl(); IDateTimePicker tbExpected = filterControl.AddDateFilterDateTimePicker("Test:", "TestColumn", DateTime.Now, FilterClauseOperator.OpEquals, false); filterControl.AddStringFilterTextBox("Test2:", "TestColumn2"); //---------------Execute Test ---------------------- IDateTimePicker tbReturned = (IDateTimePicker)filterControl.GetChildControl("TestColumn"); //---------------Test Result ----------------------- Assert.AreSame(tbExpected, tbReturned); //---------------Tear Down ------------------------- }
public void TestVisualState_NullDisplayValue() { //---------------Set up test pack------------------- IDateTimePicker dateTimePicker = CreateDateTimePicker(); string nullDisplayValue = TestUtil.GetRandomString(); IControlHabanero nullDisplayControl = GetNullDisplayControl(dateTimePicker); //-------------Assert Preconditions ------------- Assert.AreEqual("", dateTimePicker.NullDisplayValue); Assert.AreEqual("", nullDisplayControl.Text); //---------------Execute Test ---------------------- dateTimePicker.NullDisplayValue = nullDisplayValue; //---------------Test Result ----------------------- Assert.AreEqual(nullDisplayValue, dateTimePicker.NullDisplayValue); Assert.AreEqual(nullDisplayValue, nullDisplayControl.Text); }
public void TestSetup_NullDisplayControlIsCreated() { //---------------Set up test pack------------------- IDateTimePicker dateTimePicker = CreateDateTimePicker(); //---------------Execute Test ---------------------- //---------------Test Result ----------------------- Assert.AreEqual(1, dateTimePicker.Controls.Count); Assert.IsInstanceOf(typeof(ILabel), dateTimePicker.Controls[0]); //IPanel pnl = (IPanel)dateTimePicker.Controls[0]; //Assert.AreEqual(1, pnl.Controls.Count); //Assert.IsInstanceOf(typeof(ILabel), pnl.Controls[0]); //ILabel lbl = (ILabel)pnl.Controls[0]; //Assert.AreEqual("", lbl.Text); //---------------Tear Down ------------------------- }
public void TestChangeDateTimePickerAppliesFilter() { //---------------Set up test pack------------------- IControlFactory factory = GetControlFactory(); IFilterControl ctl = factory.CreateFilterControl(); IDateTimePicker dateTimePicker = ctl.AddDateFilterDateTimePicker("test", "propname", DateTime.Now, FilterClauseOperator.OpLessThan, true); bool filterFired = false; ctl.Filter += delegate { filterFired = true; }; //---------------Assert Preconditions -------------- Assert.IsFalse(filterFired); //---------------Execute Test ---------------------- dateTimePicker.Value = DateTime.Now.AddMonths(-1); //---------------Test Result ----------------------- Assert.IsTrue(filterFired, "The filter event should have been fired when the text was changed."); }
public void TestLabelAndDateTimePickerAreOnPanel() { //---------------Set up test pack------------------- IFilterControl filterControl = GetControlFactory().CreateFilterControl(); //---------------Execute Test ---------------------- DateTime testDate = DateTime.Today.AddDays(+4); IDateTimePicker dtePicker = filterControl.AddDateFilterDateTimePicker("test:", "TestColumn", testDate, FilterClauseOperator.OpGreaterThan, false); //---------------Test Result ----------------------- Assert.AreEqual(1, filterControl.Controls.Count); Assert.AreEqual(1, filterControl.FilterControls.Count); //Assert.IsTrue(filterControl.FilterControls.Contains(dtePicker)); Assert.AreEqual(2, filterControl.FilterPanel.Controls.Count); Assert.IsTrue(filterControl.FilterPanel.Controls.Contains(dtePicker)); //---------------Tear Down ------------------------- }
//private ILabel _displayText; //private event EventHandler _valueChanged; ///<summary> /// The Constructor for the <see cref="DateTimePickerManager"/> ///</summary> ///<param name="controlFactory"></param> ///<param name="dateTimePicker"></param> ///<param name="valueGetter"></param> ///<param name="valueSetter"></param> ///<exception cref="ArgumentNullException"></exception> public DateTimePickerManager(IControlFactory controlFactory, IDateTimePicker dateTimePicker, ValueGetter <DateTime> valueGetter, ValueSetter <DateTime> valueSetter) { if (valueGetter == null) { throw new ArgumentNullException("valueGetter"); } if (valueSetter == null) { throw new ArgumentNullException("valueSetter"); } _controlFactory = controlFactory; _dateTimePicker = dateTimePicker; _valueGetter = valueGetter; _valueSetter = valueSetter; SetupNullDisplayBox(); ApplyBlankFormat(); }
///<summary> /// Returns the current date format, expressed as a string. ///</summary> ///<param name="dateTimePicker"></param> ///<returns>Returns the current date format, expressed as a string.</returns> public static string GetDateFormatString(IDateTimePicker dateTimePicker) { string format = null; switch (dateTimePicker.Format) { case DateTimePickerFormat.Long: format = "D"; break; case DateTimePickerFormat.Short: format = "d"; break; case DateTimePickerFormat.Time: format = "T"; break; case DateTimePickerFormat.Custom: format = dateTimePicker.CustomFormat; break; } if (String.IsNullOrEmpty(format)) format = "d"; return format; }
///<summary> /// Initialises a new instance of a DateTimePickerController. ///</summary> ///<param name="controlFactory">The control factory used to construct controls for the nullable picker. </param> ///<param name="dateTimePicker">The DateTimePicker control(can be any implementation)</param> ///<param name="_checkedPropInfo">The objects reflective property to be used for setting the check box checked state</param> ///<param name="_showCheckBoxPropInfo">The objects reflective property to be used for showing and hiding the checkbox.</param> public DateTimePickerController(IControlFactory controlFactory, IDateTimePicker dateTimePicker, PropertyInfo _checkedPropInfo, PropertyInfo _showCheckBoxPropInfo) { _controlFactory = controlFactory; this._showCheckBoxPropInfo = _showCheckBoxPropInfo; this._checkedPropInfo = _checkedPropInfo; _dateTimePicker = dateTimePicker; //_dateTimePicker.KeyDown += DateTimePicker_KeyDown; //_dateTimePicker.ValueChanged += DateTimePicker_ValueChanged; //_dateTimePicker.MouseUp += DateTimePicker_MouseUp; //_dateTimePicker.GotFocus += DateTimePicker_GotFocus; //_dateTimePicker.LostFocus += DateTimePicker_LostFocus; _dateTimePicker.Resize += DateTimePicker_Resize; //_dateTimePicker.EnabledChanged += DateTimePicker_ColorChanged; //_dateTimePicker.BackColorChanged += DateTimePicker_ColorChanged; //_dateTimePicker.ForeColorChanged += DateTimePicker_ColorChanged; //_showCheckBoxPropInfo = _dateTimePicker.ShowCheckBox; //_checkedPropInfo = _dateTimePicker.Checked; _supportsCheckBox = _showCheckBoxPropInfo != null && _checkedPropInfo != null; SetupDisplayBox(); NullDisplayValue = ""; Value = null; UpdateFocusState(); }
public DateTimePicker(Generator generator) : base(generator, typeof(IDateTimePicker)) { inner = (IDateTimePicker)Handler; }
protected override void SetBaseDateTimePickerValue(IDateTimePicker dateTimePicker, DateTime value) { Gizmox.WebGUI.Forms.DateTimePicker picker = (Gizmox.WebGUI.Forms.DateTimePicker)dateTimePicker; picker.Value = value; }
public DateTimePickerMapperStub(IDateTimePicker dtp) : base(dtp, "Fdfad", false, new ControlFactoryWin()) { }
protected abstract void SetBaseDateTimePickerValue(IDateTimePicker dateTimePicker, DateTime value);
protected override void SetBaseDateTimePickerCheckedValue(IDateTimePicker dateTimePicker, bool value) { Gizmox.WebGUI.Forms.DateTimePicker picker = (Gizmox.WebGUI.Forms.DateTimePicker)dateTimePicker; picker.Checked = value; }
protected override void SetBaseDateTimePickerCheckedValue(IDateTimePicker dateTimePicker, bool value) { System.Windows.Forms.DateTimePicker picker = (System.Windows.Forms.DateTimePicker)dateTimePicker; picker.Checked = value; }
protected abstract void SetBaseDateTimePickerCheckedValue(IDateTimePicker dateTimePicker, bool value);
protected override void SubscribeToBaseValueChangedEvent(IDateTimePicker dateTimePicker, EventHandler onValueChanged) { Gizmox.WebGUI.Forms.DateTimePicker picker = (Gizmox.WebGUI.Forms.DateTimePicker)dateTimePicker; picker.ValueChanged += onValueChanged; }
///<summary> /// Constructor for <see cref="InputFormDate"/> ///</summary> ///<param name="controlFactory"></param> ///<param name="message"></param> public InputFormDate(IControlFactory controlFactory, string message) { _controlFactory = controlFactory; _message = message; _dateTimePicker = _controlFactory.CreateDateTimePicker(DateTime.Now); }
private IControlHabanero GetNullDisplayControl(IDateTimePicker dateTimePicker) { if (dateTimePicker == null) return null; if (dateTimePicker.Controls.Count == 0) return null; return dateTimePicker.Controls[0]; }
protected override void SetBaseDateTimePickerValue(IDateTimePicker dateTimePicker, DateTime value) { System.Windows.Forms.DateTimePicker picker = (System.Windows.Forms.DateTimePicker)dateTimePicker; picker.Value = value; }
protected abstract void SubscribeToBaseValueChangedEvent(IDateTimePicker dateTimePicker, EventHandler onValueChanged);
protected override void SubscribeToBaseValueChangedEvent(IDateTimePicker dateTimePicker, EventHandler onValueChanged) { System.Windows.Forms.DateTimePicker picker = (System.Windows.Forms.DateTimePicker)dateTimePicker; picker.ValueChanged += onValueChanged; }
//TODO _PORT_FOR_WIN: ///// <summary> ///// Sets the date-time value in the specified date-time picker ///// </summary> ///// <param name="dateTimePicker">The date-time picker</param> ///// <param name="dateString">The date value as a string</param> //public static void SetValue(IDateTimePicker dateTimePicker, string dateString) //{ // object dateValue; // if (dateString == null || dateString.Length == 0) // { // dateValue = null; // } // else // { // dateValue = Convert.ToDateTime(dateString); // } // dateTimePicker.Value = (DateTime) dateValue; //} ///// <summary> ///// Sets the date-time value in the specified date-time picker ///// </summary> ///// <param name="dateTimePicker">The date-time picker</param> ///// <param name="dateValue">The date value as either a string or as ///// a DateTime object</param> ///// <exception cref="ArgumentException">Thrown if the date value is neither ///// a string nor a DateTime object</exception> //public static void SetValue(IDateTimePicker dateTimePicker, object dateValue) //{ // if (dateValue is DateTime) // { // SetValue(dateTimePicker, (DateTime)dateValue); // } // else if (dateValue is string) // { // SetValue(dateTimePicker, (string)dateValue); // } // else if (dateValue == null) // { // SetValue(dateTimePicker, (string)dateValue); // } // else // { // throw new ArgumentException( // "Invalid type when setting the value of a datetimepicker. Only dateTime, string, and null supported."); // } //} //TODO _PORT: ///// <summary> ///// Specify the custom format for the given date-time picker ///// </summary> ///// <param name="dateTimePicker">The date-time picker</param> ///// <param name="customFormat">The custom format to set for the date-time picker</param> //public static void SetCustomFormat(IDateTimePicker dateTimePicker, string customFormat) //{ // IDateTimePicker picker = dateTimePicker; // //TODO _PORT_With Tests: picker.Format = DateTimePickerFormat.Custom; // picker.CustomFormat = customFormat; //} //TODO _PORT: ///// <summary> ///// Specify the time format in the given date-time picker ///// </summary> ///// <param name="dateTimePicker">The date-time picker</param> //public static void SetTimeFormat(IDateTimePicker dateTimePicker) //{ // IDateTimePicker picker = dateTimePicker; // //TODO _PORT_With Tests:picker.Format = DateTimePickerFormat.Time; //} /// <summary> /// Specify the time format in the given date-time picker /// </summary> /// <param name="dateTimePicker">The date-time picker</param> /// <param name="showUpDown">Specifies if the Up/Down control must be shown or not</param> public static void SetShowUpDown(IDateTimePicker dateTimePicker, bool showUpDown) { IDateTimePicker picker = dateTimePicker; picker.ShowUpDown = showUpDown; }