Exemple #1
0
 private void FilePathBtn_Click(object sender, EventArgs e)
 {
     using (var dialog = new OpenFileDialog())
     {
         dialog.Filter      = Resources.FileFilter;
         dialog.Multiselect = false;
         dialog.ShowDialog(new Form
         {
             ShowIcon = false,
             TopMost  = true
         });
         if (string.IsNullOrEmpty(dialog.FileName) || !File.Exists(dialog.FileName))
         {
             return;
         }
         FilePathTB.Text = dialog.FileName;
         FilePathTB.Select(0, FilePathTB.Text.Length - 1);
         FilePathTB.ScrollToCaret();
         DirTB.Text = Path.GetDirectoryName(FilePathTB.Text);
         if (DirTB.Text?.Length > 1)
         {
             DirTB.Select(0, DirTB.Text.Length - 1);
         }
         DirTB.ScrollToCaret();
     }
 }
Exemple #2
0
 private void DirBtn_Click(object sender, EventArgs e)
 {
     using (var dialog = new FolderBrowserDialog())
     {
         dialog.ShowDialog(new Form
         {
             ShowIcon = false,
             TopMost  = true
         });
         if (string.IsNullOrEmpty(dialog.SelectedPath) || !Directory.Exists(dialog.SelectedPath))
         {
             return;
         }
         DirTB.Text = Path.GetDirectoryName(dialog.SelectedPath);
         if (DirTB.Text?.Length > 1)
         {
             DirTB.Select(0, DirTB.Text.Length - 1);
         }
         DirTB.ScrollToCaret();
     }
 }