Ignore:
Timestamp:
Jun 10, 2010, 3:26:32 PM (11 years ago)
Author:
kopal
Message:
  • a delete of a plugin now leads to the delete of all left connections
  • added a first version of a Settings to the WorkspaceManager
  • some small bug fixes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/WorkspaceManager/View/Container/WorkSpaceEditorView.xaml.cs

    r1609 r1617  
    6969        void PluginDelete(object sender, PluginContainerViewDeleteViewEventArgs e)
    7070        {
    71             for(int i = 0; i< e.container.ConnectorViewList.Count; i++)
     71            /*for(int i = 0; i< e.container.ConnectorViewList.Count; i++)
    7272            {
    7373                for(int j = 0; j< e.container.ConnectorViewList[i].Model.OutputConnections.Count; j++)
     
    8282                }
    8383                Model.deleteConnectionModel(e.container.ConnectorViewList[i].Model.InputConnection);
    84             }
     84            }*/
     85            Model.deletePluginModel(e.container.Model);
    8586            root.Children.Remove(e.container);
    8687        }
     
    113114            ConnectionModel connectionModel = this.Model.newConnectionModel(((ConnectorView)source).Model, ((ConnectorView)target).Model, ((ConnectorView)source).Model.ConnectorType);
    114115            CryptoLineView conn = new CryptoLineView(connectionModel);
     116            connectionModel.UpdateableView = conn;
     117            connectionModel.OnDelete += DeleteConnection;
    115118            conn.SetBinding(CryptoLineView.StartPointProperty, CreateConnectorBinding(source));
    116119            conn.SetBinding(CryptoLineView.EndPointProperty, CreateConnectorBinding(target));
     
    120123        }
    121124
     125        public void DeleteConnection(Object sender, EventArgs args)
     126        {
     127            if (sender is ConnectionModel)
     128            {
     129                if (((ConnectionModel)sender).UpdateableView != null)
     130                {
     131                    UIElement uielement = (UIElement)((ConnectionModel)sender).UpdateableView;
     132                    root.Children.Remove(uielement);
     133                }
     134            }
     135        }
     136
    122137        private void AddConnectionSource(IConnectable source, CryptoLineView conn)
    123138        {
     
    226241        {
    227242            DragDropDataObject obj = e.Data.GetData("Cryptool.PluginBase.Editor.DragDropDataObject") as DragDropDataObject;
     243            PluginModel pluginModel = Model.newPluginModel(DragDropDataObjectToPluginConverter.CreatePluginInstance(obj.AssemblyFullName, obj.TypeFullName));
    228244            if(obj != null)
    229                 this.AddPluginContainerView(e.GetPosition(root), Model.newPluginModel(DragDropDataObjectToPluginConverter.CreatePluginInstance(obj.AssemblyFullName, obj.TypeFullName)));
     245                this.AddPluginContainerView(e.GetPosition(root), pluginModel);
    230246        }
    231247
Note: See TracChangeset for help on using the changeset viewer.