void currentPlugin_OnResultReceived(object sender, EventArgs e) { UpdateTextBox(FeedbackTextBox, currentPlugin.Result); if (string.IsNullOrEmpty(currentPlugin.TrackingNumber)) { WriteLog("No tracking number received.", Color.Red); CurrentProcessStatusLabel.Text = "No tracking number received."; } else { if (UpdateTrackingNumber()) { if (!String.IsNullOrEmpty(Settings.ArchivePath)) { FileOperations.ArchiveFile(currentFile, Settings.ArchivePath); } else { FileOperations.DeleteFile(currentFile); } PreviewTextbox.Clear(); FeedbackTextBox.Clear(); CheckButton.Enabled = true; currentPlugin = null; } } }
private void skipButton_Click(object sender, EventArgs e) { StopAsyncTasks(); //Archive File. if (!String.IsNullOrEmpty(Settings.ArchivePath) && !String.IsNullOrEmpty(currentFile)) { FileOperations.ArchiveFile(currentFile, Settings.ArchivePath); } else { FileOperations.DeleteFile(currentFile); } PreviewTextbox.Clear(); FeedbackTextBox.Clear(); CheckButton.Enabled = true; currentPlugin = null; }
private bool ProcessData() { if (!string.IsNullOrEmpty(PreviewTextbox.Text)) { return(false); } CheckButton.Enabled = false; CurrentProcessStatusLabel.Text = "Checking download for despatch file"; currentFile = FileOperations.GetFirstFileInFolder(Settings.DownloadPath, "*.pvx"); if (!string.IsNullOrEmpty(currentFile)) { WriteLog(string.Format("Reading file {0}", currentFile), Color.Black); //read file var content = FileOperations.ReadFile(currentFile); //Find the right plugin to process. currentPlugin = DespatchPluginFactory.GetPlugin(content); if (currentPlugin != null) { PreviewTextbox.Text = ""; WriteLog(string.Format("Waiting to be processed by {0}", currentPlugin.PluginName), Color.Black); UpdateTextBox(PreviewTextbox, currentPlugin.GetPreview()); CurrentProcessStatusLabel.Text = "Previewing despatch file for " + currentPlugin.SalesOrderNumber; } } else { PreviewTextbox.Text = ""; CheckButton.Enabled = true; WriteLog("No file found.", Color.Black); CurrentProcessStatusLabel.Text = "No file found."; } if (!AutoCheck.Checked) { CheckButton.Enabled = true; } return(false); }