private void processExisting() { addUserFeedback("Processing Existing Orders.", Color.Black); string configXml = configFiles.configXml; XDocument appConfigXml = XDocument.Load(configXml); var ordersFolder = appConfigXml.Descendants("orders_folder").ElementAt(0).Value; if (Directory.Exists(ordersFolder)) { //string[] orderXmls = Directory.GetFiles(orderFolder, "*.xml", SearchOption.TopDirectoryOnly); string[] orders = Directory.GetDirectories(ordersFolder, "*.order"); foreach (string order in orders) { string orderFolder = order; string orderDirName = orderFolder.Split('\\').Last(); string orderXmlFile = orderDirName.Replace("order", "xml"); string orderXml = Path.Combine(orderFolder, orderXmlFile); string orderID = orderXmlFile.Replace(".xml", ""); addUserFeedback("Processing order... ", Color.Black, orderID); orderCXML cXml = new orderCXML(); cXml.createXml(orderXml, orderID); } } else { addUserFeedback("Could not find orders folder. Please check settings.", Color.Red); } addUserFeedback("Finished Processing Existing Orders.", Color.Black); }
public void OnRenamed(object sender, RenamedEventArgs e) { //MessageBox.Show(order); //try //{ string order = e.FullPath; if (order.Substring(order.Length - 5) == "order") { string orderDirName = order.Split('\\').Last(); string orderXmlFile = orderDirName.Replace("order", "xml"); string orderXml = Path.Combine(order, orderXmlFile); string orderID = orderXmlFile.Replace(".xml", ""); this.Invoke((MethodInvoker) delegate { addUserFeedback("Processing order...", Color.Black, orderID); }); logIt logEntry = new logIt(orderID, "Processing order..."); orderCXML cXml = new orderCXML(); cXml.createXml(orderXml, orderID); } //} //catch (Exception ex) { //MessageBox.Show(ex.ToString()); // string order = e.FullPath; // this.Invoke((MethodInvoker)delegate { addUserFeedback("Could not start processing order " + order, Color.Red, order); }); // logIt logEntry = new logIt(order, "Could not start processing order. Message: " + ex.ToString()); // Directory.Move(order, order.Replace("order", "ERROR")); //} }