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(); } }
public static Point Cheat42(Point EndPoint, ConnectorVisual EndPointSource, int flipper) { double xoffset = 0; double yoffset = 0; switch (EndPointSource.Orientation) { case ConnectorOrientation.East: xoffset = baseoffset; break; case ConnectorOrientation.West: xoffset = -baseoffset; break; case ConnectorOrientation.North: yoffset = -baseoffset; break; case ConnectorOrientation.South: yoffset = baseoffset; break; } //xoffset *= flipper; //yoffset *= flipper; return(new Point(EndPoint.X + xoffset, EndPoint.Y + yoffset)); }
public InternalCryptoLineView(ConnectionModel connectionModel, ConnectorVisual source, ConnectorVisual target, ObservableCollection <UIElement> visuals, VisualsHelper helper) { this.Loaded += new RoutedEventHandler(CryptoLineView_Loaded); this.Model = connectionModel; this.StartPointSource = source; this.EndPointSource = target; this.Visuals = visuals; this.helper = helper; }
void UsageStatisticPopup_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (TopUsages.SelectedItem != null) { try { var x = (SuggestionContainer)TopUsages.SelectedItem; PluginModel pluginModel = (PluginModel)_editor.Model.ModifyModel(new NewPluginModelOperation(position, 0, 0, x.ComponentType)); _editor.AddComponentVisual(pluginModel); ConnectorVisual connector = null; foreach (var con in pluginModel.GetInputConnectors()) { if (con.GetName() == x.ConnectorName) { connector = (ConnectorVisual)con.UpdateableView; } } foreach (var con in pluginModel.GetOutputConnectors()) { if (con.GetName() == x.ConnectorName) { connector = (ConnectorVisual)con.UpdateableView; } } if (connector == null) { throw new Exception(); } var input = SelectedConnector.Model.Outgoing == true ? connector : SelectedConnector; var output = SelectedConnector.Model.Outgoing == false ? connector : SelectedConnector; ConnectionModel connectionModel = (ConnectionModel)_editor.Model.ModifyModel(new NewConnectionModelOperation( output.Model, input.Model, output.Model.ConnectorType)); _editor.AddConnectionVisual(output, input, connectionModel); position.X += 50; position.Y += 50; } catch (Exception) { return; } Close(); } //e.Handled = true; }
public static MultiBinding CreateConnectorBinding(ConnectorVisual connectable, CryptoLineView link) { MultiBinding multiBinding = new MultiBinding(); multiBinding.Converter = new BinConnectorVisualBindingConverter(); multiBinding.ConverterParameter = connectable; Binding binding = new Binding(); binding.Source = connectable.WindowParent; binding.Path = new PropertyPath(ComponentVisual.PositionProperty); multiBinding.Bindings.Add(binding); binding = new Binding(); binding.Source = link.Line; binding.Path = new PropertyPath(InternalCryptoLineView.StrokeThicknessProperty); multiBinding.Bindings.Add(binding); binding = new Binding(); binding.Source = connectable.WindowParent.West; binding.Path = new PropertyPath(FrameworkElement.ActualHeightProperty); multiBinding.Bindings.Add(binding); binding = new Binding(); binding.Source = connectable.WindowParent.East; binding.Path = new PropertyPath(FrameworkElement.ActualHeightProperty); multiBinding.Bindings.Add(binding); binding = new Binding(); binding.Source = connectable.WindowParent.North; binding.Path = new PropertyPath(FrameworkElement.ActualWidthProperty); multiBinding.Bindings.Add(binding); binding = new Binding(); binding.Source = connectable.WindowParent.South; binding.Path = new PropertyPath(FrameworkElement.ActualWidthProperty); multiBinding.Bindings.Add(binding); binding = new Binding(); binding.Source = connectable; binding.Path = new PropertyPath(ConnectorVisual.PositionProperty); multiBinding.Bindings.Add(binding); return(multiBinding); }
private void OnLooksChanged() => _GizmoVisuals = _gizmoLooks;