private void menuAddFile_Click(object sender, RoutedEventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); if (ofd.ShowDialog() == true) { recordFiles.Add(RecordFileName.ConvFullnameToRecordFilename(ofd)); } }
public static RecordFileName ConvFullnameToRecordFilename(string path) { RecordFileName rfn = new RecordFileName(); rfn.Filename = Path.GetFileName(path); rfn.NewFilename = rfn.Filename; rfn.FilePath = Path.GetDirectoryName(path); rfn.FileError = ""; return(rfn); }
public static RecordFileName ConvFullnameToRecordFilename(OpenFileDialog ofd) { RecordFileName rfn = new RecordFileName(); rfn.Filename = ofd.SafeFileName; rfn.NewFilename = rfn.Filename; rfn.FilePath = Path.GetDirectoryName(ofd.FileName); rfn.FileError = ""; return(rfn); }
private void menuAddFileDirectory_Click(object sender, RoutedEventArgs e) { using (var fbd = new System.Windows.Forms.FolderBrowserDialog()) { System.Windows.Forms.DialogResult dialogResult = fbd.ShowDialog(); if (dialogResult == System.Windows.Forms.DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath)) { string[] files = Directory.GetFiles(fbd.SelectedPath); foreach (var file in files) { recordFiles.Add(RecordFileName.ConvFullnameToRecordFilename(file)); } } } }