Exemplo n.º 1
0
 ///<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();
 }
Exemplo n.º 2
0
 ///<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);
 }
Exemplo n.º 3
0
        public void TestShowDatePickersFormWithVisualStyles()
        {
            //---------------Set up test pack-------------------
            //Application.EnableVisualStyles();
            IFormHabanero   formWin        = new FormWin();
            IControlFactory controlFactory = GetControlFactory();
            IDateTimePicker dateTimePicker = controlFactory.CreateDateTimePicker();

            dateTimePicker.Format           = Habanero.Faces.Base.DateTimePickerFormat.Custom;
            dateTimePicker.CustomFormat     = @"dddd MMMM yyyy";
            dateTimePicker.NullDisplayValue = "Please Click";
            //dateTimePicker.ShowCheckBox = true;
            ITextBox textBox = controlFactory.CreateTextBox();
            IButton  button  = controlFactory.CreateButton("Check/Uncheck", delegate
            {
                //dateTimePicker.Checked = !dateTimePicker.Checked;
                if (dateTimePicker.ValueOrNull.HasValue)
                {
                    dateTimePicker.ValueOrNull = null;
                }
                else
                {
                    dateTimePicker.ValueOrNull = dateTimePicker.Value;
                }
            });
            IButton enableButton = controlFactory.CreateButton("Enable/Disable", delegate
            {
                dateTimePicker.Enabled = !dateTimePicker.Enabled;
            });


            IPanel panel = controlFactory.CreatePanel();

            panel.Dock = DockStyle.Fill;
            formWin.Controls.Add(panel);

            GridLayoutManager gridLayoutManager = new GridLayoutManager(panel, controlFactory);

            gridLayoutManager.SetGridSize(9, 1);
            gridLayoutManager.BorderSize = 25;
            gridLayoutManager.AddControl(dateTimePicker);
            gridLayoutManager.AddControl(button);
            gridLayoutManager.AddControl(textBox);
            gridLayoutManager.AddControl(enableButton);
            gridLayoutManager.AddControl(controlFactory.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));
            }));


            IDateTimePicker anotherDateTimePicker;

            anotherDateTimePicker        = controlFactory.CreateDateTimePicker();
            anotherDateTimePicker.Format = Habanero.Faces.Base.DateTimePickerFormat.Long;
            gridLayoutManager.AddControl(anotherDateTimePicker);
            anotherDateTimePicker        = controlFactory.CreateDateTimePicker();
            anotherDateTimePicker.Format = Habanero.Faces.Base.DateTimePickerFormat.Short;
            gridLayoutManager.AddControl(anotherDateTimePicker);
            anotherDateTimePicker        = controlFactory.CreateDateTimePicker();
            anotherDateTimePicker.Format = Habanero.Faces.Base.DateTimePickerFormat.Time;
            gridLayoutManager.AddControl(anotherDateTimePicker);

            anotherDateTimePicker        = controlFactory.CreateDateTimePicker();
            anotherDateTimePicker.Format = Habanero.Faces.Base.DateTimePickerFormat.Long;
            anotherDateTimePicker.Font   = new Font(FontFamily.GenericSansSerif, 18);
            anotherDateTimePicker.Height = 60;
            gridLayoutManager.AddControl(anotherDateTimePicker);

            dateTimePicker.ValueChanged += delegate
            {
                textBox.Text = dateTimePicker.ValueOrNull.HasValue ? dateTimePicker.Value.ToString() : "";
            };
            //---------------Execute Test ----------------------
            formWin.ShowDialog();
            //---------------Test Result -----------------------

            //---------------Tear down -------------------------
        }
Exemplo n.º 4
0
 ///<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);
 }
 ///<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();     
 }