当前位置: 首页>>代码示例>>C#>>正文


C# CommonOpenFileDialog.Dispose方法代码示例

本文整理汇总了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();
 }
开发者ID:bitnick1000,项目名称:ConvertPictureFormats,代码行数:22,代码来源:MainWindow.xaml.cs

示例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();
            }
        }
开发者ID:AnonymousUser200102010,项目名称:Youtube-Download-Helper,代码行数:40,代码来源:Options.xaml.cs

示例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();
        }
开发者ID:Prashant-Jonny,项目名称:phever,代码行数:62,代码来源:Form1.cs

示例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!");
 }
开发者ID:bitnick1000,项目名称:ConvertPictureFormats,代码行数:23,代码来源:MainWindow.xaml.cs

示例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();
			}
        }
开发者ID:AnonymousUser200102010,项目名称:Youtube-Download-Helper,代码行数:44,代码来源:Options.xaml.cs


注:本文中的Microsoft.WindowsAPICodePack.Dialogs.CommonOpenFileDialog.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。