private void btnSourceFolder_Click(object sender, EventArgs e) { FileList = null; FileList = new List <ImageFile>(); using (var dialouge = new FolderBrowserDialog()) { if (dialouge.ShowDialog() == DialogResult.OK) { SplashScreenManager.ShowForm(this, typeof(ProgressForm), true, true, false); SplashScreenManager.Default.SetWaitFormDescription("Importing..."); txtSourcePath.EditValue = dialouge.SelectedPath; var dInfo = new DirectoryInfo(txtSourcePath.EditValue.ToString()); var fInfo = dInfo.GetFiles("*.jpg", chkIncludeSubFolder.Checked ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly); var orderedList = fInfo.OrderBy(x => x.CreationTime).ToList(); FileList.AddRange(orderedList.Select(file => new ImageFile { Name = file.Name, Number = file.Name.Substring(0, file.Name.Length - 4), Attributes = file.Attributes, FullPath = file.FullName, Rating = UseRatings ? GetRating(file) : "" })); SplashScreenManager.CloseForm(false); if (FileList.Count > 0) { btnPreview.Visibility = BarItemVisibility.Always; using (var form = new PreviewForm(FileList, UseRatings)) { form.ShowDialog(this); } } } } }
private void repositoryItemToggleSwitch1_EditValueChanged(object sender, EventArgs e) { var editor = (ToggleSwitch)sender; var logic = editor.EditValue; UseRatings = (bool)logic; if (txtSourcePath.EditValue != null) { FileList = null; FileList = new List <ImageFile>(); btnPreview.Visibility = BarItemVisibility.Always; SplashScreenManager.ShowForm(this, typeof(ProgressForm), true, true, false); SplashScreenManager.Default.SetWaitFormDescription("Processing Images..."); var dInfo = new DirectoryInfo(txtSourcePath.EditValue.ToString()); var fInfo = dInfo.GetFiles("*.jpg", chkIncludeSubFolder.Checked ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly); var orderedList = fInfo.OrderBy(x => x.CreationTime).ToList(); FileList.AddRange(orderedList.Select(file => new ImageFile { Name = file.Name, Number = Path.GetFileNameWithoutExtension(file.Name), Attributes = file.Attributes, FullPath = file.FullName, Rating = UseRatings ? GetRating(file) : "" })); SplashScreenManager.CloseForm(false); if (FileList.Count > 0) { var preview = new PreviewForm(FileList, UseRatings); preview.ShowDialog(this); } } }