コード例 #1
0
ファイル: Form1.cs プロジェクト: UIKit0/AwesomiumSharp
 private void OnSelectLocalFiles( object sender, SelectLocalFilesEventArgs e )
 {
     using ( OpenFileDialog dialog = new OpenFileDialog()
     {
         InitialDirectory = Environment.GetFolderPath( Environment.SpecialFolder.MyDocuments ),
         CheckFileExists = true,
         Multiselect = e.SelectMultipleFiles
     } )
     {
         if ( dialog.ShowDialog( this ) == DialogResult.OK )
         {
             if ( dialog.FileNames.Length > 0 )
             {
                 e.SelectedFiles = dialog.FileNames;
             }
         }
     }
 }
コード例 #2
0
ファイル: TabView.cs プロジェクト: UIKit0/AwesomiumSharp
        private void OnSelectLocalFiles( object sender, SelectLocalFilesEventArgs e )
        {
            OpenFileDialog dialog = new OpenFileDialog()
            {
                InitialDirectory = Environment.GetFolderPath( Environment.SpecialFolder.MyDocuments ),
                CheckFileExists = true,
                Multiselect = e.SelectMultipleFiles
            };

            // Unlike WindowsForms, dialogs in WPF return a nullable boolean value.
            if ( ( dialog.ShowDialog( ParentWindow ) ?? false ) && ( dialog.FileNames.Length > 0 ) )
            {
                e.SelectedFiles = dialog.FileNames;
            }
        }