Ejemplo n.º 1
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (this.dateTimePickerElement != null)
                {
                    this.dateTimePickerElement.FormatChanged -= delegate(object sender, EventArgs e) { this.OnFormatChanged(e); };
                    this.dateTimePickerElement.ValueChanged  -= delegate(object sender, EventArgs e) { this.OnValueChanged(e); };
                    this.dateTimePickerElement.ValueChanging -= delegate(object sender, ValueChangingEventArgs e) { this.OnValueChanging(e); };
                    this.dateTimePickerElement.Opening       -= delegate(object sender, CancelEventArgs e) { this.OnOpening(e); };
                    this.dateTimePickerElement.Opened        -= delegate(object sender, EventArgs e) { this.OnOpened(e); };
                    this.dateTimePickerElement.Closing       -= delegate(object sender, RadPopupClosingEventArgs e) { this.OnClosing(e); };
                    this.dateTimePickerElement.Closed        -= delegate(object sender, RadPopupClosedEventArgs e) { this.OnClosed(e); };

                    this.dateTimePickerElement.TextBoxElement.TextBoxItem.HostedControl.KeyDown  -= new KeyEventHandler(this.OnKeyDown);
                    this.dateTimePickerElement.TextBoxElement.TextBoxItem.HostedControl.KeyUp    -= new KeyEventHandler(this.OnKeyUp);
                    this.dateTimePickerElement.TextBoxElement.TextBoxItem.HostedControl.KeyPress -= new KeyPressEventHandler(this.OnKeyPress);
                    this.dateTimePickerElement.Dispose();
                    this.dateTimePickerElement.DisposeChildren();
                    this.dateTimePickerElement = null;
                }
            }

            base.Dispose(disposing);
        }
Ejemplo n.º 2
0
        protected override void OnKeyDown(KeyEventArgs e)
        {
            RadDateTimePickerElement editorElement = this.EditorElement as RadDateTimePickerElement;

            if (editorElement == null || !editorElement.IsInValidState(true))
            {
                return;
            }
            BaseListViewVisualItem ownerElement = this.OwnerElement as BaseListViewVisualItem;

            if (ownerElement == null)
            {
                return;
            }
            if (e.KeyCode == Keys.Return)
            {
                ownerElement.Data.Owner.EndEdit();
            }
            else if (e.KeyCode == Keys.Escape)
            {
                ownerElement.Data.Owner.CancelEdit();
            }
            else
            {
                base.OnKeyDown(e);
            }
        }
Ejemplo n.º 3
0
        private bool EnsureDateTimeMaskHandler()
        {
            RadDateTimePickerElement editorElement = this.EditorElement as RadDateTimePickerElement;

            if (editorElement == null)
            {
                return(false);
            }
            RadDateTimePickerCalendar dateTimeBehavior = editorElement.CurrentBehavior as RadDateTimePickerCalendar;

            if (dateTimeBehavior == null)
            {
                return(false);
            }
            RadMaskedEditBoxElement maskTextBox = editorElement.TextBoxElement as RadMaskedEditBoxElement;

            if (maskTextBox == null)
            {
                return(false);
            }
            if (maskTextBox.TextBoxItem.SelectionLength == maskTextBox.Text.Length)
            {
                return(false);
            }
            this.dateTimeMaskHandler = maskTextBox.Provider as MaskDateTimeProvider;
            if (this.dateTimeMaskHandler == null)
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 4
0
        protected virtual void OnKeyDown(KeyEventArgs e)
        {
            RadDateTimePickerElement dateTimePickerElement = this.EditorElement as RadDateTimePickerElement;

            if (dateTimePickerElement == null || !dateTimePickerElement.IsInValidState(true))
            {
                return;
            }

            if (this.OwnerElement != null)
            {
                if (e.KeyCode == Keys.Right)
                {
                    isRightmostMaskItemSelected = this.IsRightmostMaskItemSelected();
                }
                else if (e.KeyCode == Keys.Left)
                {
                    isLeftmostMaskItemSelected = this.IsLeftmostMaskItemSelected();
                }
                else
                {
                    dateTimePickerElement.NullDate = DateTime.MinValue;
                }
            }
        }
Ejemplo n.º 5
0
        protected virtual void OnKeyUp(KeyEventArgs e)
        {
            RadDateTimePickerElement editorElement = this.EditorElement as RadDateTimePickerElement;

            if (editorElement == null || !editorElement.IsInValidState(true))
            {
                return;
            }
            bool flag = string.IsNullOrEmpty(editorElement.TextBoxElement.TextBoxItem.HostedControl.Text);

            switch (e.KeyCode)
            {
            case Keys.Left:
                if (!this.isLeftmostMaskItemSelected && !flag)
                {
                    break;
                }
                base.OnKeyDown(e);
                this.isLeftmostMaskItemSelected = false;
                break;

            case Keys.Right:
                if (!this.isRightmostMaskItemSelected && !flag)
                {
                    break;
                }
                base.OnKeyDown(e);
                this.isRightmostMaskItemSelected = false;
                break;
            }
        }
Ejemplo n.º 6
0
        protected override void OnKeyDown(KeyEventArgs e)
        {
            RadDateTimePickerElement editorElement = this.EditorElement as RadDateTimePickerElement;

            if (editorElement == null || !editorElement.IsInValidState(true))
            {
                return;
            }
            TreeNodeElement ownerElement = this.OwnerElement as TreeNodeElement;

            if (ownerElement == null)
            {
                return;
            }
            if (e.KeyCode == Keys.Return)
            {
                ownerElement.TreeViewElement.EndEdit();
            }
            else if (e.KeyCode == Keys.Escape)
            {
                ownerElement.TreeViewElement.CancelEdit();
            }
            else
            {
                base.OnKeyDown(e);
            }
        }
Ejemplo n.º 7
0
        protected override void OnKeyDown(KeyEventArgs e)
        {
            RadDateTimePickerElement dateTimePickerElement = this.EditorElement as RadDateTimePickerElement;

            if (dateTimePickerElement == null || !dateTimePickerElement.IsInValidState(true))
            {
                return;
            }

            PropertyGridItemElement visualItem = this.OwnerElement as PropertyGridItemElement;

            if (visualItem != null)
            {
                if (e.KeyCode == Keys.Enter)
                {
                    visualItem.PropertyTableElement.EndEdit();
                }
                else if (e.KeyCode == Keys.Escape)
                {
                    visualItem.PropertyTableElement.CancelEdit();
                }
                else
                {
                    base.OnKeyDown(e);
                }
            }
        }
Ejemplo n.º 8
0
        public override bool EndEdit()
        {
            base.EndEdit();
            RadDateTimePickerElement editorElement  = (RadDateTimePickerElement)this.EditorElement;
            RadTextBoxElement        textBoxElement = (RadTextBoxElement)editorElement.TextBoxElement;

            editorElement.ValueChanging -= new ValueChangingEventHandler(this.RadDateTimeEditor_ValueChanging);
            editorElement.ValueChanged  -= new EventHandler(this.RadDateTimeEditor_ValueChanged);
            RadDateTimePickerCalendar currentBehavior = editorElement.GetCurrentBehavior() as RadDateTimePickerCalendar;

            if (currentBehavior != null)
            {
                currentBehavior.PopupControl.Opened -= new EventHandler(this.PopupControl_Opened);
                currentBehavior.PopupControl.Closed -= new RadPopupClosedEventHandler(this.PopupControl_Closed);
                currentBehavior.Calendar.CalendarElement.CalendarStatusElement.ClearButton.Click -= new EventHandler(this.ClearButton_Click);
                currentBehavior.Calendar.CalendarElement.CalendarStatusElement.TodayButton.Click -= new EventHandler(this.TodayButton_Click);
            }
            if (textBoxElement != null)
            {
                textBoxElement.KeyDown -= new KeyEventHandler(this.TextBoxElement_KeyDown);
                textBoxElement.KeyUp   -= new KeyEventHandler(this.textBoxElement_KeyUp);
            }
            (editorElement.GetCurrentBehavior() as RadDateTimePickerCalendar)?.PopupControl.Hide();
            return(true);
        }
Ejemplo n.º 9
0
        public override void OnKeyDown(KeyEventArgs e)
        {
            RadDateTimePickerElement editorElement = this.EditorElement as RadDateTimePickerElement;

            if (editorElement == null || !editorElement.IsInValidState(true))
            {
                return;
            }
            if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Escape)
            {
                base.OnKeyDown(e);
            }
            else if (e.KeyCode == Keys.Right)
            {
                this.isRightmostMaskItemSelected = this.IsRightmostMaskItemSelected();
            }
            else if (e.KeyCode == Keys.Left)
            {
                this.isLeftmostMaskItemSelected = this.IsLeftmostMaskItemSelected();
            }
            else
            {
                editorElement.NullDate = DateTime.MinValue;
            }
        }
Ejemplo n.º 10
0
        public override bool EndEdit()
        {
            base.EndEdit();
            RadDateTimePickerElement editor         = (RadDateTimePickerElement)this.EditorElement;
            RadTextBoxElement        textBoxElement = editor.TextBoxElement;

            editor.ValueChanging -= new ValueChangingEventHandler(RadDateTimeEditor_ValueChanging);
            editor.ValueChanged  -= new EventHandler(RadDateTimeEditor_ValueChanged);
            RadDateTimePickerCalendar dateTimeBehavior = editor.GetCurrentBehavior() as RadDateTimePickerCalendar;

            if (dateTimeBehavior != null)
            {
                dateTimeBehavior.PopupControl.Opened -= new EventHandler(PopupControl_Opened);
                dateTimeBehavior.PopupControl.Closed -= new RadPopupClosedEventHandler(PopupControl_Closed);
                dateTimeBehavior.Calendar.CalendarElement.CalendarStatusElement.ClearButton.Click -= new EventHandler(ClearButton_Click);
                dateTimeBehavior.Calendar.CalendarElement.CalendarStatusElement.TodayButton.Click -= new EventHandler(TodayButton_Click);
            }
            if (textBoxElement != null)
            {
                textBoxElement.KeyDown -= new KeyEventHandler(TextBoxElement_KeyDown);
                textBoxElement.TextBoxItem.HostedControl.LostFocus -= new EventHandler(HostedControl_LostFocus);
            }
            RadDateTimePickerCalendar calendar = editor.GetCurrentBehavior() as RadDateTimePickerCalendar;

            if (calendar != null)
            {
                calendar.PopupControl.Hide();
            }
            return(true);
        }
Ejemplo n.º 11
0
 public RadDateTimePickerCalendar(RadDateTimePickerElement dateTimePicker)
 {
     this.dateTimePickerElement = dateTimePicker;
     this.calendar           = new RadCalendar();
     this.calendar.Focusable = false;
     this.CreateElements();
     this.calendar.AllowMultipleSelect = false;
     this.calendar.SelectionChanged   += new EventHandler(this.calendar_SelectionChanged);
 }
Ejemplo n.º 12
0
        protected override void CreateChildElements()
        {
            base.CreateChildElements();

            ctlChk = new RadCheckBoxElement();
            ctlChk.ToggleStateChanged += new StateChangedEventHandler(ctlChk_ToggleStateChanged);
            this.Children.Add(ctlChk);

            ctlComboBoxElement = new RadComboBoxElement();
            ctlComboBoxElement.DropDownStyle = RadDropDownStyle.DropDownList;
            ctlComboBoxElement.ValueChanged += new EventHandler(ctlComboBoxElement_ValueChanged);
            this.Children.Add(ctlComboBoxElement);

            ctlCheckComboBoxElement              = new CSCheckComboBoxElement();
            ctlCheckComboBoxElement.PopupClosed += new RadPopupClosedEventHandler(ctlCheckComboBoxElement_PopupClosed);
            this.Children.Add(ctlCheckComboBoxElement);

            ctlComboBoxExxElement = new CSComboBoxExxElement();
            ctlComboBoxExxElement.ValueChanged += new EventHandler(ctlComboBoxExxElement_ValueChanged);
            this.Children.Add(ctlComboBoxExxElement);

            ctlTextBox              = new RadTextBoxElement();
            ctlTextBox.TextChanged += new EventHandler(ctlTextBox_TextChanged);
            this.Children.Add(ctlTextBox);

            ctlDataTimePickerElement = new RadDateTimePickerElement();
            ctlDataTimePickerElement.ValueChanged += new EventHandler(ctlDataTimePickerElement_ValueChanged);
            this.Children.Add(ctlDataTimePickerElement);

            ctlColorSelectorElement              = new CSColorSelectorElement();
            ctlColorSelectorElement.TextChanged += new EventHandler(ctlColorSelectorElement_TextChanged);
            this.Children.Add(ctlColorSelectorElement);


            ctlSpin              = new RadSpinElement();
            ctlSpin.MinValue     = 0;
            ctlSpin.MaxValue     = 100000;
            ctlSpin.TextChanged += new EventHandler(ctlSpin_TextChanged);
            this.Children.Add(ctlSpin);


            ctlNumericTextBox              = new CSNumericTextBoxElement();
            ctlNumericTextBox.TextChanged += new EventHandler(ctlNumericTextBox_TextChanged);
            this.Children.Add(ctlNumericTextBox);


            ctlIntTextBox              = new CSIntegerTextBoxElement();
            ctlIntTextBox.TextChanged += new EventHandler(ctlIntTextBox_TextChanged);
            this.Children.Add(ctlIntTextBox);



            foreach (RadElement element in this.Children)
            {
                element.Visibility = ElementVisibility.Collapsed;
            }
        }
Ejemplo n.º 13
0
        public override void BeginEdit()
        {
            this.Value = this.initialValue;

            base.BeginEdit();

            //This is need to always make selected the first part ot date mask when the editor is opened
            RadDateTimePickerElement  editor           = (RadDateTimePickerElement)this.EditorElement;
            RadTextBoxElement         textBoxElement   = editor.TextBoxElement;
            RadDateTimePickerCalendar dateTimeBehavior = editor.CurrentBehavior as RadDateTimePickerCalendar;

            editor.TextBoxElement.TextBoxItem.HostedControl.Focus();
            editor.TextBoxElement.TextBoxItem.SelectionStart  = 0;
            editor.TextBoxElement.TextBoxItem.SelectionLength = 1;

            if (dateTimeBehavior != null)
            {
                dateTimeBehavior.DropDownMinSize = new Size(editor.Size.Width, 200);
                RadMaskedEditBoxElement maskTextBox = editor.TextBoxElement as RadMaskedEditBoxElement;
                MaskDateTimeProvider    maskHandler = (MaskDateTimeProvider)maskTextBox.Provider;
                maskHandler.SelectFirstEditableItem();
                this.selectedItemIndex = maskHandler.SelectedItemIndex;
                //int lastCaretPos = maskHandler.;
                //int lastSelectionPos = maskHandler.SelectionPosition;
                //while (maskHandler.SelectionPosition >= 0)
                //{
                //    lastSelectionPos = maskHandler.SelectionPosition;
                //    maskHandler.HandleLeftKey();
                //    if (lastSelectionPos == maskHandler.SelectionPosition)
                //        break;
                //}
                //this.selectedItemIndex = maskHandler.SelectedFormatInfoIndex;
                //maskTextBox.SelectionLength = maskHandler.SelectionLength;

                dateTimeBehavior.PopupControl.Opened += new EventHandler(PopupControl_Opened);
                dateTimeBehavior.PopupControl.Closed += new RadPopupClosedEventHandler(PopupControl_Closed);
                dateTimeBehavior.Calendar.CalendarElement.CalendarStatusElement.ClearButton.Click += new EventHandler(ClearButton_Click);
                dateTimeBehavior.Calendar.CalendarElement.CalendarStatusElement.TodayButton.Click += new EventHandler(TodayButton_Click);

                if (editor.Value == editor.NullDate)
                {
                    maskTextBox.Text = String.Empty;
                }
            }

            editor.NotifyParentOnMouseInput = false;
            editor.BackColor      = Color.White;
            editor.ValueChanging += new ValueChangingEventHandler(RadDateTimeEditor_ValueChanging);
            editor.ValueChanged  += new EventHandler(RadDateTimeEditor_ValueChanged);

            if (textBoxElement != null)
            {
                textBoxElement.KeyDown += new KeyEventHandler(TextBoxElement_KeyDown);
            }
        }
Ejemplo n.º 14
0
        private void PopupControl_Opened(object sender, EventArgs e)
        {
            RadDateTimePickerElement  dateTimePicker         = this.EditorElement as RadDateTimePickerElement;
            RadDateTimePickerCalendar dateTimePickerCalendar = dateTimePicker.GetCurrentBehavior() as RadDateTimePickerCalendar;

            if (dateTimePickerCalendar != null)
            {
                dateTimePickerCalendar.Calendar.SelectedDates.Clear();
                dateTimePickerCalendar.Calendar.InvalidateCalendar();
            }
        }
Ejemplo n.º 15
0
        public override void BeginEdit()
        {
            this.Value = this.initialValue;
            base.BeginEdit();
            RadDateTimePickerElement  editorElement   = (RadDateTimePickerElement)this.EditorElement;
            RadTextBoxElement         textBoxElement1 = (RadTextBoxElement)editorElement.TextBoxElement;
            RadDateTimePickerCalendar currentBehavior = editorElement.CurrentBehavior as RadDateTimePickerCalendar;

            editorElement.TextBoxElement.TextBoxItem.SelectAll();
            editorElement.TextBoxElement.TextBoxItem.HostedControl.Focus();
            if (currentBehavior != null)
            {
                currentBehavior.DropDownMinSize = new Size(editorElement.Size.Width, 200);
                RadMaskedEditBoxElement textBoxElement2 = editorElement.TextBoxElement;
                MaskDateTimeProvider    provider        = (MaskDateTimeProvider)textBoxElement2.Provider;
                if (editorElement.TextBoxElement.MaskType != MaskType.FreeFormDateTime)
                {
                    provider.SelectFirstEditableItem();
                }
                this.selectedItemIndex = provider.SelectedItemIndex;
                currentBehavior.PopupControl.Opened += new EventHandler(this.PopupControl_Opened);
                currentBehavior.PopupControl.Closed += new RadPopupClosedEventHandler(this.PopupControl_Closed);
                currentBehavior.Calendar.CalendarElement.CalendarStatusElement.ClearButton.Click += new EventHandler(this.ClearButton_Click);
                currentBehavior.Calendar.CalendarElement.CalendarStatusElement.TodayButton.Click += new EventHandler(this.TodayButton_Click);
                DateTime?nullable = editorElement.Value;
                DateTime nullDate = editorElement.NullDate;
                if ((!nullable.HasValue ? 0 : (nullable.GetValueOrDefault() == nullDate ? 1 : 0)) != 0)
                {
                    textBoxElement2.Text = string.Empty;
                }
            }
            editorElement.NotifyParentOnMouseInput = false;
            if (!RadTextBoxEditor.IsDarkTheme(this.OwnerElement))
            {
                int num = (int)editorElement.SetDefaultValueOverride(VisualElement.BackColorProperty, (object)Color.White);
            }
            editorElement.ValueChanging += new ValueChangingEventHandler(this.RadDateTimeEditor_ValueChanging);
            editorElement.ValueChanged  += new EventHandler(this.RadDateTimeEditor_ValueChanged);
            if (textBoxElement1 != null)
            {
                textBoxElement1.KeyDown += new KeyEventHandler(this.TextBoxElement_KeyDown);
                textBoxElement1.KeyUp   += new KeyEventHandler(this.textBoxElement_KeyUp);
            }
            if (editorElement.ElementTree != null)
            {
                RadControl control = editorElement.ElementTree.Control as RadControl;
                if (control != null && control.ThemeName == "TelerikMetroTouch" || ThemeResolutionService.ApplicationThemeName == "TelerikMetroTouch")
                {
                    editorElement.CalendarSize = new Size(300, 300);
                }
            }
            this.isValidated = false;
        }
Ejemplo n.º 16
0
        protected virtual bool IsCurrentDateValid()
        {
            RadDateTimePickerElement editorElement = (RadDateTimePickerElement)this.EditorElement;
            DateTime?nullable1 = editorElement.Value;
            DateTime minValue  = this.MinValue;

            if ((nullable1.HasValue ? (nullable1.GetValueOrDefault() < minValue ? 1 : 0) : 0) == 0)
            {
                DateTime?nullable2 = editorElement.Value;
                DateTime maxValue  = this.MaxValue;
                if ((nullable2.HasValue ? (nullable2.GetValueOrDefault() > maxValue ? 1 : 0) : 0) == 0)
                {
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// creates and initializes the RadDateTimePickerElement
        /// </summary>
        /// <param name="parent"></param>
        protected override void CreateChildItems(RadElement parent)
        {
            this.dateTimePickerElement = new RadDateTimePickerElement();
            parent.Children.Add(this.dateTimePickerElement);

            this.dateTimePickerElement.FormatChanged += delegate(object sender, EventArgs e) { this.OnFormatChanged(e); };
            this.dateTimePickerElement.ValueChanged  += delegate(object sender, EventArgs e) { this.OnValueChanged(e); };
            this.dateTimePickerElement.ValueChanging += delegate(object sender, ValueChangingEventArgs e) { this.OnValueChanging(e); };
            this.dateTimePickerElement.Opening       += delegate(object sender, CancelEventArgs e) { this.OnOpening(e); };
            this.dateTimePickerElement.Opened        += delegate(object sender, EventArgs e) { this.OnOpened(e); };
            this.dateTimePickerElement.Closing       += delegate(object sender, RadPopupClosingEventArgs e) { this.OnClosing(e); };
            this.dateTimePickerElement.Closed        += delegate(object sender, RadPopupClosedEventArgs e) { this.OnClosed(e); };

            this.dateTimePickerElement.TextBoxElement.TextBoxItem.HostedControl.KeyDown  += new KeyEventHandler(OnKeyDown);
            this.dateTimePickerElement.TextBoxElement.TextBoxItem.HostedControl.KeyUp    += new KeyEventHandler(OnKeyUp);
            this.dateTimePickerElement.TextBoxElement.TextBoxItem.HostedControl.KeyPress += new KeyPressEventHandler(OnKeyPress);
        }
Ejemplo n.º 18
0
        private bool EnsureDateTimeMaskHandler()
        {
            RadDateTimePickerElement editorElement = this.EditorElement as RadDateTimePickerElement;

            if (editorElement == null || !(editorElement.CurrentBehavior is RadDateTimePickerCalendar))
            {
                return(false);
            }
            RadMaskedEditBoxElement textBoxElement = editorElement.TextBoxElement;

            if (textBoxElement == null || textBoxElement.TextBoxItem.SelectionLength == textBoxElement.Text.Length)
            {
                return(false);
            }
            this.dateTimeMaskHandler = textBoxElement.Provider as MaskDateTimeProvider;
            return(this.dateTimeMaskHandler != null);
        }
Ejemplo n.º 19
0
        public override bool CanClosePopup(RadPopupCloseReason reason)
        {
            if (reason != RadPopupCloseReason.Mouse)
            {
                return(base.CanClosePopup(reason));
            }
            if (!this.OwnerElement.IsInValidState(true) || !(this.OwnerElement is RadDateTimePickerElement))
            {
                return(base.CanClosePopup(reason));
            }
            RadDateTimePickerElement ownerElement = this.OwnerElement as RadDateTimePickerElement;

            if (ownerElement.ArrowButton == null)
            {
                return(base.CanClosePopup(reason));
            }
            return(!ownerElement.ArrowButton.IsMouseOver);
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Represents the RadDateTimePickerCalendar constructor
        /// </summary>
        /// <param name="dateTimePicker"></param>
        public RadDateTimePickerCalendar(RadDateTimePickerElement dateTimePicker)
        {
            this.dateTimePickerElement = dateTimePicker;

            this.calendar           = new RadCalendar();
            this.calendar.Focusable = false;

            this.popupControl            = new RadDateTimePickerDropDown(this.dateTimePickerElement);
            this.popupControl.SizingMode = SizingMode.UpDownAndRightBottom;
            this.popupControl.Opened    += new EventHandler(controlPanel_Opened);
            this.popupControl.Closing   += new RadPopupClosingEventHandler(controlPanel_Closing);
            this.popupControl.Closed    += new RadPopupClosedEventHandler(controlPanel_Closed);

            this.popupControl.HostedControl = this.calendar;
            this.popupControl.LoadElementTree();
            this.calendar.AllowMultipleSelect = false;
            this.calendar.SelectionChanged   += new EventHandler(calendar_SelectionChanged);
        }
Ejemplo n.º 21
0
 protected override void CreateChildItems(RadElement parent)
 {
     this.dateTimePickerElement = this.CreateElement();
     parent.Children.Add((RadElement)this.dateTimePickerElement);
     this.dateTimePickerElement.FormatChanged        += new EventHandler(this.dateTimePickerElement_FormatChanged);
     this.dateTimePickerElement.ValueChanged         += new EventHandler(this.dateTimePickerElement_ValueChanged);
     this.dateTimePickerElement.ValueChanging        += new ValueChangingEventHandler(this.dateTimePickerElement_ValueChanging);
     this.dateTimePickerElement.NullableValueChanged += new EventHandler(this.dateTimePickerElement_NullableValueChanged);
     this.dateTimePickerElement.Opening                 += new CancelEventHandler(this.dateTimePickerElement_Opening);
     this.dateTimePickerElement.Opened                  += new EventHandler(this.dateTimePickerElement_Opened);
     this.dateTimePickerElement.Closing                 += new RadPopupClosingEventHandler(this.dateTimePickerElement_Closing);
     this.dateTimePickerElement.Closed                  += new RadPopupClosedEventHandler(this.dateTimePickerElement_Closed);
     this.dateTimePickerElement.CheckedChanged          += new EventHandler(this.DateTimePickerElement_CheckedChanged);
     this.dateTimePickerElement.TextBoxElement.KeyDown  += new KeyEventHandler(this.OnKeyDown);
     this.dateTimePickerElement.TextBoxElement.KeyUp    += new KeyEventHandler(this.OnKeyUp);
     this.dateTimePickerElement.TextBoxElement.KeyPress += new KeyPressEventHandler(this.OnKeyPress);
     this.dateTimePickerElement.ToggleStateChanging     += new StateChangingEventHandler(this.CheckBox_ToggleStateChanging);
     this.dateTimePickerElement.ToggleStateChanged      += new StateChangedEventHandler(this.CheckBox_ToggleStateChanged);
 }
Ejemplo n.º 22
0
        public override void BeginEdit()
        {
            base.BeginEdit();
            RadDateTimePickerElement  editorElement   = (RadDateTimePickerElement)this.EditorElement;
            RadTextBoxElement         textBoxElement1 = (RadTextBoxElement)editorElement.TextBoxElement;
            RadDateTimePickerCalendar currentBehavior = editorElement.CurrentBehavior as RadDateTimePickerCalendar;

            editorElement.TextBoxElement.TextBoxItem.HostedControl.Focus();
            editorElement.TextBoxElement.TextBoxItem.SelectionStart  = 0;
            editorElement.TextBoxElement.TextBoxItem.SelectionLength = 1;
            if (currentBehavior != null)
            {
                currentBehavior.DropDownMinSize = new Size(editorElement.Size.Width, 200);
                RadMaskedEditBoxElement textBoxElement2 = editorElement.TextBoxElement;
                MaskDateTimeProvider    provider        = (MaskDateTimeProvider)textBoxElement2.Provider;
                provider.SelectFirstEditableItem();
                this.selectedItemIndex = provider.SelectedItemIndex;
                currentBehavior.PopupControl.Opened += new EventHandler(this.PopupControl_Opened);
                currentBehavior.PopupControl.Closed += new RadPopupClosedEventHandler(this.PopupControl_Closed);
                currentBehavior.Calendar.CalendarElement.CalendarStatusElement.ClearButton.Click += new EventHandler(this.ClearButton_Click);
                currentBehavior.Calendar.CalendarElement.CalendarStatusElement.TodayButton.Click += new EventHandler(this.TodayButton_Click);
                DateTime?nullable = editorElement.Value;
                DateTime nullDate = editorElement.NullDate;
                if ((!nullable.HasValue ? 0 : (nullable.GetValueOrDefault() == nullDate ? 1 : 0)) != 0)
                {
                    textBoxElement2.Text = string.Empty;
                }
            }
            editorElement.NotifyParentOnMouseInput = false;
            if (!BaseTextBoxEditor.IsDarkTheme(this.OwnerElement))
            {
                int num = (int)editorElement.SetDefaultValueOverride(VisualElement.BackColorProperty, (object)Color.White);
            }
            editorElement.ValueChanging += new ValueChangingEventHandler(this.RadDateTimeEditor_ValueChanging);
            editorElement.ValueChanged  += new EventHandler(this.RadDateTimeEditor_ValueChanged);
            if (textBoxElement1 == null)
            {
                return;
            }
            textBoxElement1.KeyDown += new KeyEventHandler(this.TextBoxElement_KeyDown);
            textBoxElement1.TextBoxItem.HostedControl.LostFocus += new EventHandler(this.HostedControl_LostFocus);
        }
Ejemplo n.º 23
0
        public override void InitializeEditor(IInputEditor editor)
        {
            RadDateTimeEditor radDateTimeEditor = editor as RadDateTimeEditor;

            if (radDateTimeEditor != null)
            {
                RadDateTimePickerElement editorElement = (RadDateTimePickerElement)radDateTimeEditor.EditorElement;
                editorElement.Format       = this.Format;
                editorElement.CustomFormat = this.CustomFormat;
                editorElement.Culture      = this.FormatInfo;
                editorElement.ShowUpDown   = this.EditorType == GridViewDateTimeEditorType.DateTimePickerSpinMode;
            }
            GridTimePickerEditor timePickerEditor = editor as GridTimePickerEditor;

            if (timePickerEditor == null)
            {
                return;
            }
            RadTimePickerElement editorElement1 = timePickerEditor.EditorElement as RadTimePickerElement;

            editorElement1.Format  = this.Format != DateTimePickerFormat.Custom ? this.FormatString : this.CustomFormat;
            editorElement1.Culture = this.FormatInfo;
        }
Ejemplo n.º 24
0
 protected override void Dispose(bool disposing)
 {
     if (disposing && this.dateTimePickerElement != null)
     {
         this.dateTimePickerElement.FormatChanged        -= new EventHandler(this.dateTimePickerElement_FormatChanged);
         this.dateTimePickerElement.ValueChanged         -= new EventHandler(this.dateTimePickerElement_ValueChanged);
         this.dateTimePickerElement.NullableValueChanged -= new EventHandler(this.dateTimePickerElement_NullableValueChanged);
         this.dateTimePickerElement.ValueChanging        -= new ValueChangingEventHandler(this.dateTimePickerElement_ValueChanging);
         this.dateTimePickerElement.Opening        -= new CancelEventHandler(this.dateTimePickerElement_Opening);
         this.dateTimePickerElement.Opened         -= new EventHandler(this.dateTimePickerElement_Opened);
         this.dateTimePickerElement.Closing        -= new RadPopupClosingEventHandler(this.dateTimePickerElement_Closing);
         this.dateTimePickerElement.Closed         -= new RadPopupClosedEventHandler(this.dateTimePickerElement_Closed);
         this.dateTimePickerElement.CheckedChanged -= new EventHandler(this.DateTimePickerElement_CheckedChanged);
         this.dateTimePickerElement.TextBoxElement.TextBoxItem.HostedControl.KeyDown  -= new KeyEventHandler(this.OnKeyDown);
         this.dateTimePickerElement.TextBoxElement.TextBoxItem.HostedControl.KeyUp    -= new KeyEventHandler(this.OnKeyUp);
         this.dateTimePickerElement.TextBoxElement.TextBoxItem.HostedControl.KeyPress -= new KeyPressEventHandler(this.OnKeyPress);
         this.dateTimePickerElement.ToggleStateChanging -= new StateChangingEventHandler(this.CheckBox_ToggleStateChanging);
         this.dateTimePickerElement.ToggleStateChanged  -= new StateChangedEventHandler(this.CheckBox_ToggleStateChanged);
         this.dateTimePickerElement.Dispose();
         this.dateTimePickerElement.DisposeChildren();
         this.dateTimePickerElement = (RadDateTimePickerElement)null;
     }
     base.Dispose(disposing);
 }
Ejemplo n.º 25
0
 public RadDateTimePickerSpinEdit(RadDateTimePickerElement dateTimePicker)
 {
     this.dateTimePickerElement = dateTimePicker;
 }
Ejemplo n.º 26
0
        private void PopupControl_Closed(object sender, RadPopupClosedEventArgs args)
        {
            RadDateTimePickerElement editor = this.EditorElement as RadDateTimePickerElement;

            editor.TextBoxElement.TextBoxItem.HostedControl.Focus();
        }
Ejemplo n.º 27
0
        private void CreateMenuGroup()
        {
            #region 时间
            dtBeginTime              = new RadDateTimePickerElement();
            dtBeginTime.Format       = DateTimePickerFormat.Custom;
            dtBeginTime.CustomFormat = "yyyy年MM月dd日 HH:mm:ss";
            dtBeginTime.Value        = DateTime.Today;
            dtBeginTime.Size         = new System.Drawing.Size(180, 21);
            dtBeginTime.MaxSize      = new System.Drawing.Size(180, 21);
            dtBeginTime.MinSize      = new System.Drawing.Size(180, 21);
            dtBeginTime.Alignment    = ContentAlignment.TopLeft;

            RadLabelElement lbBeginTime = new RadLabelElement();
            lbBeginTime.Text    = "开始时间";
            lbBeginTime.MinSize = new System.Drawing.Size(40, 21);

            RadRibbonBarButtonGroup gpBeginTime = new RadRibbonBarButtonGroup();
            gpBeginTime.Items.AddRange(new RadItem[] { lbBeginTime, dtBeginTime });
            gpBeginTime.Orientation   = Orientation.Horizontal;
            gpBeginTime.ShowBackColor = false;
            //gpBeginTime.ShowBorder = false;
            gpBeginTime.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);

            dtEndTime              = new RadDateTimePickerElement();
            dtEndTime.Format       = DateTimePickerFormat.Custom;
            dtEndTime.CustomFormat = "yyyy年MM月dd日 HH:mm:ss";
            dtEndTime.Value        = DateTime.Today.AddDays(1).AddSeconds(-1);
            dtEndTime.Size         = new System.Drawing.Size(180, 21);
            dtEndTime.MaxSize      = new System.Drawing.Size(180, 21);
            dtEndTime.MinSize      = new System.Drawing.Size(180, 21);
            dtEndTime.Alignment    = ContentAlignment.TopLeft;

            RadLabelElement lbEndTime = new RadLabelElement();
            lbEndTime.Text    = "结束时间";
            lbEndTime.MinSize = new System.Drawing.Size(40, 21);

            RadRibbonBarButtonGroup gpEndTime = new RadRibbonBarButtonGroup();
            gpEndTime.Items.AddRange(new RadItem[] { lbEndTime, dtEndTime });
            gpEndTime.Orientation   = Orientation.Horizontal;
            gpEndTime.ShowBackColor = false;
            //gpEndTime.ShowBorder = false;
            gpEndTime.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);

            RadRibbonBarButtonGroup gpTime = new RadRibbonBarButtonGroup();
            gpTime.Items.AddRange(new RadItem[] { gpBeginTime, gpEndTime });
            gpTime.Orientation   = Orientation.Vertical;
            gpTime.ShowBackColor = false;
            gpTime.ShowBorder    = false;
            gpTime.Margin        = new System.Windows.Forms.Padding(3, 3, 3, 3);
            #endregion

            #region 卫星传感器
            sate1      = new RadRadioButtonElement();
            sate1.Text = "FY-3A";
            //sate1.Font = new System.Drawing.Font("宋体", 11);
            sate1.MinSize     = new System.Drawing.Size(50, 21);
            sate1.Margin      = new System.Windows.Forms.Padding(3, 0, 0, 0);
            sate1.ToggleState = Telerik.WinControls.Enumerations.ToggleState.On;

            sate2      = new RadRadioButtonElement();
            sate2.Text = "FY-3B";
            //sate2.Font = new System.Drawing.Font("宋体", 11);
            sate2.MinSize = new System.Drawing.Size(50, 21);
            sate2.Margin  = new System.Windows.Forms.Padding(3, 0, 0, 0);

            sate3         = new RadRadioButtonElement();
            sate3.Text    = "FY-3C";
            sate3.MinSize = new System.Drawing.Size(50, 21);
            sate3.Margin  = new System.Windows.Forms.Padding(3, 0, 0, 0);

            RadRibbonBarButtonGroup gpSatellite = new RadRibbonBarButtonGroup();
            gpSatellite.Items.AddRange(new RadItem[] { sate1, sate2, sate3 });
            gpSatellite.Orientation   = Orientation.Vertical;
            gpSatellite.ShowBackColor = false;
            //gpSatellite.ShowBorder = false;
            gpSatellite.Margin = new System.Windows.Forms.Padding(3, 3, 3, 3);

            sensor1      = new RadRadioButtonElement();
            sensor1.Text = "VIRR";
            //sensor1.Font = new System.Drawing.Font("宋体", 11);
            sensor1.MinSize     = new System.Drawing.Size(60, 21);
            sensor1.ToggleState = Telerik.WinControls.Enumerations.ToggleState.On;
            sensor1.Margin      = new System.Windows.Forms.Padding(3, 0, 0, 0);

            sensor2      = new RadRadioButtonElement();
            sensor2.Text = "MERSI";
            //sensor2.Font = new System.Drawing.Font("宋体", 11);
            sensor2.MinSize = new System.Drawing.Size(60, 21);
            sensor2.Margin  = new System.Windows.Forms.Padding(3, 0, 0, 0);

            RadRibbonBarButtonGroup gpSensor = new RadRibbonBarButtonGroup();
            gpSensor.Items.AddRange(new RadItem[] { sensor1, sensor2 });
            gpSensor.Orientation   = Orientation.Vertical;
            gpSensor.ShowBackColor = false;
            //gpSensor.ShowBorder = false;
            gpSensor.Margin = new System.Windows.Forms.Padding(3, 3, 3, 3);

            RadRibbonBarButtonGroup gpSatelliteSensor = new RadRibbonBarButtonGroup();
            gpSatelliteSensor.Items.AddRange(new RadItem[] { gpSatellite, gpSensor });
            gpSatelliteSensor.Orientation   = Orientation.Horizontal;
            gpSatelliteSensor.ShowBackColor = false;
            gpSatelliteSensor.ShowBorder    = false;

            #endregion

            #region 数据类型
            dataType1             = new RadRadioButtonElement();
            dataType1.Text        = "投影数据";
            dataType1.MinSize     = new System.Drawing.Size(60, 21);
            dataType1.ToggleState = Telerik.WinControls.Enumerations.ToggleState.On;
            dataType1.Margin      = new System.Windows.Forms.Padding(3, 0, 0, 0);

            dataType2         = new RadRadioButtonElement();
            dataType2.Text    = "投影拼接数据";
            dataType2.MinSize = new System.Drawing.Size(60, 21);
            dataType2.Margin  = new System.Windows.Forms.Padding(3, 0, 0, 0);
            dataType3         = new RadRadioButtonElement();
            dataType3.Text    = "分幅数据";
            dataType3.MinSize = new System.Drawing.Size(60, 21);
            dataType3.Margin  = new System.Windows.Forms.Padding(3, 0, 0, 0);

            RadRibbonBarButtonGroup gpDataType = new RadRibbonBarButtonGroup();
            gpDataType.Items.AddRange(new RadItem[] { dataType1, dataType2, dataType3 });
            gpDataType.Orientation   = Orientation.Vertical;
            gpDataType.ShowBackColor = false;
            gpDataType.Margin        = new System.Windows.Forms.Padding(3, 3, 3, 3);
            #endregion

            RadButtonElement btnSearch = new RadButtonElement();
            btnSearch.Image             = GeoDo.RSS.UI.AddIn.HdService.Properties.Resources.search_green;
            btnSearch.Text              = "预处理数据查询";
            btnSearch.ImageAlignment    = ContentAlignment.MiddleCenter;
            btnSearch.TextAlignment     = ContentAlignment.MiddleCenter;
            btnSearch.TextImageRelation = TextImageRelation.ImageAboveText;
            btnSearch.Margin            = new System.Windows.Forms.Padding(3, 3, 3, 3);
            btnSearch.Click            += new EventHandler(btnSearch_Click);

            _group      = new RadRibbonBarGroup();
            _group.Text = "数据查询";
            _group.Items.Add(gpSatelliteSensor);
            _group.Items.Add(gpDataType);
            _group.Items.Add(gpTime);
            _group.Items.Add(btnSearch);

            //RadButtonElement prjData = new RadButtonElement("投影数据查询");
            //prjData.Click += new EventHandler(_rasterDats_Click);
            //_group.Items.Add(prjData);
            //RadButtonElement prjCombinData = new RadButtonElement("投影拼接数据查询");
            //prjCombinData.Click += new EventHandler(_rasterDats_Click);
            //_group.Items.Add(prjCombinData);
            //RadButtonElement splitDats = new RadButtonElement("分幅数据查询");
            //splitDats.Click += new EventHandler(_rasterDats_Click);
            //_group.Items.Add(splitDats);

            RadButtonElement rasterDats = new RadButtonElement("栅格产品数据查询");
            rasterDats.Image             = GeoDo.RSS.UI.AddIn.HdService.Properties.Resources.search_green;
            rasterDats.ImageAlignment    = ContentAlignment.MiddleCenter;
            rasterDats.TextAlignment     = ContentAlignment.MiddleCenter;
            rasterDats.TextImageRelation = TextImageRelation.ImageAboveText;
            rasterDats.Margin            = new System.Windows.Forms.Padding(3, 3, 3, 3);
            rasterDats.Click            += new EventHandler(_rasterDats_Click);

            RadRibbonBarButtonGroup gpPd = new RadRibbonBarButtonGroup();
            gpPd.Items.AddRange(new RadItem[] { rasterDats });
            gpPd.Orientation   = Orientation.Horizontal;
            gpPd.ShowBackColor = false;
            gpPd.Margin        = new System.Windows.Forms.Padding(3, 3, 3, 3);

            _group.Items.Add(gpPd);
        }