示例#1
0
        private void MiddleViewLoadButton_Click(object sender, RoutedEventArgs e)
        {
            var         size = VisualTreeHelper.GetContentBounds(LeftViewContainer.Children[0]);
            ImageSource src  = ImageExtensions.BitmapToImageSource(
                ImageExtensions.CanvasToBitmap(LeftViewContainer, true, Convert.ToInt32(size.Width), Convert.ToInt32(size.Height))
                );
            var newtiles = src.MapImageToTiles(Game.Get.TileManager.Tiles);

            #region first moveable test

            /*var image = ImageExtensions.ConstructSensorDataBackground(Tile.GetDebugTiles(2, 8, 8, 8, 4, 4));
             * var img = new CustomImage
             * {
             *  Source = ImageExtensions.BitmapToImageSource(image)
             * };
             * img.SetValue(DraggableExtender.CanDragProperty, true);
             *
             * var secondImage = ImageExtensions.BuildImage(Tile.GetDebugTiles(6, 6, 8, 8, 4, 4));
             * var secondImg = new CustomImage
             * {
             *  Source = ImageExtensions.BitmapToImageSource(secondImage)
             * };
             * secondImg.SetValue(DraggableExtender.CanDragProperty, true);*/
            #endregion

            var imgList = ImageExtensions.GetIndividualSensorVisuals(Game.Get.TileManager.Tiles);
            Main.GetDispatcher.Invoke(PopulateCanvasControlDelegate, MiddleViewContainer, imgList, true);
        }