예제 #1
0
 internal void OnItemSelected(IFileDialogCustomize customize, int dwIDCtl, int dwIDItem)
 {
     if (dwIDCtl == _comboBoxId)
     {
         if (dwIDItem == _ignoreId)
         {
             customize.SetControlLabel(_helpTextId, ignoreDescription);
         }
         if (dwIDItem == _copyId)
         {
             customize.SetControlLabel(_helpTextId, copyDescription);
         }
         if (dwIDItem == _copyOverwriteId)
         {
             customize.SetControlLabel(_helpTextId, copyOverwriteDescription);
         }
         if (dwIDItem == _keepReferenceId)
         {
             customize.SetControlLabel(_helpTextId, determinePathsDescription);
         }
     }
 }
        void IDialogControlHost.ApplyControlPropertyChange(string propertyName, DialogControl control)
        {
            if (propertyName == "Text")
            {
                customize.SetControlLabel(control.Id, ((CommonFileDialogControl)control).Text);
            }
            else if (propertyName == "Enabled" || propertyName == "Visible")
            {
                CommonFileDialogControl          dialogControl = control as CommonFileDialogControl;
                SafeNativeMethods.CDCONTROLSTATE state         = SafeNativeMethods.CDCONTROLSTATE.CDCS_INACTIVE;

                if (dialogControl.Enabled == true)
                {
                    state |= SafeNativeMethods.CDCONTROLSTATE.CDCS_ENABLED;
                }

                if (dialogControl.Visible == true)
                {
                    state |= SafeNativeMethods.CDCONTROLSTATE.CDCS_VISIBLE;
                }

                customize.SetControlState(control.Id, state);
            }
            else if (propertyName == "SelectedIndex")
            {
                if (control is CommonFileDialogRadioButtonList)
                {
                    CommonFileDialogRadioButtonList list = control as CommonFileDialogRadioButtonList;
                    customize.SetSelectedControlItem(control.Id, list.SelectedIndex);
                }
                else if (control is CommonFileDialogComboBox)
                {
                    CommonFileDialogComboBox box = control as CommonFileDialogComboBox;
                    customize.SetSelectedControlItem(control.Id, box.SelectedIndex);
                }
            }
            else if (propertyName == "IsChecked")
            {
                if (control is CommonFileDialogCheckBox)
                {
                    CommonFileDialogCheckBox checkBox = control as CommonFileDialogCheckBox;
                    customize.SetCheckButtonState(control.Id, checkBox.IsChecked);
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Called when a control currently in the collection
        /// has a property changed.
        /// </summary>
        /// <param name="propertyName">The name of the property changed.</param>
        /// <param name="control">The control whose property has changed.</param>
        public virtual void ApplyControlPropertyChange(string propertyName, DialogControl control)
        {
            if (control == null)
            {
                throw new ArgumentNullException("control");
            }

            CommonFileDialogControl dialogControl = null;

            if (propertyName == "Text")
            {
                CommonFileDialogTextBox textBox = control as CommonFileDialogTextBox;

                if (textBox != null)
                {
                    customize.SetEditBoxText(control.Id, textBox.Text);
                }
                else
                {
                    customize.SetControlLabel(control.Id, textBox.Text);
                }
            }
            else if (propertyName == "Visible" && (dialogControl = control as CommonFileDialogControl) != null)
            {
                ShellNativeMethods.ControlState state;
                customize.GetControlState(control.Id, out state);

                if (dialogControl.Visible == true)
                {
                    state |= ShellNativeMethods.ControlState.Visible;
                }
                else if (dialogControl.Visible == false)
                {
                    state &= ~ShellNativeMethods.ControlState.Visible;
                }

                customize.SetControlState(control.Id, state);
            }
            else if (propertyName == "Enabled" && dialogControl != null)
            {
                ShellNativeMethods.ControlState state;
                customize.GetControlState(control.Id, out state);

                if (dialogControl.Enabled == true)
                {
                    state |= ShellNativeMethods.ControlState.Enable;
                }
                else if (dialogControl.Enabled == false)
                {
                    state &= ~ShellNativeMethods.ControlState.Enable;
                }

                customize.SetControlState(control.Id, state);
            }
            else if (propertyName == "SelectedIndex")
            {
                CommonFileDialogRadioButtonList list;
                CommonFileDialogComboBox        box;

                if ((list = control as CommonFileDialogRadioButtonList) != null)
                {
                    customize.SetSelectedControlItem(list.Id, list.SelectedIndex);
                }
                else if ((box = control as CommonFileDialogComboBox) != null)
                {
                    customize.SetSelectedControlItem(box.Id, box.SelectedIndex);
                }
            }
            else if (propertyName == "IsChecked")
            {
                CommonFileDialogCheckBox checkBox = control as CommonFileDialogCheckBox;
                if (checkBox != null)
                {
                    customize.SetCheckButtonState(checkBox.Id, checkBox.IsChecked);
                }
            }
        }
 internal void OnItemSelected(IFileDialogCustomize customize, int dwIDCtl, int dwIDItem)
 {
     if (dwIDCtl == _comboBoxId)
     {
         if (dwIDItem == _ignoreId) customize.SetControlLabel(_helpTextId, ignoreDescription);
         if (dwIDItem == _copyId) customize.SetControlLabel(_helpTextId, copyDescription);
         if (dwIDItem == _copyOverwriteId) customize.SetControlLabel(_helpTextId, copyOverwriteDescription);
         if (dwIDItem == _keepReferenceId) customize.SetControlLabel(_helpTextId, determinePathsDescription);
     }
 }