예제 #1
0
		public static TileBrush GetResourceBrush(Guid? uid, ResourceType type, bool showError = true)
		{
			TileBrush brush = null;
			if (uid.HasValue && uid != Guid.Empty)
				try
				{
					switch (type)
					{
						case ResourceType.Image:
							brush = new ImageBrush(ServiceFactoryBase.ContentService.GetBitmapContent(uid.Value));
							break;
						case ResourceType.Visual:
							var visual = ServiceFactoryBase.ContentService.GetVisual(uid.Value);
							UpdateReferences(visual);
							brush = new VisualBrush(visual);
							break;
						case ResourceType.Drawing:
							brush = new DrawingBrush(ServiceFactoryBase.ContentService.GetDrawing(uid.Value));
							break;
					}
				}
				catch (Exception e)
				{
					Logger.Error(e, "Исключение при вызове ImageHelper.GetResourceImage({0},{1})", uid, type);
					if (showError)
						MessageBoxService.ShowWarningExtended("Возникла ошибка при загрузке изображения");
				}
			return brush;
		}
예제 #2
0
        public fullscreen(VisualBrush vb, MW_ViewModel vm)
        {
            this.DataContext = vm;
            InitializeComponent();

            display.Fill = vb;
        }
예제 #3
0
 private static byte[] GetPngImage(FrameworkElement element)
 {
     var size = new Size(double.PositiveInfinity, double.PositiveInfinity);
     element.Measure(size);
     element.Arrange(new Rect(element.DesiredSize));
     var renderTarget =
       new RenderTargetBitmap((int)element.RenderSize.Width,
                              (int)element.RenderSize.Height,
                              96, 96,
                              PixelFormats.Pbgra32);
     var sourceBrush = new VisualBrush(element);
     var drawingVisual = new DrawingVisual();
     using (DrawingContext drawingContext = drawingVisual.RenderOpen())
     {
         drawingContext.DrawRectangle(
             sourceBrush, null, new Rect(
                                    new Point(0, 0),
                                    new Point(element.RenderSize.Width,
                                    element.RenderSize.Height)));
     }
     renderTarget.Render(drawingVisual);
     var pngEncoder = new PngBitmapEncoder();
     pngEncoder.Frames.Add(BitmapFrame.Create(renderTarget));
     using (var outputStream = new MemoryStream())
     {
         pngEncoder.Save(outputStream);
         return outputStream.ToArray();
     }
 }
예제 #4
0
        public Tile(ICase tile, TileFactory tileFactory, List<Unite> listUnite, SolidColorBrush playerBrush)
        {
            InitializeComponent();
            this.tile = tile;
            this.nbUnite = listUnite.Count;
            VisualBrush myBrush = new VisualBrush();
            aPanel = new Grid();

            aPanel.Background = tileFactory.getViewTile(tile);

            // Create some text.
            TextBlock backText = new TextBlock();
            Canvas.SetZIndex(backText, 3);
            if (listUnite != null && listUnite.Count > 0)
            {
                backText.Text = " " + listUnite.Count.ToString() + " ";
                backText.Background = (SolidColorBrush)new BrushConverter().ConvertFromString(listUnite[0].Proprietaire.Couleur);
                backText.Foreground = Brushes.White;
            }
            FontSizeConverter fSizeConverter = new FontSizeConverter();
            backText.FontSize = (double)fSizeConverter.ConvertFromString("10pt");
            backText.Margin = new Thickness(10);
            Grid.SetColumn(backText, 0);
            Grid.SetRow(backText, 0);
            DropShadowEffect myDropShadowEffect  = new DropShadowEffect();
            myDropShadowEffect.BlurRadius = 1;
            myDropShadowEffect.Color = Color.FromRgb(0,0,0);
            myDropShadowEffect.ShadowDepth = 2;
            backText.Effect=myDropShadowEffect;
            aPanel.Children.Add(backText);
            myBrush.Visual = aPanel;
            rect.Fill = myBrush;
            rect1.Stroke = playerBrush;
        }
예제 #5
0
        private static Border BuildGrid(int cellWidth = 50, int cellHeight = 50)
        {
            var gridBorder = new Border();

            var cellRect = new Rectangle
            {
                Stroke = Brushes.DarkGray,
                StrokeThickness = 1,
                Height = 50,
                Width = 50,
                StrokeDashArray = new DoubleCollection(new double[] {5, 3})
            };

            var vb = new VisualBrush(cellRect)
            {
                TileMode = TileMode.Tile,
                Viewport = new System.Windows.Rect(0, 0, cellHeight, cellWidth),
                ViewportUnits = BrushMappingMode.Absolute,
                Viewbox = new System.Windows.Rect(0, 0, cellHeight, cellWidth),
                ViewboxUnits = BrushMappingMode.Absolute
            };
            gridBorder.Background = vb;

            return gridBorder;
        }
예제 #6
0
파일: Screenshot.cs 프로젝트: afrog33k/eAd
        public static RenderTargetBitmap GetRenderTargetBitmap(this UIElement source, double scale)
        {
            if (source.RenderSize.Height == 0 || source.RenderSize.Width == 0)
                return null;

            double actualHeight = source.RenderSize.Height;
            double actualWidth = source.RenderSize.Width;

            double renderHeight = actualHeight*scale;
            double renderWidth = actualWidth*scale;

            var renderTarget = new RenderTargetBitmap((int) renderWidth, (int) renderHeight, 96, 96,
                                                      PixelFormats.Pbgra32);
            var sourceBrush = new VisualBrush(source);

            var drawingVisual = new DrawingVisual();
            DrawingContext drawingContext = drawingVisual.RenderOpen();

            using (drawingContext)
            {
                drawingContext.PushTransform(new ScaleTransform(scale, scale));
                drawingContext.DrawRectangle(sourceBrush, null,
                                             new Rect(new Point(0, 0), new Point(actualWidth, actualHeight)));
            }
            renderTarget.Render(drawingVisual);
            return renderTarget;
        }
예제 #7
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="pieceNumber">Which piece number this piece contains.</param>
 /// <param name="pieceShape">The shape of the pieces.</param>
 /// <param name="brush">The image and viewbox to use as this piece's visual.</param>
 public PuzzlePiece(int pieceNumber, Geometry pieceShape, VisualBrush brush) 
 {
     clipShape = pieceShape;
     imageBrush = brush;
     pieces = new HashSet<int>();
     pieces.Add(pieceNumber);
 }
        public static TextDecoration Squiggly(Color color, TextDecorationLocation location = TextDecorationLocation.Underline)
        {
            var penVisual = new Path
            {
                Stroke = new SolidColorBrush(color),
                StrokeThickness = 0.2,
                StrokeEndLineCap = PenLineCap.Square,
                StrokeStartLineCap = PenLineCap.Square,
                Data = new PathGeometry(new[] { new PathFigure(new Point(0, 1), new[] { new BezierSegment(new Point(1, 0), new Point(2, 2), new Point(3, 1), true) }, false) })
            };

            var penBrush = new VisualBrush
            {
                Viewbox = new Rect(0, 0, 3, 2),
                ViewboxUnits = BrushMappingMode.Absolute,
                Viewport = new Rect(0, 0.8, 6, 3),
                ViewportUnits = BrushMappingMode.Absolute,
                TileMode = TileMode.Tile,
                Visual = penVisual
            };

            var pen = new Pen
            {
                Brush = penBrush,
                Thickness = 6
            };

            return new TextDecoration(location, pen, 0, TextDecorationUnit.FontRecommended, TextDecorationUnit.FontRecommended);
        }
예제 #9
0
        private BitmapSource CreateBitmapFromVisuals(Visual target, FrameworkElement cursor)
        {
            Rect bounds = VisualTreeHelper.GetDescendantBounds(target);

            RenderTargetBitmap renderBitmap = new RenderTargetBitmap(800, 600, 96, 96, PixelFormats.Pbgra32);

            DrawingVisual dv = new DrawingVisual();
            using (DrawingContext ctx = dv.RenderOpen())
            {
                VisualBrush vb = new VisualBrush(target);
                VisualBrush vbCursor = new VisualBrush(cursor);

                // For linear gradient over ghost image.
                ////LinearGradientBrush opacityMask = new LinearGradientBrush(Color.FromArgb(255, 1, 1, 1), Color.FromArgb(0, 1, 1, 1), 30);
                ////ctx.PushOpacityMask(opacityMask);

                vb.Opacity = _opacity;

                Rect scaledBounds = new Rect(bounds.Location, new Size(bounds.Width * _scaleX, bounds.Height * _scaleY));

                ctx.DrawRectangle(vbCursor, null, new Rect(0, 0, cursor.ActualWidth, cursor.ActualHeight));
                ctx.DrawRectangle(vb, null, new Rect(new Point(cursor.ActualWidth, cursor.ActualHeight), scaledBounds.Size));

                ////ctx.Pop();
            }

            renderBitmap.Render(dv);
            return renderBitmap;
        }
예제 #10
0
        private void PuzzleGridLoaded(object sender, RoutedEventArgs e)
        {
            if (IsApplyingStyle)
            {
                Width = _masterPuzzleSize.Width;
                Height = _masterPuzzleSize.Height;

                var edgeSize = 1.0f/_numRows;
                var pieceRowHeight = _masterPuzzleSize.Height/_numRows;
                var pieceColWidth = _masterPuzzleSize.Width/_numRows;

                // Set up viewbox appropriately for each tile.
                foreach (Button b in Children)
                {
                    var root = (Border) b.Template.FindName("TheTemplateRoot", b);

                    var row = (int) b.GetValue(RowProperty);
                    var col = (int) b.GetValue(ColumnProperty);

                    var vb = new VisualBrush(_elementForPuzzle)
                    {
                        Viewbox = new Rect(col*edgeSize, row*edgeSize, edgeSize, edgeSize),
                        ViewboxUnits = BrushMappingMode.RelativeToBoundingBox
                    };

                    root.Background = vb;
                    root.Height = pieceRowHeight;
                    root.Width = pieceColWidth;
                }
            }
        }
예제 #11
0
        public DragAdorner(UIElement owner, UIElement adornElement, bool useVisualBrush, double opacity)
            : base(owner)
        {
            _owner = owner;
            if (useVisualBrush)
            {
                VisualBrush _brush = new VisualBrush(adornElement);
                _brush.Opacity = opacity;
                Rectangle r = new Rectangle();
                //r.Stroke = Brushes.Red;
                //r.StrokeThickness = 2;
                r.RadiusX = 3;
                r.RadiusY = 3;
                r.Width = adornElement.DesiredSize.Width;
                r.Height = adornElement.DesiredSize.Height;

                XCenter = adornElement.DesiredSize.Width / 2;
                YCenter = adornElement.DesiredSize.Height / 2;

                r.Fill = _brush;
                _child = r;

            }
            else
                _child = adornElement;
        }
예제 #12
0
        /// 
        /// Gets a JPG "screenshot" of the current UIElement 
        /// 
        /// UIElement to screenshot 
        /// Scale to render the screenshot 
        /// JPG Quality 
        /// Byte array of JPG data 
        public byte[] GetJpgImage(double scale, int quality, int dpi)
        {
            double actualHeight = this.RootVisual.RenderSize.Height;
            double actualWidth = this.RootVisual.RenderSize.Width;

            double renderHeight = actualHeight * scale;
            double renderWidth = actualWidth * scale;

            RenderTargetBitmap renderTarget = new RenderTargetBitmap((int)renderWidth, (int)renderHeight, dpi, dpi, PixelFormats.Pbgra32);
            VisualBrush sourceBrush = new VisualBrush(this.RootVisual);

            DrawingVisual drawingVisual = new DrawingVisual();
            DrawingContext drawingContext = drawingVisual.RenderOpen();

            using (drawingContext)
            {
                drawingContext.PushTransform(new ScaleTransform(scale, scale));
                drawingContext.DrawRectangle(sourceBrush, null, new Rect(new Point(0, 0), new Point(actualWidth, actualHeight)));
            }

            renderTarget.Render(drawingVisual);
            JpegBitmapEncoder jpgEncoder = new JpegBitmapEncoder();
            jpgEncoder.QualityLevel = quality;
            jpgEncoder.Frames.Add(BitmapFrame.Create(renderTarget));

            Byte[] _imageArray;
            using (MemoryStream outputStream = new MemoryStream())
            {
                jpgEncoder.Save(outputStream);
                _imageArray = outputStream.ToArray();
            }

            return _imageArray;
        }
예제 #13
0
        public DiagramCanvas()
        {
            this.selectedItems = new List<ISelectable>();

            // Create ParentDiagram grdi visual brush
            //<VisualBrush x:Key="DiagramDotFillBrush"
            //		TileMode="Tile"
            //		Viewport="0,0,10,10"
            //		ViewportUnits="Absolute"
            //		Viewbox="0,0,12,12"
            //		ViewboxUnits="Absolute">
            //	<VisualBrush.Visual>
            //		<Ellipse Fill="#777" Width="1" Height="1" />
            //	</VisualBrush.Visual>
            //</VisualBrush>
            var brushViewport = new Rect(0, 0, DiagramCanvas.DiagramViewPadding, DiagramCanvas.DiagramViewPadding);
            this.diagramGridBrush = new VisualBrush(
                new Ellipse() {
                    Fill = new SolidColorBrush(new Color() {R = 119, G = 119, B = 119, A = 255}),
                    Width = 1.0,
                    Height = 1.0
                }) {
                    TileMode = TileMode.Tile,
                    ViewboxUnits = BrushMappingMode.Absolute,
                    ViewportUnits = BrushMappingMode.Absolute,
                    Viewbox = brushViewport,
                    Viewport = brushViewport
                };
            this.ShowDiagramGrid = true;
            this.StickToDiagramGrid = true;
        }
예제 #14
0
 /// <summary>
 /// </summary>
 /// <param name="source"> </param>
 /// <param name="scale"> </param>
 /// <param name="quality"> </param>
 /// <returns> </returns>
 public static byte[] GetJpgImage(UIElement source, double scale, int quality)
 {
     var actualHeight = source.RenderSize.Height;
     var actualWidth = source.RenderSize.Width;
     var renderHeight = actualHeight * scale;
     var renderWidth = actualWidth * scale;
     var renderTarget = new RenderTargetBitmap((int) renderWidth, (int) renderHeight, 96, 96, PixelFormats.Pbgra32);
     var sourceBrush = new VisualBrush(source);
     var drawingVisual = new DrawingVisual();
     var drawingContext = drawingVisual.RenderOpen();
     using (drawingContext)
     {
         drawingContext.PushTransform(new ScaleTransform(scale, scale));
         drawingContext.DrawRectangle(sourceBrush, null, new Rect(new Point(0, 0), new Point(actualWidth, actualHeight)));
     }
     renderTarget.Render(drawingVisual);
     var jpgEncoder = new JpegBitmapEncoder
     {
         QualityLevel = quality
     };
     jpgEncoder.Frames.Add(BitmapFrame.Create(renderTarget));
     Byte[] imageArray;
     using (var outputStream = new MemoryStream())
     {
         jpgEncoder.Save(outputStream);
         imageArray = outputStream.ToArray();
     }
     return imageArray;
 }
예제 #15
0
        private void MouseOnMove(object sender, MouseEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                endPoint = e.GetPosition(canvas);
                Rect targetRect = new Rect(originPoint, endPoint);
                rect.Width = targetRect.Width;
                rect.Height = targetRect.Height;

                //获取装饰元素作为VisualBrush的来源
                VisualBrush vb = new VisualBrush(DecoratedElement);
                vb.Viewbox = targetRect;
                vb.ViewboxUnits = BrushMappingMode.Absolute;

                rect.Fill = vb;

                Canvas.SetTop(rect, targetRect.Top);
                Canvas.SetLeft(rect, targetRect.Left);
                if (canvas.Children.Count==0)
                {
                    canvas.Children.Add(rect);
                }

               Debug.WriteLine(string.Format("endPoint x:{0},y:{1}", endPoint.X, endPoint.Y));
            }
        }
예제 #16
0
        public DragAdorner(UIElement owner, UIElement adornElement, bool useVisualBrush, double opacity)
            : base(owner)
        {
            this.owner  = owner;

            if (useVisualBrush)
            {
                VisualBrush brush   = new VisualBrush(adornElement);
                Rectangle   rect    = new Rectangle();

                brush.Opacity       = opacity;
                rect.RadiusX        = 3;
                rect.RadiusY        = 3;
                rect.Width          = adornElement.DesiredSize.Width;
                rect.Height         = adornElement.DesiredSize.Height;

                this.XCenter        = adornElement.DesiredSize.Width / 2;
                this.YCenter        = adornElement.DesiredSize.Height / 2;

                rect.Fill = brush;

                this.child = rect;
            }
            else
            {
                this.child = adornElement;
            }
        }
예제 #17
0
        public ParticleSystem(int maxCount, System.Windows.Media.Color color)
        {
            this.maxParticleCount = maxCount;

            this.particleList = new List<Particle>();

            this.particleModel = new GeometryModel3D();
            this.particleModel.Geometry = new MeshGeometry3D();

            Ellipse e = new Ellipse();
            e.Width = 32.0;
            e.Height = 32.0;
            RadialGradientBrush b = new RadialGradientBrush();
            b.GradientStops.Add(new GradientStop(System.Windows.Media.Color.FromArgb(0xFF, color.R, color.G, color.B), 0.25));
            b.GradientStops.Add(new GradientStop(System.Windows.Media.Color.FromArgb(0x00, color.R, color.G, color.B), 1.0));
            e.Fill = b;
            e.Measure(new System.Windows.Size(32, 32));
            e.Arrange(new Rect(0, 0, 32, 32));

            var brush = new VisualBrush(e);

            DiffuseMaterial material = new DiffuseMaterial(brush);

            this.particleModel.Material = material;

            this.rand = new Random(brush.GetHashCode());
        }
예제 #18
0
        public static RenderTargetBitmap GetImage(UIElement fe, Brush background = null, Size sz = default(Size), int dpi = 144)
        {
            if (sz.Width < alib.Math.math.ε || sz.Height < alib.Math.math.ε)
            {
                fe.Measure(util.infinite_size);
                sz = fe.DesiredSize; //VisualTreeHelper.GetContentBounds(fe).Size; //
            }

            DrawingVisual dv = new DrawingVisual();
            RenderOptions.SetEdgeMode(dv, EdgeMode.Aliased);

            using (DrawingContext ctx = dv.RenderOpen())
            {
                Rect r = new Rect(0, 0, sz.Width, sz.Height);
                if (background != null)
                    ctx.DrawRectangle(background, null, r);

                VisualBrush br = new VisualBrush(fe);
                br.AutoLayoutContent = true;
                ctx.DrawRectangle(br, null, r);
            }

            Double f = dpi / 96.0;

            RenderTargetBitmap bitmap = new RenderTargetBitmap(
                (int)(sz.Width * f) + 1,
                (int)(sz.Height * f) + 1,
                dpi,
                dpi,
                PixelFormats.Pbgra32);
            bitmap.Render(dv);
            return bitmap;
        }
예제 #19
0
        public static byte[] GetScreenShot(this UIElement source, double scale, int quality)
        {
            double renderHeight = source.RenderSize.Height * scale;
            double renderWidth = source.RenderSize.Width * scale;

            RenderTargetBitmap renderTarget = new RenderTargetBitmap((int)renderWidth, (int)renderHeight, 96, 96, PixelFormats.Pbgra32);
            VisualBrush sourceBrush = new VisualBrush(source);

            DrawingVisual drawingVisual = new DrawingVisual();
            DrawingContext drawingContext = drawingVisual.RenderOpen();

            using (drawingContext)
            {
                drawingContext.PushTransform(new ScaleTransform(scale, scale));
                drawingContext.DrawRectangle(sourceBrush, null, new Rect(new Point(0, 0), new Point(source.RenderSize.Width, source.RenderSize.Height)));
            }
            renderTarget.Render(drawingVisual);
            JpegBitmapEncoder jpgEncoder = new JpegBitmapEncoder();
            jpgEncoder.QualityLevel = quality;
            jpgEncoder.Frames.Add(BitmapFrame.Create(renderTarget));

            Byte[] image;
            using (MemoryStream outputStream = new MemoryStream())
            {
                jpgEncoder.Save(outputStream);
                image = outputStream.ToArray();
            }
            return image;
        }
예제 #20
0
        public DragAdorner(UIElement owner, UIElement adornElement, bool useVisualBrush, double opacity)
            : base(owner)
        {
            System.Diagnostics.Debug.Assert(owner != null);
            System.Diagnostics.Debug.Assert(adornElement != null);
            _owner = owner;
            if (useVisualBrush)
            {
                VisualBrush _brush = new VisualBrush(adornElement);
                _brush.Opacity = opacity;
                Rectangle r = new Rectangle();
                r.RadiusX = 3;
                r.RadiusY = 3;

                //TODO: questioning DesiredSize vs. Actual 
                r.Width = adornElement.DesiredSize.Width;
                r.Height = adornElement.DesiredSize.Height;

                XCenter = adornElement.DesiredSize.Width / 2;
                YCenter = adornElement.DesiredSize.Height / 2;

                r.Fill = _brush;
                _child = r;

            }
            else
                _child = adornElement;


        }
예제 #21
0
        public DragAdorner(UIElement owner, UIElement adornElement, bool useVisualBrush, double opacity, double scaleRatio)
            : base(owner)
        {
            _owner = owner;
            if (useVisualBrush)
            {
                VisualBrush brush = new VisualBrush(adornElement);
                brush.Opacity = opacity;
                Rectangle r = new Rectangle();
                r.RadiusX = 3;
                r.RadiusY = 3;

                r.Width = adornElement.DesiredSize.Width * scaleRatio;
                r.Height = adornElement.DesiredSize.Height * scaleRatio;

                _xCenter = r.Width / 2;
                _yCenter = r.Height / 2;

                r.Fill = brush;
                _child = r;

            }
            else
                _child = adornElement;
        }
예제 #22
0
파일: DragAdorner.cs 프로젝트: bejumi/OCTGN
        public DragAdorner(UIElement owner, UIElement adornElement, bool useVisualBrush, double opacity)
            : base(owner)
        {
            Debug.Assert(owner != null);
            Debug.Assert(adornElement != null);
            Owner = owner;
            if (useVisualBrush)
            {
                var brush = new VisualBrush(adornElement) {Opacity = opacity};
                var r = new Rectangle
                            {
                                RadiusX = 3,
                                RadiusY = 3,
                                Width = adornElement.DesiredSize.Width,
                                Height = adornElement.DesiredSize.Height
                            };

                XCenter = adornElement.DesiredSize.Width/2;
                YCenter = adornElement.DesiredSize.Height/2;

                r.Fill = brush;
                Child = r;
            }
            else
                Child = adornElement;
        }
예제 #23
0
        public void SetPreviewElement(FrameworkElement element)
        {
            double x = 0;
              double y = 0;
              GetCurrentDPI(out x, out y);

              // Does the DrawingBrush thing seem a little hacky? Yeah, it's a necessary hack.  See:
              // http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=364041

              Rect bounds = VisualTreeHelper.GetDescendantBounds(element);

              RenderTargetBitmap r = new RenderTargetBitmap((int)(element.ActualWidth * x / 96), (int)(element.ActualHeight * y / 96), (int)x, (int)y, PixelFormats.Pbgra32);

              DrawingVisual dv = new DrawingVisual();
              using (DrawingContext ctx = dv.RenderOpen()) {
            VisualBrush vb = new VisualBrush(element);

            ctx.DrawRectangle(vb, null, new Rect(new Point(), bounds.Size));
              }
              r.Render(dv);

              DragImage = r;

              InvalidateMeasure();
        }
        public void SaveToPng( Canvas surface, string file )
        {
            // Save current canvas transform
            var transform = surface.LayoutTransform;
            // reset current transform (in case it is scaled or rotated)
            surface.LayoutTransform = null;

            var size = new Size( 1600, 900 );

            // Attentation: Measure and arrange the surface !
            surface.Measure( size );
            surface.Arrange( new Rect( size ) );

            var renderBitmap = new RenderTargetBitmap( (int)size.Width, (int)size.Height, 96d, 96d, PixelFormats.Pbgra32 );

            var bounds = VisualTreeHelper.GetDescendantBounds( surface );
            var dv = new DrawingVisual();
            using ( var ctx = dv.RenderOpen() )
            {
                var vb = new VisualBrush( surface );
                ctx.DrawRectangle( vb, null, new Rect( new Point(), bounds.Size ) );
            }

            renderBitmap.Render( dv );
            using ( var outStream = new FileStream( file, FileMode.OpenOrCreate, FileAccess.Write ) )
            {
                var encoder = new PngBitmapEncoder();
                encoder.Frames.Add( BitmapFrame.Create( renderBitmap ) );
                encoder.Save( outStream );
            }

            // Restore previously saved layout
            surface.LayoutTransform = transform;
        }
예제 #25
0
        public void Load(Song song, bool update = false)
        {
            if (song == null)
            {
                throw new ArgumentNullException("song");
            }

            this.song = song;

            base.Load(false, true);

            DoubleAnimation ani = new DoubleAnimation {
                From = 0.0, To = 1.0
            };

            storyboard = new Storyboard();
            storyboard.Children.Add(ani);
            Storyboard.SetTarget(ani, Control.ForegroundGrid);
            Storyboard.SetTargetProperty(ani, new PropertyPath(Image.OpacityProperty));

            if (song.VideoBackground == null)
            {
                frontImage = new ImageGrid {
                    Background = Brushes.Black, Stretch = Stretch.UniformToFill
                };
                backImage = new ImageGrid {
                    Background = Brushes.Black, Stretch = Stretch.UniformToFill
                };

                this.Control.BackgroundGrid.Children.Add(backImage);
                this.Control.ForegroundGrid.Children.Add(frontImage);
            }
            else
            {
                videoBackground = new AudioVideo.VlcWrapper();                 // TODO: use configurable wrapper (does WPF work?)

                videoBackground.Autoplay = true;
                videoBackground.Loop     = true;
                try
                {
                    videoBackground.Load(DataManager.Backgrounds.GetFile(song.VideoBackground).Uri);
                }
                catch (FileNotFoundException)
                {
                    throw new NotImplementedException("Video background file not found: Doesn't know what to do.");
                }

                var brush = new System.Windows.Media.VisualBrush(videoBackground);
                videoBackgroundClone      = new System.Windows.Shapes.Rectangle();
                videoBackgroundClone.Fill = brush;

                this.Control.ForegroundGrid.Children.Add(videoBackground);
                this.Control.BackgroundGrid.Children.Add(videoBackgroundClone);
            }

            this.Control.Web.IsTransparent   = true;
            this.Control.Web.ProcessCreated += Web_ProcessCreated;
            currentSlideIndex = -1;
        }
예제 #26
0
 private Geometry3D CreateGeometry(Visual visual)
 {
     GeometryModel3D model3d = (InternalResources["ElementModel"] as GeometryModel3D).Clone();
     VisualBrush brush = new VisualBrush(visual);
     (model3d.Material as DiffuseMaterial).Brush = brush;
     (model3d.Geometry as MeshGeometry3D).Positions = CreateMeshPositions();
     return model3d.Geometry;
 }
예제 #27
0
        public DragAdornerGroup(UIElement adornedElement, Point offset)
            : base(adornedElement)
        {
            _offset = offset;
            _vbrush = new VisualBrush(adornedElement);

            IsHitTestVisible = false;
        }
예제 #28
0
        protected override void OnRender(DrawingContext drawingContext)
        {
            //base.OnRender(drawingContext);

            //drawingContext.DrawRectangle(Brushes.Red, null, new Rect(10, 10, 100, 100));

            var vb = new VisualBrush(new UserControl1());
            drawingContext.DrawRectangle(vb, null, new Rect(15, 15, 100, 100));
        }
        public ScreenSaverWindow(VisualBrush brush)
        {
            InitializeComponent();

            //load settings
            brush.Stretch = App.Config.Stretch;
            this.VideoBlock.Fill = brush;
            VideoBlock.Visibility = System.Windows.Visibility.Visible;
        }
예제 #30
0
        /// <summary>
        /// Load event
        /// </summary>
        /// <param name="sender">The control sender of the change</param>
        /// <param name="e">the parameters for the RoutedEvent</param>
        static void Win7ColorHotTrackExtenssion_Loaded(object sender, RoutedEventArgs e)
        {
            // As stated before, it will not work if the element is not a content control so an exception is thrown
            if (!(sender is ContentControl))
                throw new NotSupportedException("This attached property is just supported by an ContentControl");

            var control = (ContentControl)sender;

            // verify if any data is binded to the Tag property, because if it is, we dont want to lose it
            if (control.GetValue(FrameworkElement.TagProperty) == null)
            {
                // Instantiate and Invalidate the VisualBrush needed for the analisys of the content
                VisualBrush b = new VisualBrush();

                b.SetValue(VisualBrush.VisualProperty, ((StackPanel)control.Content).Children[0]);
                control.InvalidateVisual();

                // if the control has no visual (with a height lesser or equal to zero) 
                // we dont need to perform any action, couse the result will be a transparent brush anyway
                if ((control as FrameworkElement).ActualHeight <= 0)
                    return;

                // Render the visual of the element to an bitmap with the RenderTargetBitmap class
                RenderTargetBitmap RenderBmp = null;
                try
                {
                    RenderBmp = new RenderTargetBitmap(
                        (int)(((StackPanel)control.Content).Children[0] as FrameworkElement).Width,
                        (int)(((StackPanel)control.Content).Children[0] as FrameworkElement).Height,
                        96,
                        96,
                        PixelFormats.Pbgra32);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }

                RenderBmp.Render(b.Visual);

                // Set the value to the Tag property
                control.SetValue(FrameworkElement.TagProperty, RenderBmp);

                control.Background = Brushes.LightBlue;
                // Instanciate and initialize a Binding element to handle the new tag property
                Binding bindBG = new Binding("Tag");
                bindBG.Source = control;
                // Define the converter that will be used to handle the transformation from an image to average color
                bindBG.Converter = new IconToAvgColorBrushConverter();

                // Set the binding to the Background property
                control.SetBinding(ContentControl.BackgroundProperty, bindBG);
                control.SetValue(ContentControl.BorderBrushProperty, new SolidColorBrush(Colors.White));

            }
        }
예제 #31
0
        protected override void BeginTransition3D(TransitionElement transitionElement, ContentPresenter oldContent, ContentPresenter newContent, Viewport3D viewport)
        {
            Size size = transitionElement.RenderSize;

            // Create a rectangle
            MeshGeometry3D mesh = CreateMesh(new Point3D(),
                new Vector3D(size.Width, 0, 0),
                new Vector3D(0, size.Height, 0),
                1,
                1,
                new Rect(0, 0, 1, 1));
            
            GeometryModel3D geometry = new GeometryModel3D();
            geometry.Geometry = mesh;
            VisualBrush clone = new VisualBrush(oldContent);
            geometry.Material = new DiffuseMaterial(clone);

            ModelVisual3D model = new ModelVisual3D();
            model.Content = geometry;

            // Replace old content in visual tree with new 3d model
            transitionElement.HideContent(oldContent);
            viewport.Children.Add(model);

            Vector3D axis;
            Point3D center = new Point3D();
            switch (Direction)
            {
                case RotateDirection.Left:
                    axis = new Vector3D(0, 1, 0);
                    break;
                case RotateDirection.Right:
                    axis = new Vector3D(0, -1, 0);
                    center = new Point3D(size.Width, 0, 0);
                    break;
                case RotateDirection.Up:
                    axis = new Vector3D(-1, 0, 0);
                    break;
                default:
                    axis = new Vector3D(1, 0, 0);
                    center = new Point3D(0, size.Height, 0);
                    break;
            }
            AxisAngleRotation3D rotation = new AxisAngleRotation3D(axis, 0);
            model.Transform = new RotateTransform3D(rotation, center);

            DoubleAnimation da = new DoubleAnimation(0, Duration);
            clone.BeginAnimation(Brush.OpacityProperty, da);

            da = new DoubleAnimation(90, Duration);
            da.Completed += delegate
            {
                EndTransition(transitionElement, oldContent, newContent);
            };
            rotation.BeginAnimation(AxisAngleRotation3D.AngleProperty, da);
        }
예제 #32
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.ucMain = ((WpfEToolkits.ShapeDrawings.ShapeDrawing)(target));

            #line 5 "..\..\..\mycontrol\ShapeDrawing.xaml"
                this.ucMain.Loaded += new System.Windows.RoutedEventHandler(this.ucMain_Loaded);

            #line default
            #line hidden
                return;

            case 2:
                this.DesignerPane = ((System.Windows.Controls.Canvas)(target));
                return;

            case 3:
                this.canvasText = ((System.Windows.Controls.Canvas)(target));
                return;

            case 4:
                this.LogoBrush = ((System.Windows.Media.VisualBrush)(target));
                return;

            case 5:
                this.geoText = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 6:
                this.GridBrush = ((System.Windows.Media.DrawingBrush)(target));
                return;

            case 7:
                this.DrawingPane = ((System.Windows.Controls.Canvas)(target));
                return;

            case 8:
                this.XAMLPane = ((System.Windows.Controls.DockPanel)(target));
                return;

            case 9:
                this.tbTemp = ((System.Windows.Controls.TextBlock)(target));
                return;
            }
            this._contentLoaded = true;
        }
예제 #33
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.LayoutRoot = ((System.Windows.Controls.Grid)(target));
                return;

            case 2:
                this.verticalLines = ((System.Windows.Media.VisualBrush)(target));
                return;

            case 3:
                this.horizontalLines = ((System.Windows.Media.VisualBrush)(target));
                return;
            }
            this._contentLoaded = true;
        }
예제 #34
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.backgroundAnimationsBeginStoryboard = ((System.Windows.Media.Animation.BeginStoryboard)(target));
                return;

            case 2:
                this.mainPanel = ((System.Windows.Controls.Grid)(target));
                return;

            case 3:
                this.rootLayout = ((System.Windows.Controls.Grid)(target));

            #line 76 "..\..\MainWindow.xaml"
                this.rootLayout.PreviewMouseMove += new System.Windows.Input.MouseEventHandler(this.rootLayout_PreviewMouseMove);

            #line default
            #line hidden
                return;

            case 4:
                this.magnifierCanvas = ((System.Windows.Controls.Canvas)(target));
                return;

            case 5:
                this.magnifierEllipse = ((System.Windows.Shapes.Ellipse)(target));
                return;

            case 6:
                this.vb = ((System.Windows.Media.VisualBrush)(target));
                return;
            }
            this._contentLoaded = true;
        }
예제 #35
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 9 "..\..\MainWindow.xaml"
                ((PlotDataExtraction_GUI_Csharp.MainWindow)(target)).SizeChanged += new System.Windows.SizeChangedEventHandler(this.ResizeImage);

            #line default
            #line hidden
                return;

            case 2:

            #line 26 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.LaunchSnipTool);

            #line default
            #line hidden
                return;

            case 3:
                this.dataGrid1 = ((System.Windows.Controls.DataGrid)(target));
                return;

            case 4:
                this.Canvas1 = ((System.Windows.Controls.Canvas)(target));

            #line 40 "..\..\MainWindow.xaml"
                this.Canvas1.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.ClickityClick);

            #line default
            #line hidden
                return;

            case 5:
                this.ImgCanvas = ((System.Windows.Controls.Image)(target));

            #line 41 "..\..\MainWindow.xaml"
                this.ImgCanvas.MouseMove += new System.Windows.Input.MouseEventHandler(this.Canvas_MouseMove);

            #line default
            #line hidden
                return;

            case 6:
                this.PlotType_x = ((System.Windows.Controls.CheckBox)(target));

            #line 46 "..\..\MainWindow.xaml"
                this.PlotType_x.Checked += new System.Windows.RoutedEventHandler(this.x_log_check);

            #line default
            #line hidden

            #line 46 "..\..\MainWindow.xaml"
                this.PlotType_x.Unchecked += new System.Windows.RoutedEventHandler(this.x_log_uncheck);

            #line default
            #line hidden
                return;

            case 7:
                this.PlotType_y = ((System.Windows.Controls.CheckBox)(target));

            #line 47 "..\..\MainWindow.xaml"
                this.PlotType_y.Checked += new System.Windows.RoutedEventHandler(this.y_log_check);

            #line default
            #line hidden

            #line 47 "..\..\MainWindow.xaml"
                this.PlotType_y.Unchecked += new System.Windows.RoutedEventHandler(this.y_log_uncheck);

            #line default
            #line hidden
                return;

            case 8:
                this.imgCanvasMagnifier = ((System.Windows.Controls.Canvas)(target));
                return;

            case 9:
                this.MagnifierRectangle = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 10:
                this.MagnifierBrush = ((System.Windows.Media.VisualBrush)(target));
                return;

            case 11:
                this.textBblock_x1 = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 12:
                this.textBlock_x2 = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 13:
                this.textBlock_y1 = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 14:
                this.textBlock_y2 = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 15:
                this.textBox_x1 = ((System.Windows.Controls.TextBox)(target));

            #line 83 "..\..\MainWindow.xaml"
                this.textBox_x1.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.textBoxx1_TextChanged);

            #line default
            #line hidden
                return;

            case 16:
                this.textBox_x2 = ((System.Windows.Controls.TextBox)(target));

            #line 84 "..\..\MainWindow.xaml"
                this.textBox_x2.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.textBoxx2_TextChanged);

            #line default
            #line hidden
                return;

            case 17:
                this.textBox_y1 = ((System.Windows.Controls.TextBox)(target));

            #line 85 "..\..\MainWindow.xaml"
                this.textBox_y1.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.textBoxy1_TextChanged);

            #line default
            #line hidden
                return;

            case 18:
                this.textBox_y2 = ((System.Windows.Controls.TextBox)(target));

            #line 86 "..\..\MainWindow.xaml"
                this.textBox_y2.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.textBoxy2_TextChanged);

            #line default
            #line hidden
                return;

            case 19:
                this.textBlock_selectpoints = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 20:
                this.RadioButtons = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 21:
                this.radioButtonx1 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 22:
                this.radioButtonx2 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 23:
                this.radioButtony1 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 24:
                this.radioButtony2 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 25:
                this.rb_pickpoints = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 26:
                this.optionsExpander = ((System.Windows.Controls.Expander)(target));
                return;

            case 27:
                this.button_clearPoints = ((System.Windows.Controls.Button)(target));

            #line 106 "..\..\MainWindow.xaml"
                this.button_clearPoints.Click += new System.Windows.RoutedEventHandler(this.clearPoints);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
예제 #36
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.ScrollImageViewer = ((System.Windows.Controls.ScrollViewer)(target));

            #line 18 "..\..\..\ImageViewer\ImageViewer.xaml"
                this.ScrollImageViewer.PreviewKeyDown += new System.Windows.Input.KeyEventHandler(this.ScrollImageViewer_PreviewKeyDown);

            #line default
            #line hidden
                return;

            case 2:
                this.gridViewer = ((System.Windows.Controls.Grid)(target));
                return;

            case 3:
                this.gridContainer = ((System.Windows.Controls.Grid)(target));

            #line 22 "..\..\..\ImageViewer\ImageViewer.xaml"
                this.gridContainer.PreviewMouseMove += new System.Windows.Input.MouseEventHandler(this.OnPreviewMouseMove);

            #line default
            #line hidden
                return;

            case 4:
                this.imageCanvas = ((VirtualCanvasLib.VirtualCanvas)(target));
                return;

            case 5:
                this.annotationCanvas = ((DrawToolsLib.DrawingCanvas)(target));
                return;

            case 6:
                this.magnifierCanvas = ((System.Windows.Controls.Canvas)(target));
                return;

            case 7:
                this.magnifierEllipse = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 8:
                this.vbMagnifier = ((System.Windows.Media.VisualBrush)(target));
                return;

            case 9:
                this.labelImageCanvas = ((System.Windows.Controls.Canvas)(target));
                return;

            case 10:
                this.zoombarCanvas = ((System.Windows.Controls.Canvas)(target));
                return;

            case 11:
                this.btnZoomFit = ((System.Windows.Controls.Button)(target));

            #line 61 "..\..\..\ImageViewer\ImageViewer.xaml"
                this.btnZoomFit.Click += new System.Windows.RoutedEventHandler(this.btnZoomFit_Click);

            #line default
            #line hidden
                return;

            case 12:
                this.btnZoom1x = ((System.Windows.Controls.Button)(target));

            #line 66 "..\..\..\ImageViewer\ImageViewer.xaml"
                this.btnZoom1x.Click += new System.Windows.RoutedEventHandler(this.btnZoom1x_Click);

            #line default
            #line hidden
                return;

            case 13:
                this.btnZoom2x = ((System.Windows.Controls.Button)(target));

            #line 71 "..\..\..\ImageViewer\ImageViewer.xaml"
                this.btnZoom2x.Click += new System.Windows.RoutedEventHandler(this.btnZoom2x_Click);

            #line default
            #line hidden
                return;

            case 14:
                this.btnZoom4x = ((System.Windows.Controls.Button)(target));

            #line 76 "..\..\..\ImageViewer\ImageViewer.xaml"
                this.btnZoom4x.Click += new System.Windows.RoutedEventHandler(this.btnZoom4x_Click);

            #line default
            #line hidden
                return;

            case 15:
                this.btnZoom5x = ((System.Windows.Controls.Button)(target));

            #line 81 "..\..\..\ImageViewer\ImageViewer.xaml"
                this.btnZoom5x.Click += new System.Windows.RoutedEventHandler(this.btnZoom5x_Click);

            #line default
            #line hidden
                return;

            case 16:
                this.btnZoom10x = ((System.Windows.Controls.Button)(target));

            #line 86 "..\..\..\ImageViewer\ImageViewer.xaml"
                this.btnZoom10x.Click += new System.Windows.RoutedEventHandler(this.btnZoom10x_Click);

            #line default
            #line hidden
                return;

            case 17:
                this.btnZoom20x = ((System.Windows.Controls.Button)(target));

            #line 91 "..\..\..\ImageViewer\ImageViewer.xaml"
                this.btnZoom20x.Click += new System.Windows.RoutedEventHandler(this.btnZoom20x_Click);

            #line default
            #line hidden
                return;

            case 18:
                this.zoomSlider = ((System.Windows.Controls.Slider)(target));

            #line 98 "..\..\..\ImageViewer\ImageViewer.xaml"
                this.zoomSlider.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.zoomSlider_MouseLeftButtonDown);

            #line default
            #line hidden
                return;

            case 19:
                this.lbZoom = ((System.Windows.Controls.Label)(target));
                return;

            case 20:
                this.thumbnailCanvas = ((System.Windows.Controls.Canvas)(target));

            #line 106 "..\..\..\ImageViewer\ImageViewer.xaml"
                this.thumbnailCanvas.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.thumbnailCanvas_MouseLeftButtonDown);

            #line default
            #line hidden
                return;

            case 21:
                this.thumbnailBorder = ((System.Windows.Controls.Border)(target));
                return;

            case 22:
                this.thumbnailZoomRectThumb = ((System.Windows.Controls.Primitives.Thumb)(target));

            #line 110 "..\..\..\ImageViewer\ImageViewer.xaml"
                this.thumbnailZoomRectThumb.DragDelta += new System.Windows.Controls.Primitives.DragDeltaEventHandler(this.thumbnailZoomRectThumb_DragDelta);

            #line default
            #line hidden
                return;

            case 23:
                this.ThumbnailImage_Brush = ((System.Windows.Media.ImageBrush)(target));
                return;
            }
            this._contentLoaded = true;
        }
예제 #37
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.desktopGrid = ((System.Windows.Controls.Grid)(target));

            #line 10 "..\..\..\..\..\..\..\..\NerdSharp_UberNet\Science\Comp_Sci\StudioComponents\SideComponents\Desktop.xaml"
                this.desktopGrid.SizeChanged += new System.Windows.SizeChangedEventHandler(this.desktopGrid_SizeChanged);

            #line default
            #line hidden
                return;

            case 2:
                this.leftWallPolyGon = ((System.Windows.Shapes.Polygon)(target));
                return;

            case 3:
                this.leftWallBgGrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 4:
                this.leftWallBgImg = ((System.Windows.Controls.Image)(target));
                return;

            case 5:
                this.floorPolygon = ((System.Windows.Shapes.Polygon)(target));

            #line 33 "..\..\..\..\..\..\..\..\NerdSharp_UberNet\Science\Comp_Sci\StudioComponents\SideComponents\Desktop.xaml"
                this.floorPolygon.Loaded += new System.Windows.RoutedEventHandler(this.floorPolygon_Loaded);

            #line default
            #line hidden
                return;

            case 6:
                this.changeImageMenuItemLable = ((System.Windows.Controls.Label)(target));

            #line 38 "..\..\..\..\..\..\..\..\NerdSharp_UberNet\Science\Comp_Sci\StudioComponents\SideComponents\Desktop.xaml"
                this.changeImageMenuItemLable.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.changeImageMenuItemLable_MouseDown);

            #line default
            #line hidden
                return;

            case 7:
                this.tilePictureCmBxItem = ((System.Windows.Controls.ComboBoxItem)(target));

            #line 43 "..\..\..\..\..\..\..\..\NerdSharp_UberNet\Science\Comp_Sci\StudioComponents\SideComponents\Desktop.xaml"
                this.tilePictureCmBxItem.Selected += new System.Windows.RoutedEventHandler(this.tilePictureCmBxItem_Selected);

            #line default
            #line hidden
                return;

            case 8:
                this.tileTextBlock = ((System.Windows.Controls.Label)(target));

            #line 44 "..\..\..\..\..\..\..\..\NerdSharp_UberNet\Science\Comp_Sci\StudioComponents\SideComponents\Desktop.xaml"
                this.tileTextBlock.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.tileTextBlock_MouseLeftButtonDown);

            #line default
            #line hidden
                return;

            case 9:
                this.floorBgVisBrush = ((System.Windows.Media.VisualBrush)(target));
                return;

            case 10:
                this.floorBgGrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 11:
                this.bgImg = ((System.Windows.Controls.Image)(target));
                return;

            case 12:
                this.browser = ((System.Windows.Controls.Button)(target));

            #line 65 "..\..\..\..\..\..\..\..\NerdSharp_UberNet\Science\Comp_Sci\StudioComponents\SideComponents\Desktop.xaml"
                this.browser.Click += new System.Windows.RoutedEventHandler(this.browser_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
예제 #38
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.gridLayout = ((System.Windows.Controls.Grid)(target));
                return;

            case 2:
                this.canvasMain = ((System.Windows.Controls.Canvas)(target));
                return;

            case 3:
                this.inkCanvas = ((System.Windows.Controls.InkCanvas)(target));

            #line 40 "..\..\..\..\Views\Controls\ClipWindow.xaml"
                this.inkCanvas.StrokeCollected += new System.Windows.Controls.InkCanvasStrokeCollectedEventHandler(this.inkCanvas_StrokeCollected);

            #line default
            #line hidden
                return;

            case 4:
                this.rect = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 5:
                this.cbGeo = ((System.Windows.Media.CombinedGeometry)(target));
                return;

            case 6:
                this.rectFull = ((System.Windows.Media.RectangleGeometry)(target));
                return;

            case 7:
                this.rectClip = ((System.Windows.Media.RectangleGeometry)(target));
                return;

            case 8:
                this.bdThumb = ((System.Windows.Controls.Border)(target));
                return;

            case 9:
                this.gridmagnifier = ((System.Windows.Controls.Grid)(target));
                return;

            case 10:
                this.magnifierRectangle = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 11:
                this.visualBrush = ((System.Windows.Media.VisualBrush)(target));
                return;

            case 12:
                this.tbUnSelection = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 13:
                this.runSize0 = ((System.Windows.Documents.Run)(target));
                return;

            case 14:
                this.tbSelection = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 15:
                this.runSize = ((System.Windows.Documents.Run)(target));
                return;

            case 16:
                this.stkpMenu = ((System.Windows.Controls.StackPanel)(target));

            #line 100 "..\..\..\..\Views\Controls\ClipWindow.xaml"
                this.stkpMenu.AddHandler(System.Windows.Controls.Primitives.ButtonBase.ClickEvent, new System.Windows.RoutedEventHandler(this.stkpMenu_Click));

            #line default
            #line hidden
                return;

            case 17:
                this.tbtnPen = ((System.Windows.Controls.Primitives.ToggleButton)(target));
                return;

            case 18:
                this.rbtnBackout = ((System.Windows.Controls.Primitives.RepeatButton)(target));
                return;

            case 19:
                this.listSizes = ((System.Windows.Controls.ListBox)(target));

            #line 143 "..\..\..\..\Views\Controls\ClipWindow.xaml"
                this.listSizes.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.listSizes_SelectionChanged);

            #line default
            #line hidden
                return;

            case 20:
                this.listColors = ((System.Windows.Controls.ListBox)(target));

            #line 172 "..\..\..\..\Views\Controls\ClipWindow.xaml"
                this.listColors.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.listColors_SelectionChanged);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
예제 #39
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.MainWindow1 = ((CellularAutomaton.MainWindow)(target));
                return;

            case 2:
                this.VisibleGrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 3:

            #line 16 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ButtonBase_OnClick);

            #line default
            #line hidden
                return;

            case 4:
                this.DeadButton = ((System.Windows.Controls.Button)(target));

            #line 17 "..\..\MainWindow.xaml"
                this.DeadButton.Click += new System.Windows.RoutedEventHandler(this.DeadButton_OnClick);

            #line default
            #line hidden
                return;

            case 5:
                this.AliveButton = ((System.Windows.Controls.Button)(target));

            #line 18 "..\..\MainWindow.xaml"
                this.AliveButton.Click += new System.Windows.RoutedEventHandler(this.AliveButton_OnClick);

            #line default
            #line hidden
                return;

            case 6:
                this.EmptyButton = ((System.Windows.Controls.Button)(target));

            #line 19 "..\..\MainWindow.xaml"
                this.EmptyButton.Click += new System.Windows.RoutedEventHandler(this.EmptyButton_OnClick);

            #line default
            #line hidden
                return;

            case 7:
                this.ResetButton = ((System.Windows.Controls.Button)(target));

            #line 20 "..\..\MainWindow.xaml"
                this.ResetButton.Click += new System.Windows.RoutedEventHandler(this.ResetButton_OnClick);

            #line default
            #line hidden
                return;

            case 8:
                this.Start = ((System.Windows.Controls.Button)(target));

            #line 21 "..\..\MainWindow.xaml"
                this.Start.Click += new System.Windows.RoutedEventHandler(this.Start_OnClick);

            #line default
            #line hidden
                return;

            case 9:
                this.Pause = ((System.Windows.Controls.Button)(target));

            #line 22 "..\..\MainWindow.xaml"
                this.Pause.Click += new System.Windows.RoutedEventHandler(this.Pause_OnClick);

            #line default
            #line hidden
                return;

            case 10:
                this.MainCanvas = ((System.Windows.Controls.Canvas)(target));

            #line 35 "..\..\MainWindow.xaml"
                this.MainCanvas.MouseMove += new System.Windows.Input.MouseEventHandler(this.MainCanvas_OnMouseMove);

            #line default
            #line hidden

            #line 35 "..\..\MainWindow.xaml"
                this.MainCanvas.MouseWheel += new System.Windows.Input.MouseWheelEventHandler(this.Canvas_MouseWheel);

            #line default
            #line hidden

            #line 35 "..\..\MainWindow.xaml"
                this.MainCanvas.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.MainWindow1_MouseDown);

            #line default
            #line hidden
                return;

            case 11:
                this.VisualBrush = ((System.Windows.Media.VisualBrush)(target));
                return;

            case 12:
                this.st = ((System.Windows.Media.ScaleTransform)(target));
                return;

            case 13:
                this.TranslateTransform = ((System.Windows.Media.TranslateTransform)(target));
                return;
            }
            this._contentLoaded = true;
        }
예제 #40
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.winPolygonEditor = ((PolygonEditor.MainWindow)(target));
                return;

            case 2:

            #line 29 "..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.CommandBinding_Executed_Properties);

            #line default
            #line hidden
                return;

            case 3:

            #line 30 "..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.CommandBinding_Executed_Print);

            #line default
            #line hidden

            #line 30 "..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CommandBinding_CanExecute);

            #line default
            #line hidden
                return;

            case 4:

            #line 31 "..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.CommandBinding_Executed_SelectAll);

            #line default
            #line hidden

            #line 31 "..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CommandBinding_CanExecute_SelectAll);

            #line default
            #line hidden
                return;

            case 5:

            #line 32 "..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.CommandBinding_Executed_Help);

            #line default
            #line hidden
                return;

            case 6:
                this._EditorGrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 7:
                this.FILE = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 8:
                this.LOAD = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 9:
                this.LoadFormFile = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 10:
                this.LoadFormDataBase = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 11:

            #line 63 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.MenuItem_Exit_Click);

            #line default
            #line hidden
                return;

            case 12:

            #line 77 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.MenuItem_Unselect_Click);

            #line default
            #line hidden
                return;

            case 13:

            #line 79 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_CanvasClearing_Click);

            #line default
            #line hidden
                return;

            case 14:

            #line 89 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.MenuItem_About_Click);

            #line default
            #line hidden
                return;

            case 15:
                this.ToolBar_DrawProperty = ((System.Windows.Controls.ToolBar)(target));
                return;

            case 16:
                this.RButton_drawPoint = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 17:
                this.RButton_drawLine = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 18:
                this.RButton_drawPolyLine = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 19:
                this.RButton_drawPolygon = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 20:
                this.Selector_ShapeStrokeWeight = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 21:
                this.Selector_ShapeStrokeColor = ((Xceed.Wpf.Toolkit.ColorPicker)(target));
                return;

            case 22:
                this.TextBlock_FillColor = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 23:
                this.Selector_ShapeFillColor = ((Xceed.Wpf.Toolkit.ColorPicker)(target));
                return;

            case 24:
                this.ToolBar_PolygonOperations = ((System.Windows.Controls.ToolBar)(target));
                return;

            case 25:
                this.Selector_OperationType = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 26:
                this.Button_RunOperation = ((System.Windows.Controls.Button)(target));
                return;

            case 27:
                this.Button_DeleteResults = ((System.Windows.Controls.Button)(target));
                return;

            case 28:
                this.ToggleButton_SetClippers = ((System.Windows.Controls.Primitives.ToggleButton)(target));
                return;

            case 29:
                this.Button_UndoClippers = ((System.Windows.Controls.Button)(target));
                return;

            case 30:
                this.CheckBox_ShowSubjects = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 31:
                this.CheckBox_ShowClippers = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 32:
                this.CheckBox_ShowResults = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 33:
                this.ToolBar_EditorMode = ((System.Windows.Controls.ToolBar)(target));
                return;

            case 34:
                this.Button_SaveSelectedShapes = ((System.Windows.Controls.Button)(target));
                return;

            case 35:
                this.Button_SaveAll = ((System.Windows.Controls.Button)(target));
                return;

            case 36:
                this.Button_Print = ((System.Windows.Controls.Button)(target));
                return;

            case 37:
                this.Button_Load = ((System.Windows.Controls.Button)(target));
                return;

            case 38:
                this.RButton_modeDrawNew = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 39:
                this.RButton_modeEdit = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 40:
                this.RButton_modeSelection = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 41:
                this.RButton_modePolygonOperations = ((System.Windows.Controls.RadioButton)(target));

            #line 271 "..\..\MainWindow.xaml"
                this.RButton_modePolygonOperations.Unchecked += new System.Windows.RoutedEventHandler(this.RButton_modePolygonOperations_Unchecked);

            #line default
            #line hidden
                return;

            case 42:
                this.Button_DeleteSelectedShapes = ((System.Windows.Controls.Button)(target));

            #line 277 "..\..\MainWindow.xaml"
                this.Button_DeleteSelectedShapes.Click += new System.Windows.RoutedEventHandler(this.Button_DeleteSelectedShapes_Click);

            #line default
            #line hidden
                return;

            case 43:
                this.Button_CanvasClearing = ((System.Windows.Controls.Button)(target));

            #line 281 "..\..\MainWindow.xaml"
                this.Button_CanvasClearing.Click += new System.Windows.RoutedEventHandler(this.Button_CanvasClearing_Click);

            #line default
            #line hidden
                return;

            case 44:
                this.ParametersPanel = ((System.Windows.Controls.Grid)(target));
                return;

            case 45:
                this.PointPanel = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 46:
                this.PointCoords = ((System.Windows.Controls.TextBox)(target));
                return;

            case 47:

            #line 310 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ActionForFields);

            #line default
            #line hidden
                return;

            case 48:

            #line 314 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ActionForFields);

            #line default
            #line hidden
                return;

            case 49:
                this.LinePanel = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 50:
                this.FirstPoint = ((System.Windows.Controls.TextBox)(target));
                return;

            case 51:
                this.SecondPoint = ((System.Windows.Controls.TextBox)(target));
                return;

            case 52:

            #line 330 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ActionForFields);

            #line default
            #line hidden
                return;

            case 53:

            #line 334 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ActionForFields);

            #line default
            #line hidden
                return;

            case 54:
                this.PolyLinePanel = ((System.Windows.Controls.Canvas)(target));
                return;

            case 55:
                this.LPoint_1 = ((System.Windows.Controls.TextBox)(target));
                return;

            case 56:
                this.LPoint_2 = ((System.Windows.Controls.TextBox)(target));
                return;

            case 57:
                this.LPoint_3 = ((System.Windows.Controls.TextBox)(target));
                return;

            case 58:

            #line 352 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.DeleleField);

            #line default
            #line hidden
                return;

            case 59:

            #line 356 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.AddField);

            #line default
            #line hidden
                return;

            case 60:

            #line 361 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ActionForFields);

            #line default
            #line hidden
                return;

            case 61:

            #line 365 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ActionForFields);

            #line default
            #line hidden
                return;

            case 62:
                this.PolygonPanel = ((System.Windows.Controls.Canvas)(target));
                return;

            case 63:
                this.PPoint_1 = ((System.Windows.Controls.TextBox)(target));
                return;

            case 64:
                this.PPoint_2 = ((System.Windows.Controls.TextBox)(target));
                return;

            case 65:
                this.PPoint_3 = ((System.Windows.Controls.TextBox)(target));
                return;

            case 66:

            #line 385 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.DeleleField);

            #line default
            #line hidden
                return;

            case 67:

            #line 396 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.AddField);

            #line default
            #line hidden
                return;

            case 68:

            #line 408 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ActionForFields);

            #line default
            #line hidden
                return;

            case 69:

            #line 412 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ActionForFields);

            #line default
            #line hidden
                return;

            case 70:
                this.EditorPane = ((System.Windows.Controls.Canvas)(target));

            #line 433 "..\..\MainWindow.xaml"
                this.EditorPane.MouseMove += new System.Windows.Input.MouseEventHandler(this.EditorPane_MouseMove);

            #line default
            #line hidden

            #line 434 "..\..\MainWindow.xaml"
                this.EditorPane.MouseEnter += new System.Windows.Input.MouseEventHandler(this.EditorPane_MouseEnter);

            #line default
            #line hidden

            #line 435 "..\..\MainWindow.xaml"
                this.EditorPane.MouseLeave += new System.Windows.Input.MouseEventHandler(this.EditorPane_MouseLeave);

            #line default
            #line hidden

            #line 436 "..\..\MainWindow.xaml"
                this.EditorPane.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.EditorPane_MouseLeftButtonDown);

            #line default
            #line hidden

            #line 437 "..\..\MainWindow.xaml"
                this.EditorPane.MouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(this.EditorPane_MouseLeftButtonUp);

            #line default
            #line hidden
                return;

            case 71:
                this.BackgroundPane = ((System.Windows.Controls.Canvas)(target));
                return;

            case 72:
                this.LogoBrush = ((System.Windows.Media.VisualBrush)(target));
                return;

            case 73:
                this.geoText = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 74:
                this.RectBrush = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 75:
                this.GridBrush = ((System.Windows.Media.DrawingBrush)(target));
                return;

            case 76:
                this.DrawingPane = ((System.Windows.Controls.Canvas)(target));
                return;

            case 77:
                this.ControlPane = ((System.Windows.Controls.Canvas)(target));
                return;

            case 78:
                this.Prompt = ((System.Windows.Controls.Label)(target));
                return;
            }
            this._contentLoaded = true;
        }