本文整理匯總了C#中Microsoft.WindowsAPICodePack.Dialogs.CommonOpenFileDialog.Dispose方法的典型用法代碼示例。如果您正苦於以下問題:C# CommonOpenFileDialog.Dispose方法的具體用法?C# CommonOpenFileDialog.Dispose怎麽用?C# CommonOpenFileDialog.Dispose使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Microsoft.WindowsAPICodePack.Dialogs.CommonOpenFileDialog
的用法示例。
在下文中一共展示了CommonOpenFileDialog.Dispose方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: MainWindow
public MainWindow()
{
InitializeComponent();
return;
var folderBrowser = new CommonOpenFileDialog();
folderBrowser.IsFolderPicker = true;
folderBrowser.Title = "Select folder";
folderBrowser.InitialDirectory = System.Environment.CurrentDirectory;
var result = folderBrowser.ShowDialog();
if (result == CommonFileDialogResult.Ok)
{
string filename = folderBrowser.FileName;
List<FileInfo> files = GetFiles(filename, ".bmp");
foreach (FileInfo f in files)
{
BitmapFormat(f.FullName);
}
}
folderBrowser.Dispose();
MessageBox.Show("Done!");
this.Close();
}
示例2: folderSelectButton_Click
private void folderSelectButton_Click (object sender, RoutedEventArgs e)
{
using (var dialog = new CommonOpenFileDialog())
{
dialog.Multiselect = false;
if (this.mainTab.IsSelected)
{
dialog.Title = "Select Your Primary Storage Folder";
dialog.InitialDirectory = savedSettings.MainSaveLocation;
}
else if (this.tempSaveLocation.IsSelected)
{
dialog.Title = "Select Your Temporary Storage Folder";
dialog.InitialDirectory = savedSettings.TemporarySaveLocation;
}
else
{
dialog.Title = "Select All Folders To Check For Existing Downloads";
dialog.InitialDirectory = this.validationDirListView.SelectedIndex >= 0 ? this.validationDirListView.SelectedItem.ToString() : savedSettings.ValidationLocations.FirstOrDefault();
dialog.Multiselect = true;
}
dialog.DefaultDirectory = AppDomain.CurrentDomain.BaseDirectory;
dialog.IsFolderPicker = true;
dialog.AddToMostRecentlyUsedList = false;
dialog.AllowNonFileSystemItems = false;
dialog.EnsureFileExists = true;
dialog.EnsurePathExists = true;
dialog.EnsureReadOnly = false;
dialog.EnsureValidNames = true;
dialog.ShowPlacesList = true;
if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
{
if (this.mainTab.IsSelected) savedSettings.MainSaveLocation = dialog.FileName;
else if (this.tempSaveLocation.IsSelected) savedSettings.TemporarySaveLocation = dialog.FileName;
else savedSettings.ValidationLocations = new ObservableCollection<string>(dialog.FileNames.ToList());
}
this.Focus();
dialog.Dispose();
}
}
示例3: cfdKFButton_Click
private void cfdKFButton_Click(object sender, EventArgs e)
{
// Initialize
detailsListView.Items.Clear();
pictureBox1.Image = null;
// Create a new CFD
CommonOpenFileDialog cfd = new CommonOpenFileDialog();
// Allow users to select non-filesystem objects
cfd.AllowNonFileSystemItems = true;
// Get the known folder selected
string kfString = knownFoldersComboBox.SelectedItem as string;
if (!string.IsNullOrEmpty(kfString))
{
try
{
// Try to get a known folder using the selected item (string).
IKnownFolder kf = KnownFolderHelper.FromCanonicalName(kfString);
// Set the knownfolder in the CFD.
cfd.InitialDirectoryShellContainer = kf as ShellContainer;
if (cfd.ShowDialog() == CommonFileDialogResult.OK)
{
ShellObject selectedSO = null;
try
{
// Get the selection from the user.
selectedSO = cfd.FileAsShellObject;
}
catch
{
// In some cases the user might select an object that cannot be wrapped
// by ShellObject.
MessageBox.Show("Could not create a ShellObject from the selected item.");
}
currentlySelected = selectedSO;
DisplayProperties(selectedSO);
showChildItemsButton.Enabled = selectedSO is ShellContainer ? true : false;
}
}
catch
{
MessageBox.Show("Could not create a KnownFolder object for the selected item");
}
}
else
{
MessageBox.Show("Invalid KnownFolder set.");
}
// Dispose our dialog in the end
cfd.Dispose();
}
示例4: Button_Click_1
private void Button_Click_1(object sender, RoutedEventArgs e)
{
var folderBrowser = new CommonOpenFileDialog();
folderBrowser.IsFolderPicker = false;
folderBrowser.Multiselect = true;
folderBrowser.Title = "Select files";
folderBrowser.InitialDirectory = System.Environment.CurrentDirectory;
var result = folderBrowser.ShowDialog();
if (result == CommonFileDialogResult.Ok)
{
MergePng merge = new MergePng();
foreach (string filename in folderBrowser.FileNames)
{
merge.AddFileName(filename);
}
merge.Merge();
string savePath = merge.filenames[0] + ".png";
merge.Save(savePath);
MessageBox.Show("Saved to " + savePath);
}
folderBrowser.Dispose();
//MessageBox.Show("Done!");
}
示例5: folderSelectButton_Click
private void folderSelectButton_Click (object sender, RoutedEventArgs e)
{
using (var dialog = new CommonOpenFileDialog())
{
dialog.Multiselect = false;
dialog.DefaultDirectory = AppDomain.CurrentDomain.BaseDirectory;
if (this.mainTab.IsSelected)
{
dialog.Title = "Select Your Primary Storage Folder";
dialog.InitialDirectory = savedSettings.MainSaveLocation;
}
else if (this.tempSaveLocation.IsSelected)
{
dialog.Title = "Select Your Temporary Storage Folder";
dialog.InitialDirectory = savedSettings.TemporarySaveLocation;
}
else if (this.validationDirectories.IsSelected)
{
dialog.Title = "Select Validation Directories to Add";
var itemsStore = this.validationDirListView.Items;
var selectedItems = this.validationDirListView.SelectedItems;
dialog.InitialDirectory = selectedItems.Count > 0 ? selectedItems[0].ToString() : itemsStore.Count > 0 ? itemsStore[0].ToString() : dialog.DefaultDirectory;
dialog.Multiselect = true;
}
dialog.IsFolderPicker = true;
dialog.AddToMostRecentlyUsedList = false;
dialog.AllowNonFileSystemItems = false;
dialog.EnsureFileExists = true;
dialog.EnsurePathExists = true;
dialog.EnsureReadOnly = false;
dialog.EnsureValidNames = true;
dialog.ShowPlacesList = true;
if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
{
if (this.mainTab.IsSelected) savedSettings.MainSaveLocation = dialog.FileName;
else if (this.tempSaveLocation.IsSelected) savedSettings.TemporarySaveLocation = dialog.FileName;
else if (this.validationDirectories.IsSelected)
{
savedSettings.ValidationLocations = new ObservableCollection<string>(savedSettings.ValidationLocations.Union(dialog.FileNames));
}
}
dialog.Dispose();
}
}