コード例 #1
0
        private unsafe void Dropped(DragEventArgs e, RenderSlice rs)
        {
            ObservableCollection <RenderSlice> l = this.GetRenderSliceListFromDropPoint(e);
            Renderer r         = rs.Renderer;
            double   maxbreite = rs.ImageSource.Height;
            int      imageWidth;

            if (l.Count > 0)
            {
                imageWidth = (int)l[0].ImageSource.Width;
            }
            else
            {
                imageWidth = 128;
            }

            RendererManager.Renderer_Update(rs, imageWidth, maxbreite);
            RendererManager.RenderSlice_Update(rs, imageWidth, maxbreite);

            rs.Scale = (float)(imageWidth / rs.Range);
            this.MoveRenderSlice(rs, l);
            XElement channel = rs.UnisensNode;

            RendererManager.Render(rs.Renderer, channel);
        }
コード例 #2
0
        public unsafe void ItemsControl_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            int imageWidth = (int)itemscontrol_RenderSliceImages.ActualHeight;
            ObservableCollection <RenderSlice> rslist = (ObservableCollection <RenderSlice>)itemscontrol_RenderSliceImages.DataContext;
            RenderSlice rs            = null;
            bool        width_changed = false;

            if (imageWidth < 10)
            {
                imageWidth = 10;
            }


            if (rslist != null)
            {
                // check if the width is changed or a slice is closed, when the mouse is released.
                if (imageWidth != ((RasterRenderSlice)rslist[0]).ImageWidth)
                {
                    width_changed = true;
                }
            }
            if (width_changed)
            {
                int i = 0;
                while (i < rslist.Count)
                {
                    // at adding a new RenderSlice in the rslist,
                    // the current RenderSlice is moved forward.
                    rs = rslist[0];
                    int deltaWidth = (int)(imageWidth - rs.ImageSource.Width);

                    int maxbreite = ((RasterRenderSlice)rs).ImageHeight;
                    // modify all RenderSlice of the Renderers
                    RendererManager.Renderer_Update(rs, imageWidth, maxbreite);
                    RendererManager.RenderSlice_Update(rs, imageWidth, maxbreite);

                    // Update Scale
                    rs.Scale = (float)(imageWidth / rs.Range);
                    //rs.ZoomInto(rs.Zoominfo.PhysicalMin, rs.Zoominfo.PhysicalMax);

                    Renderer r       = rs.Renderer;
                    XElement channel = rs.UnisensNode;

                    // old RenderSlice replaced by new
                    this.MoveRenderSlice(rs, rslist);

                    // paint all signals again
                    RendererManager.Render(r, channel);
                    i++;
                }
            }
        }