/// <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; }
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); } }
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; } }