示例#1
0
        public CryptoLineView(ConnectionModel model, ConnectorVisual source, ConnectorVisual target)
        {
            // TODO: Complete member initialization
            //Add connection to statistics:
            ComponentConnectionStatistics.IncrementConnectionUsage(source.Model.PluginModel.PluginType,
                                                                   source.Model.GetName(),
                                                                   target.Model.PluginModel.PluginType,
                                                                   target.Model.GetName());

            Editor = (EditorVisual)model.WorkspaceModel.MyEditor.Presentation;
            InitializeComponent();
            Canvas.SetZIndex(this, -1);
            this.Model  = model;
            this.Source = source;
            this.Target = target;

            Line = new InternalCryptoLineView(model, source, target, Editor.VisualCollection, Editor.VisualsHelper);
            Line.SetBinding(InternalCryptoLineView.StartPointProperty, WorkspaceManager.View.Base.Util.CreateConnectorBinding(source, this));
            Line.SetBinding(InternalCryptoLineView.EndPointProperty, WorkspaceManager.View.Base.Util.CreateConnectorBinding(target, this));

            Editor.ItemsSelected += new EventHandler <SelectedItemsEventArgs>(itemsSelected);
            Line.ComputationDone += new EventHandler <ComputationDoneEventArgs>(LineComputationDone);
            Source.Update        += new EventHandler(Update);
            Target.Update        += new EventHandler(Update);

            if (model.PointList != null)
            {
                assembleGeo();
            }
        }
        void _editorSelectedConnectorChanged(object sender, EventArgs e)
        {
            if (!Cryptool.PluginBase.Properties.Settings.Default.WorkspaceManager_ShowComponentConnectionProposition)
            {
                return;
            }

            window = Window.GetWindow(_editor);
            if (window != null)
            {
                if (_editor.SelectedConnector == null)
                {
                    return;
                }
                SelectedConnector = this._editor.SelectedConnector;

                Suggestions = new ObservableCollection <SuggestionContainer>();
                var list = ComponentConnectionStatistics.GetMostlyUsedComponentsFromConnector(SelectedConnector.Model.PluginModel.PluginType, SelectedConnector.Model.GetName());

                if (list == null)
                {
                    //we have no connectors accociated with this one. So we show AN EMPTY list...
                    return;
                }
                foreach (var componentConnector in list)
                {
                    Type   t    = componentConnector.Component;
                    string name = componentConnector.ConnectorName;
                    Suggestions.Add(new SuggestionContainer(name, t));
                }
            }
        }
示例#3
0
        private static void AnalyseConnectorUsage(ConnectorModel connectorModel)
        {
            var componentConnector = new ComponentConnectionStatistics.ComponentConnector(connectorModel.PluginModel.PluginType, connectorModel.PropertyName);

            foreach (var otherConnector in AllConnectedConnectors(connectorModel))
            {
                ComponentConnectionStatistics.IncrementConnectionUsage(componentConnector, otherConnector);
            }
        }