void RakunViewerUserControl_PreviewKeyDown(object sender, KeyEventArgs e) { if (Keyboard.Modifiers == ModifierKeys.Control) { if (e.Key == Key.C) { if (CurrentSelect is ModuleView && CurrentSelect != null) { clip = (CurrentSelect.DataContext as RakunModuleViewModel)._ModuleInfo.Clone() as RakunNodeBase; } } if (e.Key == Key.X) { if (CurrentSelect is ModuleView && CurrentSelect != null) { clip = (CurrentSelect.DataContext as RakunModuleViewModel)._ModuleInfo.Clone() as RakunNodeBase; } if (CurrentSelect is ModuleView && CurrentSelect != null) { LayoutRoot.Children.Remove(CurrentSelect); CurrentSelect = null; CurrentSelectPosition.Visibility = System.Windows.Visibility.Hidden; } } if (e.Key == Key.V) { if (clip != null) { clip.OnAdd(null); } } if (e.Key == Key.S) { Workspace.This.ActiveDocument.OnSave(null); } } if (e.Key == Key.Delete) { if (CurrentSelect is ModuleView && CurrentSelect != null) { LayoutRoot.Children.Remove(CurrentSelect); CurrentSelect = null; CurrentSelectPosition.Visibility = System.Windows.Visibility.Hidden; } } }
private void ObjectMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { //var focusedControl = Keyboard.FocusedElement; //MessageBox.Show(focusedControl.ToString()); if (sender is PathPointNode) { return; } //In this event, we get current mouse position on the control to use it in the MouseMove event. FirstXPos = e.GetPosition(sender as FrameworkElement).X; FirstYPos = e.GetPosition(sender as FrameworkElement).Y; FirstArrowXPos = e.GetPosition((sender as FrameworkElement).Parent as FrameworkElement).X - FirstXPos; FirstArrowYPos = e.GetPosition((sender as FrameworkElement).Parent as FrameworkElement).Y - FirstYPos; MovingObject = sender; if (MovingObject is ModuleView) { CurrentSelect = sender as ModuleView; CurrentSelect.Focus(); CurrentSelectPosition.Visibility = System.Windows.Visibility.Visible; CurrentSelectPosition.Width = (CurrentSelect as FrameworkElement).ActualWidth + 5; CurrentSelectPosition.Height = (CurrentSelect as FrameworkElement).ActualHeight + 5; Point po1 = new Point(); po1.X = e.GetPosition((MovingObject as FrameworkElement).Parent as FrameworkElement).X - FirstXPos; po1.Y = e.GetPosition((MovingObject as FrameworkElement).Parent as FrameworkElement).Y - FirstYPos; CurrentSelectPosition.SetValue(Canvas.LeftProperty, po1.X); CurrentSelectPosition.SetValue(Canvas.TopProperty, po1.Y); } else { CurrentSelect = null; CurrentSelectPosition.Visibility = System.Windows.Visibility.Hidden; } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.UserControl = ((RakunWin32.ModuleView)(target)); return; case 2: this.RootLayout = ((System.Windows.Controls.Border)(target)); return; case 3: this.LayoutRoot = ((System.Windows.Controls.Grid)(target)); return; case 4: this.InputNode = ((System.Windows.Controls.Grid)(target)); return; case 5: this.RootLayout_Copy5 = ((System.Windows.Controls.Border)(target)); return; case 6: this.TBTitle3 = ((System.Windows.Controls.TextBlock)(target)); return; case 7: this.TBTitle3_Copy = ((System.Windows.Controls.TextBlock)(target)); return; case 8: this.tbinput = ((System.Windows.Controls.TextBox)(target)); #line 121 "..\..\ModuleView.xaml" this.tbinput.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.TextBox_TextChanged); #line default #line hidden return; case 9: this.ValueNode = ((System.Windows.Controls.Grid)(target)); return; case 10: this.RootLayout_Copy4 = ((System.Windows.Controls.Border)(target)); return; case 11: this.TBTitle1 = ((System.Windows.Controls.TextBlock)(target)); return; case 12: this.ModuleNode = ((System.Windows.Controls.Grid)(target)); return; case 13: this.RootLayout_Copy = ((System.Windows.Controls.Border)(target)); return; case 14: this.TBTitle = ((System.Windows.Controls.TextBlock)(target)); return; case 15: this.StartingNode = ((System.Windows.Controls.Grid)(target)); return; case 16: this.RootLayout_Copy1 = ((System.Windows.Controls.Border)(target)); return; case 17: this.TBTitle2 = ((System.Windows.Controls.TextBlock)(target)); return; case 18: this.IFNode = ((System.Windows.Controls.Grid)(target)); return; case 19: this.RootLayout_Copy2 = ((System.Windows.Controls.Border)(target)); return; case 20: this.ForNode = ((System.Windows.Controls.Grid)(target)); return; case 21: this.RootLayout_Copy3 = ((System.Windows.Controls.Border)(target)); return; } this._contentLoaded = true; }