Exemplo n.º 1
0
        /// <summary>
        /// Constructs a new model from an specific image source.
        /// </summary>
        /// <param name="uri">The file path to the image to load into the background layer</param>
        public CanvasHostViewModel(Uri uri)
        {
            self      = this;
            animation = Animation.newInstance();

            Cells = new ObservableCollection <Cell>();
            Leds  = new ObservableCollection <Led>();
            //Frames = new ObservableCollection<Frame>();
            TouchRegions = new ObservableCollection <TouchRegion>();

            currentFrame = 0;
            animation.addFrame(new Frame());

            ImageSource = new BitmapImage(uri);
            _image      = new Bitmap(uri.LocalPath);
            Tolerance   = 30;
            _canvasMode = CanvasHostMode.None;
            BoardHeight = 150;
        }
Exemplo n.º 2
0
        public static ICanvasHostCommand Create(CanvasHostViewModel viewModel, CanvasHostMode mode)
        {
            switch (mode)
            {
            case CanvasHostMode.ColorFill:
                return(new FindCellCommand(viewModel));

            case CanvasHostMode.PlaceLED:
                return(new PlaceLedCommand(viewModel));

            case CanvasHostMode.CreateTouchRegion:
                return(new CreateTouchRegionCommand(viewModel));

            case CanvasHostMode.PlaceLEDWithoutCell:
                return(new FindCellCommand(viewModel, System.Drawing.Color.FromArgb(0, 0, 0, 0)));    //Transparent white

            case CanvasHostMode.None:
            default:
                return(null);
            }
        }
Exemplo n.º 3
0
        public static ICanvasHostCommand Create(CanvasHostViewModel viewModel,  CanvasHostMode mode)
        {
            switch (mode)
            {
                case CanvasHostMode.ColorFill:
                    return new FindCellCommand(viewModel);

                case CanvasHostMode.PlaceLED:
                    return new PlaceLedCommand(viewModel);

                case CanvasHostMode.CreateTouchRegion:
                    return new CreateTouchRegionCommand(viewModel);

                case CanvasHostMode.PlaceLEDWithoutCell:
                    return new FindCellCommand(viewModel, System.Drawing.Color.FromArgb(0, 0, 0, 0)); //Transparent white

                case CanvasHostMode.None:
                default:
                    return null;
            }
        }