public void StartPath(RakunModuleViewModel Start, ref PathPointNode node) { //UIElement container = VisualTreeHelper.GetParent(control) as UIElement; Point relativeLocation = node.TranslatePoint(new Point(5, 5), LayoutRoot); node.MyPath.StartPosition = relativeLocation; node.MyPath.EndPathPosition = relativeLocation; node.MyPath.Path.Stroke = node.Foreground; isConnected = false; MovingPath = node; BeginnerPoint = Start; MovingPath.MyPath.Visibility = System.Windows.Visibility.Visible; if (node.NextPoint != null) { node.NextPoint.ComePath = null; if (MovingPath.NextPoint != null) { MovingPath.NextPoint.Disconnect(); } node.NextPoint = null; } }
public void StartLine(RakunModuleViewModel Start, PathPointNode node) { /* * Line sequence = node.MyPath; * sequence.Width = LayoutRoot.Width; * sequence.Height = LayoutRoot.Height; * Point CurrentPos = Mouse.GetPosition(this); * * //UIElement container = VisualTreeHelper.GetParent(control) as UIElement; * Point relativeLocation = node.TranslatePoint(new Point(5, 5), LayoutRoot); * * sequence.X1 = relativeLocation.X; * sequence.Y1 = relativeLocation.Y; * sequence.X2 = relativeLocation.X; * sequence.Y2 = relativeLocation.Y; * * isConnected = false; * MovingPath = node; * BeginnerPoint = Start; * * MovingPath.MyPath.Visibility = System.Windows.Visibility.Visible; * if (node.NextPoint != null) * { * node.NextPoint._ComePath = null; * node.NextPoint = null; * } */ }
public void OnAdd(object parameter) { MotherVM = Workspace.This.ActiveDocument.AddModule(this); Workspace.This.StatusString = ModuleName + " Module Added"; MotherVM._ModuleInfo.MotherVM = MotherVM; MotherVM._ModuleInfo.GenRakunValue(MotherVM.name.Replace(" ", ""), 0); }
public RakunValueNodeViewModel(RakunNode _Module, ModuleView _Root, RakunViewerUserControl _Parent, RakunModuleViewModel _ModuleViewModle) { Parent = _Parent; Module = _Module; Root = _Root; ModuleViewModle = _ModuleViewModle; ChangedName = ValueName; }
public RakunModuleViewModel AddModule(RakunNodeBase Module) { ModuleView myButton = new ModuleView(); RakunModuleViewModel NewVM = new RakunModuleViewModel(Module, View, myButton); NewVM.SetMother(NewVM); _Modules.Add(NewVM); View.AddRakunNode(NewVM); NewVM.name = NewVM.ModuleInfo.ModuleName + "_" + _Modules.Count + "_"; return(NewVM); //Workspace.This.StatusString = ModuleName + " Module Added"; }
public string BuildArduino() { RakunModuleViewModel itorNode = startingNode; RakunNodeBase Resualt = new RakunNodeBase(); while (itorNode != null) { Resualt = RakunModuleViewModel.SumbNode(Resualt, itorNode).Clone() as RakunNodeBase; itorNode = itorNode.Next; } return(Resualt.Gen_C_Code()); }
public void AddRakunNode(RakunModuleViewModel node) { if (node.ModuleInfo.NodeType == RakunNodeBase.RakunNodeType.Starting) { startingNode = node; } node.Root.DataContext = node; //node.Root.TBTitle.Text = node.ModuleInfo.ModuleName; node.Root.ModuleNode.Visibility = System.Windows.Visibility.Collapsed; node.Root.StartingNode.Visibility = System.Windows.Visibility.Collapsed; node.Root.ForNode.Visibility = System.Windows.Visibility.Collapsed; node.Root.IFNode.Visibility = System.Windows.Visibility.Collapsed; node.Root.ValueNode.Visibility = System.Windows.Visibility.Collapsed; node.Root.InputNode.Visibility = System.Windows.Visibility.Collapsed; if (node.ModuleInfo.NodeType == RakunNodeBase.RakunNodeType.Starting) { node.Root.StartingNode.Visibility = System.Windows.Visibility.Visible; } else if (node.ModuleInfo.NodeType == RakunNodeBase.RakunNodeType.Module) { node.Root.ModuleNode.Visibility = System.Windows.Visibility.Visible; } else if (node.ModuleInfo.NodeType == RakunNodeBase.RakunNodeType.For) { node.Root.ForNode.Visibility = System.Windows.Visibility.Visible; } else if (node.ModuleInfo.NodeType == RakunNodeBase.RakunNodeType.If) { node.Root.IFNode.Visibility = System.Windows.Visibility.Visible; } else if (node.ModuleInfo.NodeType == RakunNodeBase.RakunNodeType.Value) { node.Root.ValueNode.Visibility = System.Windows.Visibility.Visible; } else if (node.ModuleInfo.NodeType == RakunNodeBase.RakunNodeType.Input) { node.Root.InputNode.Visibility = System.Windows.Visibility.Visible; } //MouseDragElementBehavior be = new MouseDragElementBehavior(); //be.Attach(myButton); node.Root.MouseLeftButtonDown += ObjectMouseLeftButtonDown; node.Root.PreviewMouseLeftButtonUp += ObjectPreviewMouseLeftButtonUp; node.Root.PreviewKeyDown += RakunViewerUserControl_PreviewKeyDown; node.Root.Focusable = true; LayoutRoot.Children.Add(node.Root); }
public void EnterSequence(RakunModuleViewModel Finish, PathPointNode node) { if (MovingPath == null) { return; } if (MovingPath == node) { return; } if (MovingPath.PathType == node.PathType) { isConnected = true; DestinationPoint = node; FinisherPoint = Finish; } }
private void TextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e) { RakunModuleViewModel context = this.DataContext as RakunModuleViewModel; context.input = tbinput.Text; }
void ObjectPreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) { if (MovingObject is ModuleView && MovingObject != null) { CurrentSelectPosition.Visibility = System.Windows.Visibility.Visible; CurrentSelectPosition.Width = (CurrentSelect as FrameworkElement).ActualWidth + 10; CurrentSelectPosition.Height = (CurrentSelect as FrameworkElement).ActualHeight + 10; Point po1 = new Point(); po1.X = e.GetPosition((MovingObject as FrameworkElement).Parent as FrameworkElement).X - FirstXPos - 5; po1.Y = e.GetPosition((MovingObject as FrameworkElement).Parent as FrameworkElement).Y - FirstYPos - 5; CurrentSelectPosition.SetValue(Canvas.LeftProperty, po1.X); CurrentSelectPosition.SetValue(Canvas.TopProperty, po1.Y); } else { //CurrentSelect = null; //CurrentSelectPosition.Visibility = System.Windows.Visibility.Hidden; } if (isConnected == false) { if (MovingPath != null) { //선은 있는데 연결이 끊긴경우 MovingPath.MyPath.Visibility = System.Windows.Visibility.Collapsed; //MovingPath.Disconnect(); if (MovingPath.NextPoint != null) { if (MovingPath.NextPoint.BeforePoint != null) { MovingPath.NextPoint.BeforePoint.Disconnect(); MovingPath.NextPoint.BeforePoint = null; } MovingPath.NextPoint.Disconnect(); MovingPath.NextPoint = null; } } } else if (DestinationPoint != null) { if (BeginnerPoint.Next != null) { BeginnerPoint.Next.Before = null; } if (MovingPath.NextPoint != null) { MovingPath.NextPoint.BeforePoint = null; } //앞뒤로 연결하기 MovingPath.NextPoint = DestinationPoint; DestinationPoint.BeforePoint = MovingPath; DestinationPoint.ComePath = MovingPath.MyPath; //IF문의 경우 True에 if (MovingPath.MySequence == PathPointNode.PathIFDirection.TrueSequence) { BeginnerPoint.TrueNode = FinisherPoint; } else if (MovingPath.MySequence == PathPointNode.PathIFDirection.FalseSequence) {//false에 값을 넣는다. BeginnerPoint.FalseNode = FinisherPoint; } else { BeginnerPoint.Next = FinisherPoint; } FinisherPoint.Before = BeginnerPoint; MovingPath.OnConnect(); MovingPath.NextPoint.OnConnect(); } DestinationPoint = null; MovingPath = null; BeginnerPoint = null; FinisherPoint = null; // In this event, we should set the lines visibility to Hidden MovingObject = null; Path1.Visibility = System.Windows.Visibility.Hidden; Path2.Visibility = System.Windows.Visibility.Hidden; Path3.Visibility = System.Windows.Visibility.Hidden; Path4.Visibility = System.Windows.Visibility.Hidden; FirstPosition.Visibility = System.Windows.Visibility.Hidden; CurrentPosition.Visibility = System.Windows.Visibility.Hidden; }