bool IDialogControlHost.IsControlPropertyChangeAllowed( string propertyName, DialogControl control) { CommonFileDialog.GenerateNotImplementedException(); return(false); }
public HRESULT OnFolderChanging(IFileDialog pfd, IShellItem psiFolder) { CommonFileDialogFolderChangeEventArgs args = new CommonFileDialogFolderChangeEventArgs(CommonFileDialog.GetFileNameFromShellItem(psiFolder)); if (!firstFolderChanged) { parent.OnFolderChanging(args); } return(args.Cancel ? HRESULT.S_FALSE : HRESULT.S_OK); }
/// <summary> /// Displays the dialog. /// </summary> /// <returns>A <see cref="Microsoft.SDK.Samples.VistaBridge.Library.CommonFileDialogResult"/> object.</returns> public CommonFileDialogResult ShowDialog() { CommonFileDialogResult result; try { // Fetch derived native dialog (i.e. Save or Open). InitializeNativeFileDialog(); nativeDialog = GetNativeFileDialog(); // Apply outer properties to native dialog instance. ApplyNativeSettings(nativeDialog); InitializeEventSink(nativeDialog); // Clear user data if Reset has been called // since the last show. if (resetSelections) { resetSelections = false; } // Show dialog. showState = NativeDialogShowState.Showing; int hresult = nativeDialog.Show( CommonFileDialog.GetHandleFromWindow(parentWindow)); showState = NativeDialogShowState.Closed; // Create return information. if (ErrorHelper.Matches(hresult, Win32ErrorCode.ERROR_CANCELLED)) { canceled = true; fileNames.Clear(); } else { canceled = false; // Populate filenames if user didn't cancel. PopulateWithFileNames(fileNames); } result = new CommonFileDialogResult(canceled.Value); } finally { CleanUpNativeFileDialog(); } return(result); }
public NativeDialogEventSink(CommonFileDialog commonDialog) { this.parent = commonDialog; }
private void ApplyCommonSettings(CommonFileDialog openDialog) { openDialog.Title = "My Open File Dialog"; if (useFirstGuid) openDialog.UsageIdentifier = dialog1Guid; else openDialog.UsageIdentifier = dialog2Guid; useFirstGuid = !useFirstGuid; // Add custom file filter. openDialog.Filters.Add(new CommonFileDialogFilter("My File Types", "john,doe")); // Add some standard filters. openDialog.Filters.Add(CommonFileDialogStandardFilters.TextFiles); openDialog.Filters.Add(CommonFileDialogStandardFilters.OfficeFiles); }
private void AddCustomControls(CommonFileDialog openDialog) { // Add a RadioButtonList CommonFileDialogRadioButtonList list = new CommonFileDialogRadioButtonList("Options"); list.Items.Add(new CommonFileDialogRadioButtonListItem("Option A")); list.Items.Add(new CommonFileDialogRadioButtonListItem("Option B")); list.SelectedIndexChanged += RBLOptions_SelectedIndexChanged; list.SelectedIndex = 1; openDialog.Controls.Add(list); // Create a groupbox CommonFileDialogGroupBox groupBox = new CommonFileDialogGroupBox("Options"); // Create and add two check boxes to this group CommonFileDialogCheckBox checkA = new CommonFileDialogCheckBox("Option A", true); CommonFileDialogCheckBox checkB = new CommonFileDialogCheckBox("Option B", true); checkA.CheckedChanged += ChkOptionA_CheckedChanged; checkB.CheckedChanged += ChkOptionB_CheckedChanged; groupBox.Items.Add(checkA); groupBox.Items.Add(checkB); // Create and add a separator to this group groupBox.Items.Add(new CommonFileDialogSeparator()); // Create and add a button to this group CommonFileDialogButton btnCFDPushButton = new CommonFileDialogButton("Push Button"); btnCFDPushButton.Click += PushButton_Click; groupBox.Items.Add(btnCFDPushButton); // Add groupbox to dialog openDialog.Controls.Add(groupBox); // Add a Menu CommonFileDialogMenu menu = new CommonFileDialogMenu("Sample Menu"); CommonFileDialogMenuItem itemA = new CommonFileDialogMenuItem("Menu Item 1"); CommonFileDialogMenuItem itemB = new CommonFileDialogMenuItem("Menu Item 2"); itemA.Click += MenuOptionA_Click; itemB.Click += MenuOptionA_Click; menu.Items.Add(itemA); menu.Items.Add(itemB); openDialog.Controls.Add(menu); // Add a TextBox openDialog.Controls.Add(new CommonFileDialogLabel("Enter name")); openDialog.Controls.Add(new CommonFileDialogTextBox("textBox", Environment.UserName)); // Add a ComboBox CommonFileDialogComboBox comboBox = new CommonFileDialogComboBox(); comboBox.SelectedIndexChanged += ComboEncoding_SelectedIndexChanged; comboBox.Items.Add(new CommonFileDialogComboBoxItem("Combobox Item 1")); comboBox.Items.Add(new CommonFileDialogComboBoxItem("Combobox Item 2")); comboBox.SelectedIndex = 1; openDialog.Controls.Add(comboBox); }
public NativeDialogEventSink(CommonFileDialog commonDialog) { this.parent = commonDialog; }
void IDialogControlHost.ApplyControlPropertyChange( string propertyName, DialogControl control) { CommonFileDialog.GenerateNotImplementedException(); }
void IDialogControlHost.ApplyCollectionChanged() { CommonFileDialog.GenerateNotImplementedException(); }
bool IDialogControlHost.IsCollectionChangeAllowed() { CommonFileDialog.GenerateNotImplementedException(); return(false); }