public void buttonWineTop_Click( Object sender, EventArgs e ) { OpenFileDialog dialog = null; try { dialog = new OpenFileDialog(); String dir = textWineTop.Text; if ( dir != null && dir.Length > 0 ) { dialog.SetSelectedFile(Path.Combine( dir, "a" )); } if ( AppManager.showModalDialog( dialog, true, this ) == DialogResult.OK ) { dir = dialog.FileName; if (System.IO.File.Exists(dir)) { // ファイルが選ばれた場合,その所属ディレクトリを値として用いる dir = PortUtil.getDirectoryName( dir ); } textWineTop.Text = dir; } } catch ( Exception ex ) { } }
private void onAquesToneChooseButtonClicked( System.Windows.Forms.TextBox text_box ) { OpenFileDialog dialog = new OpenFileDialog(); if (text_box.Text != "" && Directory.Exists(PortUtil.getDirectoryName(text_box.Text))) { dialog.SetSelectedFile(text_box.Text); } var dr = AppManager.showModalDialog( dialog, true, this ); if ( dr == System.Windows.Forms.DialogResult.OK ) { String path = dialog.FileName; text_box.Text = path; } }