Пример #1
0
        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);
        }