Exemplo n.º 1
0
        public ViewModel(DataModel d, Canvas c)
        {
            DataModel = d;
            Canvas = c;
            d.RecalcNeeded += RecalcNeeded;

            //
            // todo stub - Populate the view model with some example data.
            //
            var r1 = new ConeViewModel(10, 10, 40, 40, Colors.Blue);
            _cones.Add(r1);
            var r2 = new ConeViewModel(70, 70, 40, 40, Colors.Green);
            _cones.Add(r2);
            var r3 = new ConeViewModel(130, 130, 40, 40, Colors.Purple);
            _cones.Add(r3);

            //
            // Add some connections between cones.
            //
            _connections.Add(new ConnectionViewModel(r1, r2));
            _connections.Add(new ConnectionViewModel(r2, r3));

            ImageBrush = new ImageBrush(new BitmapImage(new Uri(d.ImageFileName)));
        }
Exemplo n.º 2
0
 private void New_Click(object sender, RoutedEventArgs e)
 {
     DataModel = new DataModel();
     canvas1.Background = null;
 }