private void timerShowErrorMessage_Tick(object sender, EventArgs e) { timerShowErrorMessage.Stop(); if (hasWriteAndVerifyMetadataErrors) { string errors = listOfErrors; listOfErrors = ""; hasWriteAndVerifyMetadataErrors = false; //MessageBox.Show(errors, "Warning or Errors has occured!", MessageBoxButtons.OK); if (formMessageBoxWarnings == null || formMessageBoxWarnings.IsDisposed) { formMessageBoxWarnings = new FormMessageBox("Warning", errors); } else { formMessageBoxWarnings.AppendMessage(errors); } formMessageBoxWarnings.Owner = this; formMessageBoxWarnings.Show(); } try { timerShowErrorMessage.Start(); } catch (Exception ex) { Logger.Error(ex, "timerShowErrorMessage.Start failed."); } }
private void ActionSeeProcessQueue() { Dictionary <string, List <string> > fileTasks = new Dictionary <string, List <string> >(); string messageBoxQueuesInfo = "List of all process queues...\r\n"; try { messageBoxQueuesInfo += string.Format("Files: {0} Selected {1}\r\n", imageListView1.Items.Count, imageListView1.SelectedItems.Count); if (CommonQueueLazyLoadingAllSourcesAllMetadataAndRegionThumbnailsCountDirty() > 0) { messageBoxQueuesInfo += string.Format("Lazy loading queue: {0}\r\n", CommonQueueLazyLoadingAllSourcesAllMetadataAndRegionThumbnailsCountDirty()); } if (!string.IsNullOrWhiteSpace(FileHandler.FileLockedByProcess)) { messageBoxQueuesInfo += "**Locked file: " + FileHandler.FileLockedByProcess; } } catch { } try { if (countInvokeCalls > 0) { messageBoxQueuesInfo += string.Format("DataGridView: {0} invoke queue\r\n", countInvokeCalls); } foreach (FileEntry fileEntry in commonQueueLazyLoadingAllSourcesAllMetadataAndRegionThumbnails) { AddTaskToFileTasks(fileTasks, fileEntry.FileFullPath, fileEntry.LastWriteDateTime, "Lazy loading: read/check from all sources"); } foreach (FileEntry fileEntry in commonQueueLazyLoadingMediaThumbnail) { AddTaskToFileTasks(fileTasks, fileEntry.FileFullPath, fileEntry.LastWriteDateTime, "Lazy loading: Media Thumbnail"); } foreach (FileEntry fileEntry in commonLazyLoadingMapNomnatatim.Keys) { AddTaskToFileTasks(fileTasks, fileEntry.FileFullPath, fileEntry.LastWriteDateTime, "Lazy loading: in queue, MapNomnatatim"); } } catch { } if (readToCacheQueues.Count > 0) { try { messageBoxQueuesInfo += "Read to cache:"; //lock (_readToCacheQueuesLock) foreach (KeyValuePair <int, int> keyValuePair in readToCacheQueues) { ProgressBackgroundStatusText += " " + keyValuePair.Value; } messageBoxQueuesInfo += "\r\n"; } catch { } } if (deleteRecordQueues.Count > 0) { try { messageBoxQueuesInfo += "Delete records:"; //lock (_deleteRecordQueuesLock) { foreach (KeyValuePair <int, int> keyValuePair in deleteRecordQueues) { messageBoxQueuesInfo += " " + keyValuePair.Value; } messageBoxQueuesInfo += "\r\n"; } } catch { } } messageBoxQueuesInfo += "\r\n"; try { if (!string.IsNullOrEmpty(FileHandler.FileLockedByProcess)) { messageBoxQueuesInfo += "Last file Locked by process: " + FileHandler.FileLockedByProcess + "\r\n"; } } catch { } try { //lock (_fileSaveSizeLock) { foreach (KeyValuePair <string, long> keyValuePair in fileSaveSizeWatcher) { AddTaskToFileTasks(fileTasks, keyValuePair.Key, null, "Written: " + keyValuePair.Value); } } } catch { } try { //lock (commonQueueReadMetadataFromExiftoolLock) foreach (FileEntry fileEntry in commonQueueReadMetadataFromSourceExiftool) { AddTaskToFileTasks(fileTasks, fileEntry.FileFullPath, fileEntry.LastWriteDateTime, "Exiftool read: in queue, wait on turn"); } } catch { } try { //lock (mediaFilesNotInDatabaseLock) foreach (FileEntry fileEntry in exiftool_MediaFilesNotInDatabase) { AddTaskToFileTasks(fileTasks, fileEntry.FileFullPath, null, "Exiftool read, in process"); } } catch { } try { //lock (commonQueueMetadataWrittenByExiftoolReadyToVerifyLock) foreach (Metadata fileEntry in exiftoolSave_QueueMetadataWrittenByExiftoolReadyToVerify) { AddTaskToFileTasks(fileTasks, fileEntry.FileFullPath, fileEntry.FileDateModified, "In queue for: Will be verified after Exiftool readback"); } } catch { } try { //lock (commonQueueReadMetadataFromWindowsLivePhotoGalleryLock) foreach (FileEntry fileEntry in commonQueueReadMetadataFromSourceWindowsLivePhotoGallery) { AddTaskToFileTasks(fileTasks, fileEntry.FileFullPath, fileEntry.LastWriteDateTime, "In queue for: Read meta information from Windows Live Photo Gallery"); } } catch { } try { //lock (commonQueueReadMetadataFromMicrosoftPhotosLock) foreach (FileEntry fileEntry in commonQueueReadMetadataFromSourceMicrosoftPhotos) { AddTaskToFileTasks(fileTasks, fileEntry.FileFullPath, fileEntry.LastWriteDateTime, "In queue for: Read meta information from Microsoft Photos"); } } catch { } try { //lock (commonQueueReadPosterAndSaveFaceThumbnailsLock) foreach (Metadata fileEntry in commonQueueSaveToDatabaseRegionAndThumbnail) { if (fileEntry.PersonalRegionList.Count > 0) { AddTaskToFileTasks(fileTasks, fileEntry.FileFullPath, fileEntry.FileDateModified, "In queue for: Create thumbnail for region: " + fileEntry.PersonalRegionList.Count.ToString()); } } } catch { } try { //lock (commonQueueSaveMetadataUpdatedByUserLock) foreach (Metadata fileEntry in exiftoolSave_QueueSaveUsingExiftool_MetadataToSaveUpdatedByUser) { AddTaskToFileTasks(fileTasks, fileEntry.FileFullPath, fileEntry.FileDateModified, "In queue for: Wait to be saved with " + fileEntry.PersonalRegionList.Count.ToString() + " regions"); } } catch { } try { //lock (commonQueueSubsetMetadataToSaveLock) foreach (Metadata fileEntry in exiftoolSave_QueueSubset_MetadataToSaveUpdatedByUser) { AddTaskToFileTasks(fileTasks, fileEntry.FileFullPath, fileEntry.FileDateModified, "In queue for: Saving bulk using exiftool with " + fileEntry.PersonalRegionList.Count.ToString() + " regions"); } } catch { } try { //lock (commonQueueRenameLock) foreach (KeyValuePair <string, string> keyValuePair in commonQueueRenameMediaFiles) { AddTaskToFileTasks(fileTasks, keyValuePair.Key, null, "In queue for: Wait rename to " + keyValuePair.Value); } } catch { } foreach (KeyValuePair <string, List <string> > keyValuePair in fileTasks) { messageBoxQueuesInfo += keyValuePair.Key + "\r\n"; //filename foreach (string task in keyValuePair.Value) { messageBoxQueuesInfo += " " + task + "\r\n"; //tasks } } try { Logger.Warn(messageBoxQueuesInfo); if (string.IsNullOrWhiteSpace(messageBoxQueuesInfo)) { messageBoxQueuesInfo = "\r\nThe queue is empty.\r\nHere you will see all task in all queues\r\n"; } if (formMessageBoxThread == null || formMessageBoxThread.IsDisposed) { formMessageBoxThread = new FormMessageBox("Task list", messageBoxQueuesInfo); } else { formMessageBoxThread.UpdateMessage(messageBoxQueuesInfo); } formMessageBoxThread.Owner = this; formMessageBoxThread.Show(); } catch { } }