private async void doSelectFolderAsync() { Invoke(new Action(async() => { enableButtons(false); if (mFolderBrowserDialog.ShowDialog() == DialogResult.OK) { mController.TargetDirectory = new DirectoryInfo(mFolderBrowserDialog.SelectedPath); await mImageProcessing.ProcessDirectoryAsync(mController.TargetDirectory.FullName); mFlowLayoutPanel.Controls.Clear(); foreach (FileInfo file in mController.TargetDirectory.GetFiles()) { Image img = Image.FromFile(file.FullName); ThumbnailControl thumbnail = new ThumbnailControl(); thumbnail.setImage(getThumbnail(img), file.FullName); mFlowLayoutPanel.Controls.Add(thumbnail); } } enableButtons(true); })); }
private async void doClearAsync() { Invoke(new Action(() => { enableButtons(false); // Clear Search Criteria foreach (int i in mMainColorsCheckedListBox.CheckedIndices) { mMainColorsCheckedListBox.SetItemCheckState(i, CheckState.Unchecked); } foreach (int i in mSecondaryColorsCheckedListBox.CheckedIndices) { mSecondaryColorsCheckedListBox.SetItemCheckState(i, CheckState.Unchecked); } foreach (int i in mLuminocityCheckedListBox.CheckedIndices) { mLuminocityCheckedListBox.SetItemCheckState(i, CheckState.Unchecked); } foreach (int i in mComplexityCheckedListBox.CheckedIndices) { mComplexityCheckedListBox.SetItemCheckState(i, CheckState.Unchecked); } // Reset ImageList to all images mFlowLayoutPanel.Controls.Clear(); foreach (FileInfo file in mController.TargetDirectory.GetFiles()) { Image img = Image.FromFile(file.FullName); ThumbnailControl thumbnail = new ThumbnailControl(); thumbnail.setImage(getThumbnail(img), file.FullName); mFlowLayoutPanel.Controls.Add(thumbnail); } enableButtons(true); })); }
private async void doSearchAsync() { Invoke(new Action(async() => { enableButtons(false); configureSearch(); await mSearch.SearchAsync(); mFlowLayoutPanel.Controls.Clear(); foreach (ImageData image in mController.ImagesSearchResults) { Image img = Image.FromFile(image.mPath); ThumbnailControl thumbnail = new ThumbnailControl(); thumbnail.setImage(getThumbnail(img), image.mPath); mFlowLayoutPanel.Controls.Add(thumbnail); } enableButtons(true); })); }