public void TS_DeleteNode(String NodeName) { if (NodeName == null) { return; } if (!m_FunctionNodeModels.ContainsKey(NodeName)) { return; } Model.TrickerStarFunctionNodeModel node_m = (Model.TrickerStarFunctionNodeModel)m_FunctionNodeModels[NodeName]; TrickerStarFunctionNode node_v = (TrickerStarFunctionNode)m_FunctionNodeViews[NodeName]; foreach (var item in node_m.InputSlot) { DeleteLine(item.LineName); } foreach (var item in node_m.OutputSlot) { DeleteLine(item.LineName); } m_FunctionNodeModels.Remove(NodeName); m_FunctionNodeViews.Remove(NodeName); C_MAIN_CANVAS.Children.Remove(node_v); m_SelectedFunctionNodeModels.Clear(); m_FromSlot = null; m_ToSlot = null; }
public void AddLine(String LineName, Model.TrickerStarNodeSoltDetail from, Model.TrickerStarNodeSoltDetail to) { Model.TrickerStarLineModel line = new TrickerStarLineModel() { LineName = LineName, From = from, To = to }; TrickerStarFunctionNodeModel node_from_m = (TrickerStarFunctionNodeModel)m_FunctionNodeModels[line.From.NodeName]; TrickerStarFunctionNodeModel node_to_m = (TrickerStarFunctionNodeModel)m_FunctionNodeModels[line.To.NodeName]; DeleteLine(node_from_m.OutputSlot[from.SlotIndex].LineName); DeleteLine(node_to_m.InputSlot[to.SlotIndex].LineName); node_from_m.OutputSlot[from.SlotIndex].LineName = line.LineName; node_to_m.InputSlot[to.SlotIndex].LineName = line.LineName; line.From = node_from_m.OutputSlot[from.SlotIndex]; line.To = node_to_m.InputSlot[to.SlotIndex]; var geo = GenPathGeomentry(from, to); var path = GenPath(line.LineName, geo); m_FunctionNodeModels[line.From.NodeName] = node_from_m; m_FunctionNodeModels[line.To.NodeName] = node_to_m; m_FunctionLineModels[line.LineName] = line; m_FunctionLineViews[line.LineName] = path; C_MAIN_CANVAS.Children.Add(path); }
public void AddLine(Model.TrickerStarNodeSoltDetail from, Model.TrickerStarNodeSoltDetail to) { Model.TrickerStarLineModel line = new TrickerStarLineModel() { LineName = "LINE" + Model.TrickerStarDataModel.RandToken(), From = from, To = to }; AddLine(line.LineName, from, to); }
private void NODE_OnSlotClicked(Model.TrickerStarNodeSoltDetail slot_detail) { Model.TrickerStarFunctionNodeModel node_m = (Model.TrickerStarFunctionNodeModel)m_FunctionNodeModels[slot_detail.NodeName]; if (slot_detail.SlotSide == TrickerStarSlotSide.INPUT) { DeleteLine(node_m.InputSlot[slot_detail.SlotIndex].LineName); } if (slot_detail.SlotSide == TrickerStarSlotSide.OUTPUT) { DeleteLine(node_m.OutputSlot[slot_detail.SlotIndex].LineName); } if (slot_detail.SlotSide == TrickerStarSlotSide.INPUT) { if (m_FromSlot != null) { if (m_FromSlot.SlotType == (slot_detail.SlotType)) { m_ToSlot = slot_detail; } } else { m_ToSlot = slot_detail; } } if (slot_detail.SlotSide == TrickerStarSlotSide.OUTPUT) { if (m_ToSlot != null) { if (m_ToSlot.SlotType == (slot_detail.SlotType)) { m_FromSlot = slot_detail; } } else { m_FromSlot = slot_detail; } } /////////////////////////////////////////////////////////// if (m_FromSlot != null && m_ToSlot != null) { AddLine(m_FromSlot, m_ToSlot); m_FromSlot = null; m_ToSlot = null; m_TempPath.Visibility = Visibility.Collapsed; } if (m_FromSlot == null && m_ToSlot == null) { //m_TempPath.Visibility = Visibility.Collapsed; } if ((m_FromSlot == null && m_ToSlot != null) || (m_FromSlot != null && m_ToSlot == null)) { //m_TempPath.Visibility = Visibility.Visible; } }
public void TS_Clear() { C_MAIN_CANVAS.Children.Clear(); m_FunctionNodeModels.Clear(); m_FunctionLineModels.Clear(); m_FunctionNodeViews.Clear(); m_FunctionLineViews.Clear(); m_SelectedFunctionNodeModels.Clear(); m_FromSlot = null; m_ToSlot = null; }
public PathGeometry GenPathGeomentry(Model.TrickerStarNodeSoltDetail from, Model.TrickerStarNodeSoltDetail to) { TrickerStarFunctionNodeModel node_from_m = (TrickerStarFunctionNodeModel)m_FunctionNodeModels[from.NodeName]; TrickerStarFunctionNodeModel node_to_m = (TrickerStarFunctionNodeModel)m_FunctionNodeModels[to.NodeName]; TrickerStarFunctionNode node_from_v = (TrickerStarFunctionNode)m_FunctionNodeViews[from.NodeName]; TrickerStarFunctionNode node_to_v = (TrickerStarFunctionNode)m_FunctionNodeViews[to.NodeName]; Point Line_from = new Point(node_from_m.Pos.X, node_from_m.Pos.Y), Line_to = new Point(node_to_m.Pos.X, node_to_m.Pos.Y); node_from_v.InvalidateMeasure(); Line_from.X += node_from_v.ActualWidth; Line_from.Y += from.SlotIndex * 48 + 96; Line_to.Y += to.SlotIndex * 48 + 96; Line_from.X -= 16; Line_to.X += 16; var pathGeometry1 = new PathGeometry(); var pathFigureCollection1 = new PathFigureCollection(); var pathFigure1 = new PathFigure(); pathFigure1.IsClosed = false; pathFigure1.StartPoint = new Windows.Foundation.Point(Line_from.X, Line_from.Y); pathFigureCollection1.Add(pathFigure1); pathGeometry1.Figures = pathFigureCollection1; var pathSegmentCollection1 = new PathSegmentCollection(); var pathSegment1 = new BezierSegment(); pathSegment1.Point1 = new Point(Line_from.X + 100, Line_from.Y); pathSegment1.Point2 = new Point(Line_to.X - 100, Line_to.Y); pathSegment1.Point3 = new Point(Line_to.X, Line_to.Y); pathSegmentCollection1.Add(pathSegment1); pathFigure1.Segments = pathSegmentCollection1; return(pathGeometry1); }
public void OnSlotPressed(object sender, PointerRoutedEventArgs e) { Grid sender_grid = sender as Grid; Model.TrickerStarNodeSolt slot = sender_grid.DataContext as Model.TrickerStarNodeSolt; Model.TrickerStarNodeSoltDetail detail = new Model.TrickerStarNodeSoltDetail() { SlotType = slot.SlotType, NodeName = m_NodeName, SlotName = slot.SlotName, SlotIndex = slot.SlotIndex, SlotSide = slot.SlotSide, }; if (OnSlotClicked != null) { OnSlotClicked.Invoke(detail); } }
private void SlotValueTextChanged(object sender, TextChangedEventArgs e) { TextBox tb = sender as TextBox; Model.TrickerStarNodeSolt slot = tb.DataContext as Model.TrickerStarNodeSolt; Model.TrickerStarNodeSoltDetail detail = new Model.TrickerStarNodeSoltDetail() { SlotType = slot.SlotType, NodeName = m_NodeName, SlotName = slot.SlotName, SlotIndex = slot.SlotIndex, SlotSide = slot.SlotSide, SlotValue = tb.Text, }; if (OnSlotValueChanged != null) { OnSlotValueChanged.Invoke(detail); } }
private void C_MAIN_CANVAS_PointerPressed(object sender, PointerRoutedEventArgs e) { m_ActiveElementType = ACTIVE_ELEMENT_TYPE.CANVAS; m_Pressed = true; m_OldPoint = e.GetCurrentPoint(this).Position; m_OldTranslation.X = C_MAINSCROLLVIEWER.HorizontalOffset; m_OldTranslation.Y = C_MAINSCROLLVIEWER.VerticalOffset; m_CapturedPointer = e.Pointer; if (m_ShiftPressed == false) { UnselectNodes(); m_SelectedFunctionNodeModels.Clear(); } m_FromSlot = null; m_ToSlot = null; m_TempPath.Visibility = Visibility.Collapsed; //C_MAIN_CANVAS.CapturePointer(e.Pointer); }