public MainWindow() { InitializeComponent(); var imageSource = new BitmapImage(new Uri(picPath, UriKind.RelativeOrAbsolute)); canvas.MinHeight = canvas.MaxHeight = imageSource.Height; canvas.MinWidth = canvas.MaxWidth = imageSource.Width; canvas.Background = new ImageBrush(imageSource); Map map; if (File.Exists(picBin)) { map = Map.LoadFromBin(picBin); Debug.WriteLine("load from bin"); } else { map = Map.LoadFromPic(picPath); //map.Save(picBin); Debug.WriteLine("load from pic"); } navigator = new Navigator(map, DrawObj, DrawPath, ErasePath); end = new Fork(canvas, Brushes.Red); robot = new Robot(canvas); }
public Robot(Canvas canvas) { f = new Fork(canvas, Brushes.Blue); c = new Circle(canvas, Brushes.Aqua, RobotObj.Size); }