ViewManager GetViewManager(ModelItem modelItem)
        {
            Fx.Assert(modelItem != null, "modelItem cannot be null");
            ViewManager viewManager = null;
            // First we look for a ViewManagerAttribute. for example a ServiceContractRoot tag, could use
            // use its own view manager if it wanted to .
            ViewManagerAttribute viewManagerAttribute = TypeDescriptor.GetAttributes(modelItem.ItemType)[typeof(ViewManagerAttribute)] as ViewManagerAttribute;

            if (viewManagerAttribute != null && viewManagerAttribute.ViewManagerType != null)
            {
                viewManager = (ViewManager)Activator.CreateInstance(viewManagerAttribute.ViewManagerType);
            }
            // If no viewmanager attribute is found we default to the workflowviewmanager
            if (viewManager == null)
            {
                viewManager = new WorkflowViewManager();
            }
            viewManager.Initialize(this.context);
            return(viewManager);
        }
Example #2
0
 private void OnFloatingAnnotationIsKeyboardFocusWithinChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     if (!this.FloatingAnnotation.IsKeyboardFocusWithin)
     {
         this.TryHideAnnotation(null, null);
         if (this.helpService != null)
         {
             this.helpService.RemoveContextAttribute(string.Empty, typeof(Annotation).FullName);
             this.helpService.AddContextAttribute(string.Empty, WorkflowViewManager.GetF1HelpTypeKeyword(this.ModelItem.ItemType), ComponentModel.Design.HelpKeywordType.F1Keyword);
         }
     }
     else
     {
         Selection.SelectOnly(this.EditingContext, this.ModelItem);
         if (this.helpService != null)
         {
             this.helpService.RemoveContextAttribute(string.Empty, WorkflowViewManager.GetF1HelpTypeKeyword(this.ModelItem.ItemType));
             this.helpService.AddContextAttribute(string.Empty, typeof(Annotation).FullName, ComponentModel.Design.HelpKeywordType.F1Keyword);
         }
     }
 }