示例#1
0
        public GraphViewModel(IInspectorTool inspectorTool)
        {
            DisplayName = "[New Graph]";

            _elements    = new BindableCollection <ElementViewModel>();
            _connections = new BindableCollection <ConnectionViewModel>();

            _inspectorTool = inspectorTool;

            var element1 = AddElement <ImageSource>(100, 50);

            element1.Bitmap = BitmapUtility.CreateFromBytes(DesignTimeImages.Desert);

            var element2 = AddElement <ColorInput>(100, 300);

            element2.Color = Colors.Green;

            var element3 = AddElement <Add>(400, 250);


            Connections.Add(new ConnectionViewModel(
                                element1.OutputConnector,
                                element3.InputConnectors[0]));

            Connections.Add(new ConnectionViewModel(
                                element2.OutputConnector,
                                element3.InputConnectors[1]));

            element1.IsSelected = true;
        }