public IEnumerable <XElement> Main(XDocument unisensxml, IEnumerable <XElement> selectedsignals, double time_cursor, double time_start, double time_end, string parameter) { if (time_start >= time_end) { return(null); } if (MessageBox.Show("Es werden alle Messdaten unwiderruflich gelöscht, die außerhalb des markierten Bereichs liegen!", "Crop", MessageBoxButton.OKCancel, MessageBoxImage.Warning, MessageBoxResult.Cancel) == MessageBoxResult.Cancel) { return(null); } // If you want to delete more than 10 % of the signal, an extra warning is given. double length = Crop.GetSignalLength(unisensxml, selectedsignals); if (time_end - time_start < length * 0.9) { if (MessageBox.Show("Sind Sie Sich sicher, dass Sie mehr als 10% der Daten löschen wollen?", "Delete", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No) == MessageBoxResult.No) { return(null); } } foreach (XElement xe in selectedsignals) { switch (xe.Name.LocalName) { case "signalEntry": case "eventEntry": case "valuesEntry": switch (MeasurementEntry.GetFileFormat(xe)) { case FileFormat.Bin: CropBinary(xe, time_start, time_end); break; case FileFormat.Csv: CropCsv(xe, time_start, time_end); break; } break; } } return(null); }
private static bool cropSelection(double time_start, double time_end, XDocument unisensxml, IEnumerable <XElement> selectedsignals) { // If you want to delete more than 10 % of the signal, an extra warning is given. double length = Crop.GetSignalLength(unisensxml, selectedsignals); if (time_end - time_start < length * 0.9) { if (MessageBox.Show("Sind Sie Sich sicher, dass Sie mehr als 10% der Daten löschen wollen?", "Delete", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No) == MessageBoxResult.No) { return(false); } } // Renderer schließen foreach (XElement xe in selectedsignals) { RendererManager.CloseRenderer(xe); } foreach (XElement xe in selectedsignals) { switch (xe.Name.LocalName) { case "signalEntry": case "eventEntry": case "valuesEntry": switch (MeasurementEntry.GetFileFormat(xe)) { case FileFormat.Bin: CropBinary(xe, time_start, time_end); break; case FileFormat.Csv: CropCsv(xe, time_start, time_end); break; } break; } } // Renderer aktivieren foreach (XElement xe in selectedsignals) { try { RendererManager.ReOpenRenderer(xe); } catch { RendererManager.KillRenderer(xe); } } // If duration attribute is known: Recalculate duration attribute ResetDuration(unisensxml, time_end - time_start); ResetTimestampStart(unisensxml, time_start); RendererManager.UpdateTimeMax(); return(true); }