Ejemplo n.º 1
0
        private static SearchableEntry CreateSearchableEntryForArgumentOrVariable(ModelItem itemToFocus)
        {
            SearchableEntry entry = null;

            ModelUtilities.ReverseTraverse(itemToFocus, (ModelItem modelItem) =>
            {
                entry = CreateSearchableEntryNoRecursive(modelItem);
                return(entry == null);
            });
            return(entry);
        }
Ejemplo n.º 2
0
        // Navigate to a ModelItem with the specified location in TextImage. This is for Find Next.
        public override bool NavigateTo(int location)
        {
            if (location < 0 || location >= this.textImageIndexEntryMapping.Count)
            {
                return(false);
            }

            SearchableEntry entry = this.textImageIndexEntryMapping[location];

            return(NavigateTo(entry));
        }
Ejemplo n.º 3
0
        public bool NavigateTo(ModelItem itemToFocus)
        {
            if (itemToFocus == null)
            {
                return(false);
            }

            SearchableEntry entry = CreateSearchableEntryForArgumentOrVariable(itemToFocus);

            if (entry != null)
            {
                return(this.NavigateTo(entry));
            }

            itemToFocus = this.FindModelItemToFocus(itemToFocus);

            itemToFocus.Focus();

            return(true);
        }
        private bool NavigateTo(SearchableEntry entry)
        {
            if (entry.SearchableEntryType == SearchableEntryOption.Variable)
            {
                itemToFocus = entry.ModelItem.Parent.Parent;
                HighlightModelItem(itemToFocus);
                this.lastNavigatedItem = itemToFocus;
                var designerView = this.editingContext.Services.GetService<DesignerView>();
                // Open the variable designer.
                designerView.CheckButtonVariables();
                designerView.variables1.SelectVariable(entry.ModelItem);
            }
            else if (entry.SearchableEntryType == SearchableEntryOption.Argument)
            {
                itemToFocus = this.modelService.Root;
                HighlightModelItem(itemToFocus);
                var designerView = this.editingContext.Services.GetService<DesignerView>();
                // Open the argument designer.
                designerView.CheckButtonArguments();
                designerView.arguments1.SelectArgument(entry.ModelItem);
                this.lastNavigatedItem = entry.ModelItem;
            }
            else
            {
                itemToFocus = entry.ModelItem;
                HighlightModelItem(itemToFocus);
                this.lastNavigatedItem = itemToFocus;
                ICommandService commandService = this.editingContext.Services.GetService<ICommandService>();
                if (commandService != null)
                {
                    commandService.ExecuteCommand(CommandValues.ShowProperties, null);
                }

                PropertyInspector propertiesGrid = this.designer.PropertyInspectorView as PropertyInspector;
                propertiesGrid.SelectPropertyByPath(entry.PropertyPath);
                if (ShouldShowSearchToolTip(itemToFocus))
                {
                    Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() =>
                    {
                        WorkflowViewElement viewElement = itemToFocus.View as WorkflowViewElement;
                        if (viewElement != null)
                        {
                            this.adornerLayer = AdornerLayer.GetAdornerLayer(viewElement as WorkflowViewElement);
                            if (this.adornerLayer != null)
                            {
                                DesignerView designerView = this.editingContext.Services.GetService<DesignerView>();
                                string toolTipText = string.Format(CultureInfo.CurrentUICulture, SR.SearchHintText, entry.ModelProperty.Name);
                                this.toolTipAdorner = new SearchToolTipAdorner(viewElement, designerView, toolTipText);

                                viewElement.CustomItemStatus = "SearchToolTip=" + toolTipText;
                                this.lastWorkflowViewElement = viewElement;

                                this.adornerLayer.Add(this.toolTipAdorner);
                            }
                        }
                    }), DispatcherPriority.ApplicationIdle);
                }
            }

            return true;
        }
Ejemplo n.º 5
0
        private bool NavigateTo(SearchableEntry entry)
        {
            if (entry.SearchableEntryType == SearchableEntryOption.Variable)
            {
                itemToFocus = entry.ModelItem.Parent.Parent;
                HighlightModelItem(itemToFocus);
                this.lastNavigatedItem = itemToFocus;
                var designerView = this.editingContext.Services.GetService <DesignerView>();
                // Open the variable designer.
                designerView.CheckButtonVariables();
                designerView.variables1.SelectVariable(entry.ModelItem);
            }
            else if (entry.SearchableEntryType == SearchableEntryOption.Argument)
            {
                itemToFocus = this.modelService.Root;
                HighlightModelItem(itemToFocus);
                var designerView = this.editingContext.Services.GetService <DesignerView>();
                // Open the argument designer.
                designerView.CheckButtonArguments();
                designerView.arguments1.SelectArgument(entry.ModelItem);
                this.lastNavigatedItem = entry.ModelItem;
            }
            else
            {
                itemToFocus = entry.ModelItem;
                HighlightModelItem(itemToFocus);
                this.lastNavigatedItem = itemToFocus;
                ICommandService commandService = this.editingContext.Services.GetService <ICommandService>();
                if (commandService != null)
                {
                    commandService.ExecuteCommand(CommandValues.ShowProperties, null);
                }

                PropertyInspector propertiesGrid = this.designer.PropertyInspectorView as PropertyInspector;
                propertiesGrid.SelectPropertyByPath(entry.PropertyPath);
                if (ShouldShowSearchToolTip(itemToFocus))
                {
                    Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() =>
                    {
                        WorkflowViewElement viewElement = itemToFocus.View as WorkflowViewElement;
                        if (viewElement != null)
                        {
                            this.adornerLayer = AdornerLayer.GetAdornerLayer(viewElement as WorkflowViewElement);
                            if (this.adornerLayer != null)
                            {
                                DesignerView designerView = this.editingContext.Services.GetService <DesignerView>();
                                string toolTipText        = string.Format(CultureInfo.CurrentUICulture, SR.SearchHintText, entry.ModelProperty.Name);
                                this.toolTipAdorner       = new SearchToolTipAdorner(viewElement, designerView, toolTipText);

                                viewElement.CustomItemStatus = "SearchToolTip=" + toolTipText;
                                this.lastWorkflowViewElement = viewElement;

                                this.adornerLayer.Add(this.toolTipAdorner);
                            }
                        }
                    }), DispatcherPriority.ApplicationIdle);
                }
            }

            return(true);
        }