private void chkUseRatings_CheckedChanged(object sender, ItemClickEventArgs e) { if (txtSourcePath.EditValue != null) { FileList = null; FileList = new List <ImageFile>(); 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) : "" })); if (FileList.Count > 0) { var preview = new PreviewForm(FileList, UseRatings); preview.ShowDialog(this); } //LoadImages(); } }
private void groupControlSource_DragDrop(object sender, DragEventArgs e) { var directory = string.Empty; string[] location = (string[])e.Data.GetData(DataFormats.FileDrop, false); FileAttributes attr = File.GetAttributes(location[0].ToString()); if (attr.HasFlag(FileAttributes.Directory)) { directory = location[0].ToString(); } else { directory = Path.GetDirectoryName(location[0].ToString()); } txtSourcePath.EditValue = directory; if (!string.IsNullOrEmpty(directory)) { FileList = null; FileList = new List <ImageFile>(); SplashScreenManager.ShowForm(this, typeof(ProgressForm), true, true, false); SplashScreenManager.Default.SetWaitFormDescription("Importing..."); txtSourcePath.EditValue = directory; 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 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); } } }