private void SetImportedEquipmentScheduledOutages(StreamReader statusLines) { string line; while (!(line = statusLines.ReadLine()).Equals("End Equipment")) { var outageOptions = line.Split(','); var importedOutage = new ScheduledOutage() { OutageStart = new DateTime( int.Parse(outageOptions[0].Substring(outageOptions[0].Length - 4)), int.Parse(outageOptions[0].Substring(outageOptions[0].Length - 8, 2)), int.Parse(outageOptions[0].Substring(outageOptions[0].Length - 6, 2)), int.Parse(outageOptions[1].Substring(outageOptions[1].Length - 4, 2)), int.Parse(outageOptions[1].Substring(outageOptions[1].Length - 2)), 0, DateTimeKind.Utc), OutageEnd = new DateTime( int.Parse(outageOptions[2].Substring(outageOptions[2].Length - 4)), int.Parse(outageOptions[2].Substring(outageOptions[2].Length - 8, 2)), int.Parse(outageOptions[2].Substring(outageOptions[2].Length - 6, 2)), int.Parse(outageOptions[3].Substring(outageOptions[3].Length - 4, 2)), int.Parse(outageOptions[3].Substring(outageOptions[3].Length - 2)), 0, DateTimeKind.Utc), Notes = outageOptions[4].Substring(9) }; var outage = new EquipmentScheduledOutage(this, importedOutage); scheduledOutages.Add(outage); ScheduledOutages.AddOutage(outage); } }
private void ScheduleOutageClick(object sender, RoutedEventArgs e) { var form = new NewScheduledOutageForm(); if (form.ShowDialog() == true) { try { var outage = new EquipmentScheduledOutage(this, form.ScheduledOutage); ScheduledOutages.AddOutage(outage); scheduledOutages.Add(outage); } catch (Exception ex) { var error = "Error Creating Scheduled Outage:\nUknown Exception\nSee dump fille"; ErrorLogger.ErrorDialog(error, ErrorType.Failure); ErrorLogger.LogError(error, ex, Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + Properties.Settings.Default.AppDataFolder + Properties.Settings.Default.ErrorLogFilename); } } }