예제 #1
0
        public IDragController Build()
        {
            var setupArgs = new ConnectionCreateControllerSetupArgs(
                _builder.Nodes,
                _clickedPlugs,
                CreatingConnectionItemsControl,
                _builder.ConnectConnectionCommand,
                _builder.StartConnectionCommand,
                _builder.CancelConnectionCommand,
                _sourcePlugType);

            return(new ConnectionCreateController(setupArgs));
        }
예제 #2
0
        //! コンストラクタ / ドラッグ開始
        public ConnectionCreateController(ConnectionCreateControllerSetupArgs setupArgs)
        {
            _nodes        = setupArgs.Nodes;
            _inputElement = setupArgs.BaseControl;

            _sourcePlugs = setupArgs.SourcePlugs
                           .Select(x => x.DataContext)
                           .OfType <IPlugDataContext>()
                           .ToArray();

            _plugToConnectionDataContexts = _sourcePlugs
                                            .ToDictionary(x => x, x => x.StartConnection());

            _connections = _plugToConnectionDataContexts
                           .Select(x => x.Value)
                           .ToArray();

            _connectionItemsControl = setupArgs.CreatingConnectionItemsControl;
            _connectionCreated      = setupArgs.ConnectionCreated;
            _sourcePlugType         = setupArgs.SourcePlugType;

            setupArgs.StartConnectionCreated?.Execute(new StartCreateConnectionEventArgs(_sourcePlugs));
        }