public void OnButtonClicked(IFileDialogCustomize pfdc, int dwIDCtl) { if (dwIDCtl == VistaFileDialog.HelpButtonId) { _dialog.DoHelpRequest(); } }
private void SetDialogProperties(IFileDialog dialog) { // Description if (!string.IsNullOrEmpty(_description)) { if (UseDescriptionForTitle) { dialog.SetTitle(_description); } else { IFileDialogCustomize customize = (IFileDialogCustomize)dialog; customize.AddText(0, _description); } } dialog.SetOptions(NativeMethods.FOS.FOS_PICKFOLDERS | NativeMethods.FOS.FOS_FORCEFILESYSTEM | NativeMethods.FOS.FOS_FILEMUSTEXIST); if (!string.IsNullOrEmpty(_selectedPath)) { string parent = Path.GetDirectoryName(_selectedPath); if (parent == null || !Directory.Exists(parent)) { dialog.SetFileName(_selectedPath); } else { string folder = Path.GetFileName(_selectedPath); dialog.SetFolder(NativeMethods.CreateItemFromParsingName(parent)); dialog.SetFileName(folder); } } }
internal void Update(IFileDialogCustomize dialog) { Debug.Assert(dialog != null, "CommonFileDialogComboBox.Attach: dialog parameter can not be null"); // Remove the control items. // Don't do RemoveAllControlItems. It's not implemented natively. for (int index = 0; index < oldCount; ++index) dialog.RemoveControlItem (Id, index); // Re-add the combo box items for (int index = 0; index < Items.Count; ++index) { string text = Items [index].Text; dialog.AddControlItem (Id, index, text); } // If we didn't, go select. if (Enabled) { SelectedIndex = 0; ApplyPropertyChange ("SelectedIndex"); } oldCount = Items.Count; // Sync additional properties SyncUnmanagedProperties (); }
internal override void GetResult(IFileDialog dialog) { if (Multiselect) { IShellItemArray results; ((IFileOpenDialog)dialog).GetResults(out results); uint count; results.GetCount(out count); string[] fileNames = new string[count]; for (uint x = 0; x < count; ++x) { IShellItem item; results.GetItemAt(x, out item); string name; item.GetDisplayName(NativeMethods.SIGDN.SIGDN_FILESYSPATH, out name); fileNames[x] = name; } FileNamesInternal = fileNames; } else { FileNamesInternal = null; } if (ShowReadOnly) { IFileDialogCustomize customize = (IFileDialogCustomize)dialog; int selected; customize.GetSelectedControlItem(_openDropDownId, out selected); _readOnlyChecked = (selected == _readOnlyItemId); } base.GetResult(dialog); }
/// <summary> /// Attach the GroupBox control to the dialog object /// </summary> /// <param name="dialog">Target dialog</param> internal override void Attach(IFileDialogCustomize dialog) { Debug.Assert(dialog != null, "CommonFileDialogGroupBox.Attach: dialog parameter can not be null"); // Start a visual group dialog.StartVisualGroup(this.Id, this.Text); // Add child controls foreach (CommonFileDialogControl item in this.items) { item.HostingDialog = HostingDialog; item.Attach(dialog); } // End visual group dialog.EndVisualGroup(); // Make this control prominent if needed if (IsProminent) { dialog.MakeProminent(this.Id); } // Sync unmanaged properties with managed properties SyncUnmanagedProperties(); }
internal override void Attach(IFileDialogCustomize dialog) { Debug.Assert(dialog != null, "CommonFileDialogComboBox.Attach: dialog parameter can not be null"); // Add the combo box control dialog.AddComboBox(this.Id); // Add the combo box items for (int index = 0; index < items.Count; index++) { dialog.AddControlItem(this.Id, index, items[index].Text); } // Set the currently selected item if (selectedIndex >= 0 && selectedIndex < items.Count) { dialog.SetSelectedControlItem(this.Id, this.selectedIndex); } else if (selectedIndex != -1) { throw new IndexOutOfRangeException(LocalizedMessages.ComboBoxIndexOutsideBounds); } // Make this control prominent if needed if (IsProminent) { dialog.MakeProminent(this.Id); } // Sync additional properties SyncUnmanagedProperties(); }
internal void Update(IFileDialogCustomize dialog) { Debug.Assert(dialog != null, "CommonFileDialogComboBox.Attach: dialog parameter can not be null"); // Remove the control items. // Don't do RemoveAllControlItems. It's not implemented natively. for (int index = 0; index < oldCount; ++index) { dialog.RemoveControlItem(Id, index); } // Re-add the combo box items for (int index = 0; index < Items.Count; ++index) { string text = Items [index].Text; dialog.AddControlItem(Id, index, text); } // If we didn't, go select. if (Enabled) { SelectedIndex = 0; ApplyPropertyChange("SelectedIndex"); } oldCount = Items.Count; // Sync additional properties SyncUnmanagedProperties(); }
/// <summary> /// Attach the RadioButtonList control to the dialog object /// </summary> /// <param name="dialog">The target dialog</param> internal override void Attach(IFileDialogCustomize dialog) { Debug.Assert(dialog != null, "CommonFileDialogRadioButtonList.Attach: dialog parameter can not be null"); // Add the radio button list control dialog.AddRadioButtonList(this.Id); // Add the radio button list items for (int index = 0; index < items.Count; index++) { dialog.AddControlItem(this.Id, index, items[index].Text); } // Set the currently selected item if (selectedIndex >= 0 && selectedIndex < items.Count) { dialog.SetSelectedControlItem(this.Id, this.selectedIndex); } else if (selectedIndex != -1) { throw new IndexOutOfRangeException(LocalizedMessages.RadioButtonListIndexOutOfBounds); } // Sync unmanaged properties with managed properties SyncUnmanagedProperties(); }
public DialogResult ShowDialog() { int result = _dialog.Show(GetActiveWindow()); if (result < 0) { if ((uint)result == (uint)HRESULT.E_CANCELLED) { return(DialogResult.Cancel); } throw Marshal.GetExceptionForHR(result); } IShellItem dialogResult; _dialog.GetResult(out dialogResult); dialogResult.GetDisplayName(SIGDN.SIGDN_FILESYSPATH, out _fileName); IFileDialogCustomize customize = (IFileDialogCustomize)_dialog; customize.GetCheckButtonState(RunManualCheckboxId, out _runManualMode); model.PreferenceSettings.OpenFileInManualExecutionMode = _runManualMode; return(DialogResult.OK); }
public void OnItemSelected(IFileDialogCustomize pfdc, int dwIDCtl, int dwIDItem) { // Find control DialogControl control = this.parent.controls.GetControlbyId(dwIDCtl); ICommonFileDialogIndexedControls controlInterface; CommonFileDialogMenu menu; // Process ComboBox and/or RadioButtonList if ((controlInterface = control as ICommonFileDialogIndexedControls) != null) { // Update selected item and raise SelectedIndexChanged event controlInterface.SelectedIndex = dwIDItem; controlInterface.RaiseSelectedIndexChangedEvent(); } // Process Menu else if ((menu = control as CommonFileDialogMenu) != null) { // Find the menu item that was clicked and invoke it's click event foreach (CommonFileDialogMenuItem item in menu.Items) { if (item.Id == dwIDItem) { item.RaiseClickEvent(); break; } } } }
public void OnCheckButtonToggled(IFileDialogCustomize pfdc, UInt32 dwIDCtl, bool bChecked) { var control = this.Dialog.Controls.FirstOrDefault(x => x.Id == dwIDCtl); var checkBox = control as FileDialogCheckBox; checkBox?.RaiseCheckedChangedEvent(bChecked); }
public void OnButtonClicked(IFileDialogCustomize pfdc, UInt32 dwIDCtl) { var control = this.Dialog.Controls.FirstOrDefault(x => x.Id == dwIDCtl); var button = control as FileDialogButton; button?.RaiseClickEvent(); }
/// <summary> /// Attach the Separator control to the dialog object /// </summary> /// <param name="dialog">Target dialog</param> internal override void Attach(IFileDialogCustomize dialog) { Debug.Assert(dialog != null, "CommonFileDialogSeparator.Attach: dialog parameter can not be null"); // Add a separator dialog.AddSeparator(this.Id); // Sync unmanaged properties with managed properties SyncUnmanagedProperties(); }
/// <summary> /// Attach this control to the dialog object /// </summary> /// <param name="dialog">Target dialog</param> internal override void Attach(IFileDialogCustomize dialog) { Debug.Assert(dialog != null, "CommonFileDialog.Attach: dialog parameter can not be null"); // Add a text control dialog.AddText(this.Id, this.Text); // Sync unmanaged properties with managed properties SyncUnmanagedProperties(); }
internal override void Attach(IFileDialogCustomize dialog) { base.Attach(dialog); // Keep track of old selection. SelectedIndexChanged += delegate { oldCount = Items.Count; }; }
internal override void Attach (IFileDialogCustomize dialog) { base.Attach (dialog); // Keep track of old selection. SelectedIndexChanged += delegate { oldCount = Items.Count; }; }
public DynamoOpenFileDialog(DynamoViewModel model) { this.model = model; _dialog = new NativeFileOpenDialog(); IFileDialogCustomize customize = (IFileDialogCustomize)_dialog; customize.AddCheckButton(RunManualCheckboxId, Dynamo.Wpf.Properties.Resources.FileDialogManualMode, model.PreferenceSettings.OpenFileInManualExecutionMode); }
/// <summary> /// Attach this control to the dialog object /// </summary> /// <param name="dialog">Target dialog</param> public override void Attach(IFileDialogCustomize dialog) { Debug.Assert(dialog != null, "CommonFileDialog.Attach: dialog parameter can not be null"); // Add a text control dialog.AddText(this.Id, this.Text); // Sync unmanaged properties with managed properties SyncUnmanagedProperties(); }
public void OnButtonClicked(IFileDialogCustomize pfdc, int dwIDCtl) { // Find control DialogControl control = this.parent.controls.GetControlbyId(dwIDCtl); CommonFileDialogButton button = control as CommonFileDialogButton; // Call corresponding event if (button != null) { button.RaiseClickEvent(); } }
public void OnButtonClicked(IFileDialogCustomize pfdc, int dwIDCtl) { // Find control DialogControl control = this.parent.controls.GetControlbyId(dwIDCtl); // Call corresponding event if (control is CommonFileDialogButton) { ((CommonFileDialogButton)control).RaiseClickEvent(); } }
internal override void SetDialogProperties(IFileDialog dialog) { base.SetDialogProperties(dialog); if (_showReadOnly) { IFileDialogCustomize customise = (IFileDialogCustomize)dialog; customise.EnableOpenDropDown(_openDropDownId); customise.AddControlItem(_openDropDownId, _openItemId, ComDlgResources.LoadString(ComDlgResourceId.OpenButton)); customise.AddControlItem(_openDropDownId, _readOnlyItemId, ComDlgResources.LoadString(ComDlgResourceId.ReadOnly)); } }
/// <summary> /// Get the IFileDialogCustomize interface, preparing to add controls. /// </summary> private void GetCustomizedFileDialog() { if (customize == null) { if (nativeDialog == null) { InitializeNativeFileDialog(); nativeDialog = GetNativeFileDialog(); } customize = (IFileDialogCustomize)nativeDialog; } }
/// <summary> /// Attach the TextBox control to the dialog object /// </summary> /// <param name="dialog">Target dialog</param> internal override void Attach(IFileDialogCustomize dialog) { Debug.Assert(dialog != null, "CommonFileDialogTextBox.Attach: dialog parameter can not be null"); // Add a text entry control dialog.AddEditBox(this.Id, this.Text); // Set to local instance in order to gate access to same. customizedDialog = dialog; // Sync unmanaged properties with managed properties SyncUnmanagedProperties(); }
/// <summary> /// Attach the PushButton control to the dialog object /// </summary> /// <param name="dialog">Target dialog</param> public override void Attach(IFileDialogCustomize dialog) { Debug.Assert(dialog != null, "CommonFileDialogButton.Attach: dialog parameter can not be null"); // Add a push button control dialog.AddPushButton(this.Id, this.Text); // Make this control prominent if needed if (IsProminent) { dialog.MakeProminent(this.Id); } // Sync unmanaged properties with managed properties SyncUnmanagedProperties(); }
public void OnCheckButtonToggled(IFileDialogCustomize pfdc, int dwIDCtl, bool bChecked) { // Find control DialogControl control = this.parent.controls.GetControlbyId(dwIDCtl); CommonFileDialogCheckBox box = control as CommonFileDialogCheckBox; // Update control and call corresponding event if (box != null) { box.IsChecked = bChecked; box.RaiseCheckedChangedEvent(); } }
/// <summary> /// Attach the CheckButton control to the dialog object. /// </summary> /// <param name="dialog">the target dialog</param> internal override void Attach(IFileDialogCustomize dialog) { Debug.Assert(dialog != null, "CommonFileDialogCheckBox.Attach: dialog parameter can not be null"); // Add a check button control dialog.AddCheckButton(this.Id, this.Text, this.isChecked); // Make this control prominent if needed if (IsProminent) { dialog.MakeProminent(this.Id); } // Make sure this property is set ApplyPropertyChange("IsChecked"); // Sync unmanaged properties with managed properties SyncUnmanagedProperties(); }
/// <summary> /// Attach the PushButton control to the dialog object /// </summary> /// <param name="dialog">Target dialog</param> internal override void Attach(IFileDialogCustomize dialog) { Debug.Assert(dialog != null, "CommonFileDialogButton.Attach: dialog parameter can not be null"); // Add a push button control dialog.AddPushButton(this.Id, this.Text); // Make this control prominent if needed if (IsProminent) { dialog.MakeProminent(this.Id); } // Sync unmanaged properties with managed properties SyncUnmanagedProperties(); }
/// <summary> /// Attach the Menu control to the dialog object. /// </summary> /// <param name="dialog">the target dialog</param> internal override void Attach(IFileDialogCustomize dialog) { Debug.Assert(dialog != null, "CommonFileDialogMenu.Attach: dialog parameter can not be null"); // Add the menu control dialog.AddMenu(this.Id, this.Text); // Add the menu items foreach (CommonFileDialogMenuItem item in this.items) dialog.AddControlItem(this.Id, item.Id, item.Text); // Make prominent as needed if (IsProminent) dialog.MakeProminent(this.Id); // Sync unmanaged properties with managed properties SyncUnmanagedProperties(); }
public void OnItemSelected(IFileDialogCustomize pfdc, UInt32 dwIDCtl, UInt32 dwIDItem) { var control = this.Dialog.Controls.FirstOrDefault(x => x.Id == dwIDCtl); if (control is IFileDialogIndexedControls) { var controlInterface = control as IFileDialogIndexedControls; controlInterface.SelectedIndex = (int)dwIDItem; controlInterface.RaiseSelectedIndexChangedEvent(); } else if (control is FileDialogMenu) { var menu = control as FileDialogMenu; var menuItem = menu.Items.FirstOrDefault(x => x.Id == dwIDItem); menuItem?.RaiseClickEvent(); } }
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); } } }
/// <summary> /// Attach the Menu control to the dialog object. /// </summary> /// <param name="dialog">the target dialog</param> internal override void Attach(IFileDialogCustomize dialog) { Debug.Assert(dialog != null, "CommonFileDialogMenu.Attach: dialog parameter can not be null"); // Add the menu control dialog.AddMenu(this.Id, this.Text); // Add the menu items foreach (CommonFileDialogMenuItem item in this.items) { dialog.AddControlItem(this.Id, item.Id, item.Text); } // Make prominent as needed if (IsProminent) { dialog.MakeProminent(this.Id); } // Sync unmanaged properties with managed properties SyncUnmanagedProperties(); }
/// <summary> /// Attach the GroupBox control to the dialog object /// </summary> /// <param name="dialog">Target dialog</param> internal override void Attach(IFileDialogCustomize dialog) { Debug.Assert(dialog != null, "CommonFileDialogGroupBox.Attach: dialog parameter can not be null"); // Start a visual group dialog.StartVisualGroup(this.Id, this.Text); // Add child controls foreach (CommonFileDialogControl item in this.items) { item.HostingDialog = HostingDialog; item.Attach(dialog); } // End visual group dialog.EndVisualGroup(); // Make this control prominent if needed if (IsProminent) dialog.MakeProminent(this.Id); // Sync unmanaged properties with managed properties SyncUnmanagedProperties(); }
public void OnItemSelected(IFileDialogCustomize pfdc, int dwIDCtl, int dwIDItem) { _dialog.OnItemSelected(pfdc, dwIDCtl, dwIDItem); }
public void OnControlActivating(IFileDialogCustomize pfdc, int dwIDCtl) { // TODO: Implement OnControlActivating }
public void OnCheckButtonToggled(IFileDialogCustomize pfdc, int dwIDCtl, bool bChecked) { // TODO: Implement OnCheckButtonToggled }
public void OnButtonClicked(IFileDialogCustomize pfdc, int dwIDCtl) { // TODO: Implement OnButtonClicked }
public void OnItemSelected(IFileDialogCustomize pfdc, int dwIDCtl, int dwIDItem) { // TODO: Implement OnItemSelected }
/// <summary> /// Attach the custom control itself to the specified dialog /// </summary> /// <param name="dialog">the target dialog</param> public abstract void Attach(IFileDialogCustomize dialog);
public void OnControlActivating(IFileDialogCustomize pfdc, int dwIDCtl) { }
/// <summary> /// Attach the ComboBox control to the dialog object /// </summary> /// <param name="dialog">The target dialog</param> internal override void Attach(IFileDialogCustomize dialog) { Debug.Assert(dialog != null, "CommonFileDialogComboBox.Attach: dialog parameter can not be null"); // Add the combo box control dialog.AddComboBox(this.Id); // Add the combo box items for (int index = 0; index < items.Count; index++) dialog.AddControlItem(this.Id, index, items[index].Text); // Set the currently selected item if (selectedIndex >= 0 && selectedIndex < items.Count) { dialog.SetSelectedControlItem(this.Id, this.selectedIndex); } else if (selectedIndex != -1) { throw new IndexOutOfRangeException("Index was outside the bounds of the CommonFileDialogComboBox."); } // Make this control prominent if needed if (IsProminent) dialog.MakeProminent(this.Id); // Sync additional properties SyncUnmanagedProperties(); }
/// <summary> /// Attach the RadioButtonList control to the dialog object /// </summary> /// <param name="dialog">The target dialog</param> internal override void Attach(IFileDialogCustomize dialog) { Debug.Assert(dialog != null, "CommonFileDialogRadioButtonList.Attach: dialog parameter can not be null"); // Add the radio button list control dialog.AddRadioButtonList(this.Id); // Add the radio button list items for (int index = 0; index < items.Count; index++) dialog.AddControlItem(this.Id, index, items[index].Text); // Set the currently selected item if (selectedIndex >= 0 && selectedIndex < items.Count) { dialog.SetSelectedControlItem(this.Id, this.selectedIndex); } else if (selectedIndex != -1) { throw new IndexOutOfRangeException("Index was outside the bounds of the CommonFileDialogRadioButtonList."); } // Sync unmanaged properties with managed properties SyncUnmanagedProperties(); }
/// <summary> /// Attach the custom control itself to the specified dialog /// </summary> /// <param name="dialog">the target dialog</param> internal abstract void Attach(IFileDialogCustomize dialog);
public void OnCheckButtonToggled(IFileDialogCustomize pfdc, int dwIDCtl, bool bChecked) { }
/// <summary> /// Attach this control to the dialog object /// </summary> /// <param name="dialog">Target dialog</param> internal override void Attach(IFileDialogCustomize dialog) { // Items are added via the menu itself }
public void OnButtonClicked(IFileDialogCustomize pfdc, int dwIDCtl) { }
public void OnButtonClicked(IFileDialogCustomize pfdc, int dwIDCtl) { if( dwIDCtl == FileDialog.HelpButtonId ) _dialog.DoHelpRequest(); }
public void OnItemSelected(IFileDialogCustomize pfdc, int dwIDCtl, int dwIDItem) { }
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); } }