示例#1
0
 private void OnRequestShowNodeAutoCompleteSearch(ShowHideFlags flags)
 {
     if (RequestShowNodeAutoCompleteSearch != null)
     {
         RequestShowNodeAutoCompleteSearch(flags);
     }
 }
示例#2
0
        private void ShowHidePopup(ShowHideFlags flag, Popup popup)
        {
            // Reset popup display state
            popup.IsOpen = false;
            switch (flag)
            {
            case ShowHideFlags.Hide:
                break;

            case ShowHideFlags.Show:
                // Show InCanvas search just in case, when mouse is over workspace.
                var displayPopup = DynamoModel.IsTestMode || IsMouseOver;
                if (displayPopup && popup == NodeAutoCompleteSearchBar)
                {
                    if (ViewModel.NodeAutoCompleteSearchViewModel.PortViewModel == null)
                    {
                        return;
                    }
                    // Force the Child visibility to change here because
                    // 1. Popup isOpen change does not necessarily update the child control before it take effect
                    // 2. Dynamo rely on child visibility change hander to setup Node AutoComplete control
                    // 3. This should not be set to in canvas search control
                    popup.Child.Visibility = Visibility.Collapsed;
                    ViewModel.NodeAutoCompleteSearchViewModel.PortViewModel.SetupNodeAutocompleteWindowPlacement(popup);
                }
                popup.Child.Visibility             = Visibility.Visible;
                popup.IsOpen                       = displayPopup;
                popup.CustomPopupPlacementCallback = null;

                ViewModel.InCanvasSearchViewModel.SearchText             = string.Empty;
                ViewModel.InCanvasSearchViewModel.InCanvasSearchPosition = inCanvasSearchPosition;
                break;
            }
        }
示例#3
0
 private void OnRequestShowInCanvasSearch(ShowHideFlags flags)
 {
     if (RequestShowInCanvasSearch != null)
     {
         RequestShowInCanvasSearch(flags);
     }
 }
 private void OnRequestShowInCanvasSearch(ShowHideFlags flags)
 {
     if (RequestShowInCanvasSearch != null)
     {
         RequestShowInCanvasSearch(flags);
     }
 }
示例#5
0
 /// <summary>
 /// Requests to open the OutPortContextMenu popup.
 /// </summary>
 /// <param name="flags"></param>
 private void OnRequestShowPortContextMenu(ShowHideFlags flags)
 {
     if (RequestShowPortContextMenu != null)
     {
         RequestShowPortContextMenu(flags, DataContext as PortViewModel);
     }
 }
示例#6
0
        private void ShowHidePopup(ShowHideFlags flag, Popup popup)
        {
            // Reset popup display state
            popup.IsOpen = false;
            switch (flag)
            {
            case ShowHideFlags.Hide:
                break;

            case ShowHideFlags.Show:
                // Show InCanvas search just in case, when mouse is over workspace.
                var displayPopup = DynamoModel.IsTestMode || IsMouseOver;

                if (displayPopup)
                {
                    if (popup == NodeAutoCompleteSearchBar)
                    {
                        if (ViewModel.NodeAutoCompleteSearchViewModel.PortViewModel == null)
                        {
                            return;
                        }
                        // Force the Child visibility to change here because
                        // 1. Popup isOpen change does not necessarily update the child control before it take effect
                        // 2. Dynamo rely on child visibility change hander to setup Node AutoComplete control
                        // 3. This should not be set to in canvas search control
                        popup.Child.Visibility = Visibility.Collapsed;
                        ViewModel.NodeAutoCompleteSearchViewModel.PortViewModel.SetupNodeAutocompleteWindowPlacement(popup);
                    }

                    else if (popup == PortContextMenu)
                    {
                        popup.Child.Visibility = Visibility.Hidden;
                        if (!(PortContextMenu.DataContext is PortViewModel portViewModel))
                        {
                            return;
                        }
                        portViewModel.SetupPortContextMenuPlacement(popup);
                    }
                }

                // We need to use the dispatcher here to make sure that
                // the popup is fully updated before we show it.
                // This was mainly an issue with the PortContextMenu as
                // it uses a DataTemplate bound to the WorkspaceViewModel
                // to display the correct content.
                // If the dispatcher is not used in this scenario when switching
                // from inputPort context menu to Output port context menu,
                // the popup will display before the new content is fully rendered
                this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background, new Action(() => {
                    popup.Child.Visibility = Visibility.Visible;
                    popup.Child.UpdateLayout();
                    popup.IsOpen = displayPopup;
                    popup.CustomPopupPlacementCallback = null;
                }));

                ViewModel.InCanvasSearchViewModel.SearchText             = string.Empty;
                ViewModel.InCanvasSearchViewModel.InCanvasSearchPosition = inCanvasSearchPosition;
                break;
            }
        }
示例#7
0
        private void ShowHidePopup(ShowHideFlags flag, Popup popup)
        {
            switch (flag)
            {
            case ShowHideFlags.Hide:
                popup.IsOpen = false;
                break;

            case ShowHideFlags.Show:
                // Show InCanvas search just in case, when mouse is over workspace.
                var displayPopup = DynamoModel.IsTestMode || IsMouseOver;
                if (displayPopup && popup == NodeAutoCompleteSearchBar)
                {
                    if (ViewModel.NodeAutoCompleteSearchViewModel.PortViewModel == null)
                    {
                        return;
                    }

                    ViewModel.NodeAutoCompleteSearchViewModel.PortViewModel.SetupNodeAutocompleteWindowPlacement(popup);
                }
                popup.IsOpen = displayPopup;
                popup.CustomPopupPlacementCallback = null;

                ViewModel.InCanvasSearchViewModel.SearchText             = string.Empty;
                ViewModel.InCanvasSearchViewModel.InCanvasSearchPosition = inCanvasSearchPosition;
                break;
            }
        }
        private void ShowHideNodeAutoCompleteControl(ShowHideFlags flag)
        {
            // Prevents hiding the dialog from releasing the left mouse button
            if (flag == ShowHideFlags.Hide && isAutoCompleteLoading)
            {
                isAutoCompleteLoading = false;
                return;
            }

            isAutoCompleteLoading = flag == ShowHideFlags.Show && !NodeAutoCompleteSearchBar.IsOpen;
            ShowHidePopup(flag, NodeAutoCompleteSearchBar);
        }
示例#9
0
        private void ShowHidePopup(ShowHideFlags flag, Popup popup)
        {
            switch (flag)
            {
            case ShowHideFlags.Hide:
                popup.IsOpen = false;
                break;

            case ShowHideFlags.Show:
                // Show InCanvas search just in case, when mouse is over workspace.
                popup.IsOpen = DynamoModel.IsTestMode || IsMouseOver;
                ViewModel.InCanvasSearchViewModel.InCanvasSearchPosition = inCanvasSearchPosition;
                break;
            }
        }
示例#10
0
        private void ShowHideInCanvasControl(ShowHideFlags flag)
        {
            switch (flag)
            {
            case ShowHideFlags.Hide:
                InCanvasSearchBar.IsOpen = false;
                break;

            case ShowHideFlags.Show:
                // Show InCanvas search just in case, when mouse is over workspace.
                InCanvasSearchBar.IsOpen = this.IsMouseOver;
                ViewModel.InCanvasSearchViewModel.InCanvasSearchPosition = inCanvasSearchPosition;
                break;
            }
        }
示例#11
0
 private void ShowHideInCanvasControl(ShowHideFlags flag)
 {
     switch (flag)
     {
         case ShowHideFlags.Hide:
             InCanvasSearchBar.IsOpen = false;
             break;
         case ShowHideFlags.Show:
             // Show InCanvas search just in case, when mouse is over workspace.
             InCanvasSearchBar.IsOpen = this.IsMouseOver;
             ViewModel.InCanvasSearchViewModel.InCanvasSearchPosition = inCanvasSearchPosition;
             break;
     }
 }
示例#12
0
 private void ShowHideContextMenu(ShowHideFlags flag)
 {
     ShowHidePopup(flag, ContextMenuPopup);
 }
 private void ShowHideInCanvasControl(ShowHideFlags flag)
 {
     ShowHidePopup(flag, InCanvasSearchBar);
 }
示例#14
0
 private void ShowHidePortContextMenu(ShowHideFlags flag, PortViewModel portViewModel)
 {
     PortContextMenu.DataContext = portViewModel;
     ShowHidePopup(flag, PortContextMenu);
 }
示例#15
0
 private void ShowHideNodeAutoCompleteControl(ShowHideFlags flag)
 {
     ShowHidePopup(flag, NodeAutoCompleteSearchBar);
 }
示例#16
0
 private void ShowHideInCanvasControl(ShowHideFlags flag)
 {
     ShowHidePopup(flag, InCanvasSearchBar);
 }
 private void ShowHideContextMenu(ShowHideFlags flag)
 {
     ShowHidePopup(flag, ContextMenuPopup);
 }
 private void ShowHidePopup(ShowHideFlags flag, Popup popup)
 {
     switch (flag)
     {
         case ShowHideFlags.Hide:
             popup.IsOpen = false;
             break;
         case ShowHideFlags.Show:
             // Show InCanvas search just in case, when mouse is over workspace.
             popup.IsOpen = DynamoModel.IsTestMode || IsMouseOver;
             ViewModel.InCanvasSearchViewModel.SearchText = string.Empty;
             ViewModel.InCanvasSearchViewModel.InCanvasSearchPosition = inCanvasSearchPosition;
             break;
     }
 }
 /// <summary>
 /// Requests to open the OutPortContextMenu popup.
 /// </summary>
 /// <param name="flags"></param>
 private void OnRequestShowPortContextMenu(ShowHideFlags flags)
 {
     RequestShowPortContextMenu?.Invoke(flags, DataContext as PortViewModel);
 }