Beispiel #1
0
        // Fires the Completion event.
        private void OnCompletion(Exception ex)
        {
            if (Completion != null)
            {
                // Package our event arguments.
                CompletionEventArgs e = new CompletionEventArgs();
                e.Exception = ex;

                Completion(this, e);
            }
        }
Beispiel #2
0
        // The FileListProcessor completed.
        private void processorCompletion(object sender, CompletionEventArgs args)
        {
            listProcessor       = null;
            listProcessorThread = null;

            // Open the GUI.
            UnlockGUI();
            barStatus.ProgressBar.Value = 0;

            // Clear out the icon of the file that was marked as in-process.
            for (int i = 0; i < listFiles.Items.Count; i++)
            {
                if (listFiles.Items[i].ImageIndex == 4)
                {
                    listFiles.Items[i].ImageIndex = 0;
                    break;
                }
            }

            // If there's an error, show it to the user.
            if (args.Exception != null)
            {
                FrmLog.Instance.AddLine();

                if (args.Exception is ThreadAbortException)
                {
                    FrmLog.Instance.AddLine("--Processing Aborted by User--");
                }
                else
                {
                    FrmLog.Instance.AddLine("--Error: " + args.Exception.Message + "--");
                    MessageBox.Show("There was an error while processing the files:" +
                                    Environment.NewLine + Environment.NewLine +
                                    args.Exception.Message,
                                    "Verify", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            // Put final results into the log.
            FrmLog.Instance.AddLine();
            FrmLog.Instance.AddLine("    Total Files: " + listFiles.Items.Count.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat));
            FrmLog.Instance.AddLine("Files Processed: " + (fileListGood + fileListBad + fileListMissing + fileListIgnored).ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat));
            FrmLog.Instance.AddLine("     Good Files: " + fileListGood.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat));
            FrmLog.Instance.AddLine("      Bad Files: " + fileListBad.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat));
            FrmLog.Instance.AddLine("  Missing Files: " + fileListMissing.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat));
            FrmLog.Instance.AddLine("       Finished: " + DateTime.Now.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'sszzz"));

            // Save the log.
            if (cfg.GetValue("Program", "AutomaticallySaveLog", false))
            {
                FrmLog.Instance.Save(Path.ChangeExtension(FileList.sourceFile, ".log"));
            }
        }