Пример #1
0
 /// <summary>
 /// Fired when closing the dropdown
 /// [email protected]: To notify the user if the dropdown was closed due to a (pressing Escape key)cancel action
 /// or by changing focus or pressing Enter key which corresponds to an accept action.
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnDialogClosed(DropDownClosedEventArgs e)
 {
     if (DialogClosed != null)
     {
         DialogClosed(this, e);
     }
 }
Пример #2
0
        /// <summary>
        /// Show the dialog
        /// </summary>
        public virtual void ShowDialog()
        {
            OnDialogOpen(EventArgs.Empty);

            //[email protected]: To notify the user if the dropdown was closed due to a (pressing Escape key)cancel action
            //or by changing focus or pressing Enter key which corresponds to an accept action
            DropDownClosedEventArgs eventArgs = new DropDownClosedEventArgs(DropDownCancelled);

            OnDialogClosed(eventArgs);
        }
Пример #3
0
        /// <summary>
        /// [email protected]: To notify the user if the dropdown was closed due to a
        /// (pressing Escape key)cancel action or by changing focus or pressing Enter key which corresponds to an accept action.
        /// </summary>
        /// <param name="e"></param>
        protected virtual void OnDropDownClosed(DropDownClosedEventArgs e)
        {
            Owner.Activate();

            Hide();

            if (DropDownClosed != null)
            {
                DropDownClosed(this, e);
            }
        }
Пример #4
0
        public void CloseDropDown()
        {
            if (m_bShowed == false)
            {
                return;
            }
            // [email protected]: To notify the user if the dropdown was closed due to a
            // (pressing Escape key)cancel action or by changing focus or pressing Enter key which corresponds to an accept action.
            DropDownClosedEventArgs dropDownClosedEventArgs = new DropDownClosedEventArgs(DialogResult == DialogResult.Cancel);

            OnDropDownClosed(dropDownClosedEventArgs);

            m_bShowed = false;
        }
Пример #5
0
        public override void ShowDialog()
        {
            try
            {
                OnDialogOpen(EventArgs.Empty);
                if (m_UITypeEditor != null)
                {
                    UITypeEditorEditStyle style = m_UITypeEditor.GetEditStyle();
                    if (style == UITypeEditorEditStyle.DropDown ||
                        style == UITypeEditorEditStyle.Modal)
                    {
                        object editObject;
                        //Try to read the actual value, if the function failed I edit the default value
                        if (IsValidValue(out editObject) == false)
                        {
                            if (Validator != null)
                            {
                                editObject = Validator.DefaultValue;
                            }
                            else
                            {
                                editObject = null;
                            }
                        }

                        object tmp = m_UITypeEditor.EditValue(this, this, editObject);
                        Value = tmp;
                    }
                }
                //[email protected]: To notify the user if the dropdown was closed due to a
                // (pressing Escape key)cancel action or by changing focus or pressing Enter key which corresponds to an accept action.
                DropDownClosedEventArgs eventArgs = new DropDownClosedEventArgs(DropDownCancelled);
                OnDialogClosed(eventArgs);
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message, "Error");
            }
        }
Пример #6
0
 /// <summary>
 /// [email protected]: To notify the user if the dropdown was closed due to a
 /// (pressing Escape key)cancel action or by changing focus or pressing Enter key which corresponds to an accept action.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void DropDownClosed(object sender, DropDownClosedEventArgs e)
 {
     DropDownCancelled = e.Cancelled;
 }