Ejemplo n.º 1
0
        public dynConnectorViewModel(dynConnectorModel model)
        {
            //var bc = new BrushConverter();
            //StrokeBrush = (Brush)bc.ConvertFrom("#777");
            const string colour = "#777";
            Color        c      = Color.FromArgb(
                Convert.ToByte(colour.Substring(1, 1), 16),
                Convert.ToByte(colour.Substring(2, 1), 16),
                Convert.ToByte(colour.Substring(3, 1), 16));

            StrokeBrush = new SolidBrush(c);

            _model = model;

            _model.Start.PropertyChanged       += Start_PropertyChanged;
            _model.End.PropertyChanged         += End_PropertyChanged;
            _model.PropertyChanged             += Model_PropertyChanged;
            _model.Start.Owner.PropertyChanged += StartOwner_PropertyChanged;
            _model.End.Owner.PropertyChanged   += EndOwner_PropertyChanged;

            dynSettings.Controller.DynamoViewModel.PropertyChanged += DynamoViewModel_PropertyChanged;

            //make sure we have valid curve points
            Redraw();
        }
Ejemplo n.º 2
0
        private void Connect(object parameters)
        {
            //make the connector model
            var end = parameters as dynPortModel;

            _model = dynConnectorModel.Make(_activeStartPort.Owner, end.Owner, _activeStartPort.Index, end.Index, 0);
            if (_model == null)
            {
                return;
            }

            _model.Connected += ModelConnected;

            _model.Start.PropertyChanged += Start_PropertyChanged;
            _model.End.PropertyChanged   += End_PropertyChanged;
            dynSettings.Controller.DynamoViewModel.Model.PropertyChanged += Model_PropertyChanged;
            dynSettings.Controller.DynamoViewModel.PropertyChanged       += DynamoViewModel_PropertyChanged;
            IsHitTestVisible = false;
        }