private void OnSampleFileSelected(object sender, RoutedEventArgs e) { var dp = e.OriginalSource as DependencyObject; var treeViewItem = WPF.FindUpVisualTree <TreeViewItem>(dp) as TreeViewItem; if (sampleFileTreeView.SelectedItem != null) { treeViewItem.IsExpanded = !treeViewItem.IsExpanded; } var filePath = (sampleFileTreeView.SelectedItem as SampleFileEntry).FilePath; if (string.IsNullOrEmpty(filePath)) { return; } if (!Path.GetExtension(filePath).Equals(".dyn")) { return; } var dvm = this.dynamoViewModel; if (dvm.OpenCommand.CanExecute(filePath)) { dvm.OpenCommand.Execute(filePath); } }
private void topControl_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (ViewModel == null) { return; } var view = WPF.FindUpVisualTree <DynamoView>(this); this.ViewModel.DynamoViewModel.ReturnFocusToSearch(); view.mainGrid.Focus(); var node = this.ViewModel.NodeModel; if (node.Workspace.Nodes.Contains(node)) { Guid nodeGuid = this.ViewModel.NodeModel.GUID; this.ViewModel.DynamoViewModel.ExecuteCommand( new DynCmd.SelectModelCommand(nodeGuid, Keyboard.Modifiers)); } if (e.ClickCount == 2) { if (ViewModel.GotoWorkspaceCommand.CanExecute(null)) { e.Handled = true; ViewModel.GotoWorkspaceCommand.Execute(null); } } }
public dynEditWindow() { InitializeComponent(); //this.Owner = dynSettings.Bench; this.Owner = WPF.FindUpVisualTree <DynamoView>(this); this.WindowStartupLocation = WindowStartupLocation.CenterOwner; this.editText.Focus(); }
public PackageManagerDownloadView() { //this.Owner = dynSettings.Bench; this.Owner = WPF.FindUpVisualTree <DynamoView>(this); this.WindowStartupLocation = WindowStartupLocation.CenterOwner; InitializeComponent(); }
public NodeHelpPrompt(NodeModel node) { this.DataContext = node; this.Owner = WPF.FindUpVisualTree <DynamoView>(this); //this.Owner = dynSettings.Bench; this.WindowStartupLocation = WindowStartupLocation.CenterOwner; InitializeComponent(); }
public InstalledPackagesView() { //this.Owner = dynSettings.Bench; this.Owner = WPF.FindUpVisualTree <DynamoView>(this); this.WindowStartupLocation = WindowStartupLocation.CenterOwner; this.DataContext = dynSettings.PackageLoader; InitializeComponent(); }
public PackageManagerSearchView(PackageManagerSearchViewModel pm) { //this.Owner = dynSettings.Bench; this.Owner = WPF.FindUpVisualTree <DynamoView>(this); this.WindowStartupLocation = WindowStartupLocation.CenterOwner; this.DataContext = pm; InitializeComponent(); }
public PublishPackageView(PublishPackageViewModel packageViewModel) { this.DataContext = packageViewModel; packageViewModel.PublishSuccess += PackageViewModelOnPublishSuccess; this.Owner = WPF.FindUpVisualTree <DynamoView>(this); this.WindowStartupLocation = WindowStartupLocation.CenterOwner; InitializeComponent(); }
void dynPort_Loaded(object sender, RoutedEventArgs e) { //Debug.WriteLine("Port loaded."); canvas = WPF.FindUpVisualTree <Dynamo.Controls.DragCanvas>(this); if (ViewModel != null) { ViewModel.UpdateCenter(CalculateCenter()); } }
public EditWindow() { InitializeComponent(); this.Owner = WPF.FindUpVisualTree <DynamoView>(this); this.WindowStartupLocation = WindowStartupLocation.CenterOwner; this.editText.Focus(); // do not accept value if user closes this.Closing += (sender, args) => this.DialogResult = false; }
private void NickNameBlock_OnMouseEnter(object sender, MouseEventArgs e) { TextBlock textBlock = sender as TextBlock; string tooltipContent = ViewModel.NickName + '\n' + ViewModel.Description; UIElement containingWorkspace = WPF.FindUpVisualTree <TabControl>(this); Point topLeft = textBlock.TranslatePoint(new Point(0, 0), containingWorkspace); double actualWidth = textBlock.ActualWidth * dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.Zoom; double actualHeight = textBlock.ActualHeight * dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.Zoom; Point botRight = new Point(topLeft.X + actualWidth, topLeft.Y + actualHeight); ViewModel.ShowTooltipCommand.Execute(new InfoBubbleDataPacket(InfoBubbleViewModel.Style.NodeTooltip, topLeft, botRight, tooltipContent, InfoBubbleViewModel.Direction.Bottom)); }
private void topControl_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (ViewModel == null) { return; } dynSettings.ReturnFocusToSearch(); //dynSettings.Bench.mainGrid.Focus(); var view = WPF.FindUpVisualTree <DynamoView>(this); view.mainGrid.Focus(); ViewModel.SelectCommand.Execute(null); }
public SearchView() { InitializeComponent(); this.Loaded += new RoutedEventHandler(SearchView_Loaded); SearchTextBox.IsVisibleChanged += delegate { if (SearchTextBox.IsVisible) { DynamoCommands.SearchCommand.Execute(null); Keyboard.Focus(this.SearchTextBox); var view = WPF.FindUpVisualTree <DynamoView>(this); SearchTextBox.InputBindings.AddRange(view.InputBindings); } }; }
private void SetupAndShowTooltip(UIElement sender, InfoBubbleViewModel.Direction direction) { string content = ""; double actualWidth = 0; double actualHeight = 0; switch (direction) { case InfoBubbleViewModel.Direction.Bottom: TextBlock tb = sender as TextBlock; content = ViewModel.Description; if (string.IsNullOrWhiteSpace(content)) { return; } actualWidth = tb.ActualWidth * dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.Zoom; actualHeight = tb.ActualHeight * dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.Zoom; break; case InfoBubbleViewModel.Direction.Left: case InfoBubbleViewModel.Direction.Right: ContentPresenter nodePort = sender as ContentPresenter; content = (nodePort.Content as PortViewModel).ToolTipContent; if (string.IsNullOrWhiteSpace(content)) { return; } actualWidth = nodePort.ActualWidth * dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.Zoom; actualHeight = nodePort.ActualHeight * dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.Zoom; break; } UIElement containingWorkspace = WPF.FindUpVisualTree <TabControl>(this); InfoBubbleDataPacket data = new InfoBubbleDataPacket(); data.Text = content; data.Style = InfoBubbleViewModel.Style.NodeTooltip; data.TopLeft = sender.TranslatePoint(new Point(0, 0), containingWorkspace); data.BotRight = new Point(data.TopLeft.X + actualWidth, data.TopLeft.Y + actualHeight); data.ConnectingDirection = direction; StartDelayedTooltipFadeIn(data); }
private void topControl_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (ViewModel == null) { return; } dynSettings.ReturnFocusToSearch(); //dynSettings.Bench.mainGrid.Focus(); var view = WPF.FindUpVisualTree <DynamoView>(this); view.mainGrid.Focus(); Guid nodeGuid = this.ViewModel.NodeModel.GUID; dynSettings.Controller.DynamoViewModel.ExecuteCommand( new DynCmd.SelectModelCommand(nodeGuid, Keyboard.Modifiers)); }
public FunctionNamePrompt(IEnumerable <string> categories) { InitializeComponent(); //this.Owner = dynSettings.Bench; this.Owner = WPF.FindUpVisualTree <DynamoView>(this); this.WindowStartupLocation = WindowStartupLocation.CenterOwner; this.nameBox.Focus(); var sortedCats = categories.ToList(); sortedCats.Sort(); foreach (var item in sortedCats) { this.categoryBox.Items.Add(item); } }
void NodeLogic_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { switch (e.PropertyName) { case "ArgumentLacing": ViewModel.SetLacingTypeCommand.RaiseCanExecuteChanged(); break; case "IsUpdated": HandleCacheValueUpdated(); break; case "RenderStyle": case "NodeColor": var view = WPF.FindUpVisualTree <DynamoView>(this); view.OnNodePropertyUpdated(viewModel.NodeLogic); break; } }
private void OutputPort_OnMouseEnter(object sender, MouseEventArgs e) { ContentPresenter outputPort = sender as ContentPresenter; string content = (outputPort.Content as PortViewModel).ToolTipContent; if (string.IsNullOrWhiteSpace(content)) { return; } UIElement containingWorkspace = WPF.FindUpVisualTree <TabControl>(this); Point topLeft = outputPort.TranslatePoint(new Point(0, 0), containingWorkspace); double actualWidth = outputPort.ActualWidth * dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.Zoom; double actualHeight = outputPort.ActualHeight * dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.Zoom; Point botRight = new Point(topLeft.X + actualWidth, topLeft.Y + actualHeight); ViewModel.ShowTooltipCommand.Execute(new InfoBubbleDataPacket(InfoBubbleViewModel.Style.NodeTooltip, topLeft, botRight, content, InfoBubbleViewModel.Direction.Left)); }
public SearchView() { InitializeComponent(); Loaded += SearchView_Loaded; Dispatcher.ShutdownStarted += Dispatcher_ShutdownStarted; SearchTextBox.IsVisibleChanged += delegate { if (SearchTextBox.IsVisible) { DynamoCommands.SearchCommand.Execute(null); Keyboard.Focus(this.SearchTextBox); var view = WPF.FindUpVisualTree <DynamoView>(this); SearchTextBox.InputBindings.AddRange(view.InputBindings); } }; searchTimer.Tick += SearchTimerTick; }
public SearchView(SearchViewModel searchViewModel, DynamoViewModel dynamoViewModel) { this.viewModel = searchViewModel; this.dynamoViewModel = dynamoViewModel; InitializeComponent(); Loaded += OnSearchViewLoaded; Dispatcher.ShutdownStarted += OnDispatcherShutdownStarted; SearchTextBox.IsVisibleChanged += delegate { if (SearchTextBox.IsVisible) { this.viewModel.SearchCommand.Execute(null); Keyboard.Focus(this.SearchTextBox); var view = WPF.FindUpVisualTree <DynamoView>(this); SearchTextBox.InputBindings.AddRange(view.InputBindings); } }; }
public EditWindow(bool updateSourceOnTextChange = false) { InitializeComponent(); this.Owner = WPF.FindUpVisualTree <DynamoView>(this); this.WindowStartupLocation = WindowStartupLocation.CenterOwner; this.editText.Focus(); // do not accept value if user closes this.Closing += (sender, args) => this.DialogResult = false; if (false != updateSourceOnTextChange) { this.editText.TextChanged += delegate { var expr = editText.GetBindingExpression(TextBox.TextProperty); if (expr != null) { expr.UpdateSource(); } }; } }