Exemple #1
0
        private void MenuItem_Click_Invert(object sender, RoutedEventArgs e)
        {
            MenuItem mi = (MenuItem)sender;
            ObservableCollection <RenderSlice> rslist     = (ObservableCollection <RenderSlice>)mi.DataContext;
            IEnumerable <RenderSlice>          selectedrs = this.GetSelectedRenderSlices(rslist);

            foreach (RenderSlice rs in selectedrs)
            {
                // Inverst the scaling factor and calculate new range
                rs.Scale = -rs.Scale;
                float min = -rs.Offset;
                float max = (float)rs.Range - rs.Offset;

                // Update range and offset.
                rs.Zoominfo.PhysicalMax = max > min ? max : min;
                rs.Zoominfo.PhysicalMin = max > min ? min : max;
                rs.Offset = -max;
            }

            // Draw inversted signal
            RendererManager.UpdateRenderers(RendererManager.GetInvolvedRenderers(selectedrs));
        }