public void UpdateContext(AssemblyContextControlItem assemblies, ImportedNamespaceContextItem importedNamespaces)
        {
            var references = new List <MetadataReference>();

            foreach (var assembly in assemblies.AllAssemblyNamesInContext)
            {
                System.Reflection.Assembly asm = null;
                try
                {
                    asm = System.Reflection.Assembly.Load(assembly);
                }
                catch (Exception)
                {
                    //Console.WriteLine(ex.ToString());
                }
                if (asm != null)
                {
                    if (File.Exists(asm.Location))
                    {
                        references.Add(MetadataReference.CreateFromFile(asm.Location));
                    }
                }
            }

            baseAssemblies = references.ToArray();

            usingNamespaces = string.Join("", importedNamespaces.ImportedNamespaces.Select(ns => "using " + ns + ";\n").ToArray());
        }
        void LoadNameSpace(List <NamespaceDeclaration> result)
        {
            if (null == this.context)
            {
                //Fx.Assert("EditingContext is null");
                return;
            }
            AssemblyContextControlItem assemblyContext = this.context.Items.GetValue <AssemblyContextControlItem>();

            if (null == assemblyContext)
            {
                //Fx.Assert("AssemblyContextControlItem not defined in EditingContext.Items");
                return;
            }
            if (null != assemblyContext.LocalAssemblyName)
            {
                result.Add(GetEntry(assemblyContext.LocalAssemblyName));
            }
            if (null != assemblyContext.ReferencedAssemblyNames)
            {
                foreach (AssemblyName name in assemblyContext.ReferencedAssemblyNames)
                {
                    result.Add(GetEntry(name));
                }
            }
        }
Пример #3
0
        //When assemblyContextItem is null, it means the assembly cannot be local assembly
        IEnumerable <string> GetUniqueNamespacesInAssembly(Assembly assembly, AssemblyContextControlItem assemblyContextItem)
        {
            IEnumerable <Type> types = null;

            //we should only display namespaces for public types except the local assembly
            if ((assemblyContextItem != null) && (assemblyContextItem.LocalAssemblyName != null) && (assembly.FullName == assemblyContextItem.LocalAssemblyName.FullName))
            {
                types = assembly.GetTypes();
            }
            else
            {
                types = assembly.GetExportedTypes();
            }

            HashSet <string> namespaces = new HashSet <string>();

            if (types != null)
            {
                foreach (Type type in types)
                {
                    string ns = type.Namespace;
                    if (!namespaces.Contains(ns))
                    {
                        namespaces.Add(ns);
                    }
                }
            }

            return(namespaces);
        }
        public IExpressionEditorInstance CreateExpressionEditor(AssemblyContextControlItem assemblies, ImportedNamespaceContextItem importedNamespaces, List <ModelItem> variables, string text, Type expressionType, Size initialSize)
        {
            UpdateContext(assemblies, importedNamespaces);
            var editor = new RoslynExpressionEditorInstance(initialSize);

            editor.UpdateInstance(variables, text);
            return(editor);
        }
Пример #5
0
        void GetAvailableNamespaces()
        {
            Fx.Assert(this.availableNamespaces != null, "available namespace table should have been set before calling this method");
            AssemblyContextControlItem assemblyItem = this.Context.Items.GetValue <AssemblyContextControlItem>();

            if (assemblyItem != null)
            {
                IMultiTargetingSupportService multiTargetingService = this.Context.Services.GetService <IMultiTargetingSupportService>();

                ////When ReferencedAssemblyNames is null, it's in rehost scenario. And we need to preload assemblies in
                ////TextExpression.ReferencesForImplementation/References if there is any. So that these assemblies will be returned
                ////by AssemblyContextControlItem.GetEnvironmentAssemblies and user can see namespaces defined in these assemlbies
                ////in the dropdown list of Import Designer.
                if ((assemblyItem.ReferencedAssemblyNames == null) && (this.targetFramework.Is45OrHigher()))
                {
                    ModelTreeManager          modelTreeManager = this.Context.Services.GetService <ModelTreeManager>();
                    object                    root             = modelTreeManager.Root.GetCurrentValue();
                    IList <AssemblyReference> references;
                    NamespaceHelper.GetTextExpressionNamespaces(root, out references);
                    foreach (AssemblyReference reference in references)
                    {
                        reference.LoadAssembly();
                    }
                }

                IEnumerable <Assembly> allAssemblies = assemblyItem.GetEnvironmentAssemblies(multiTargetingService);
                if (assemblyItem.LocalAssemblyName != null)
                {
                    allAssemblies = allAssemblies.Union <Assembly>(new Collection <Assembly> {
                        AssemblyContextControlItem.GetAssembly(assemblyItem.LocalAssemblyName, multiTargetingService)
                    });
                }

                foreach (Assembly assembly in allAssemblies)
                {
                    try
                    {
                        if (assembly != null)
                        {
                            Fx.Assert(!assembly.IsDynamic, "there should not be any dynamic assemblies in reference list");
                            this.UpdateAvailableNamespaces(assembly, assemblyItem);
                        }
                    }
                    catch (ReflectionTypeLoadException)
                    {
                    }
                    catch (FileNotFoundException)
                    {
                    }
                }

                if (assemblyItem.LocalAssemblyName == null)
                {
                    AppDomain.CurrentDomain.AssemblyLoad += this.proxy.OnAssemblyLoad;
                }
            }
        }
        /// <summary>
        /// Creates an expression editor instance.
        /// </summary>
        /// <param name="assemblies">The accessible assemblies.</param>
        /// <param name="importedNamespaces">The imported namespaces.</param>
        /// <param name="variables">The variable list.</param>
        /// <param name="text">The text.</param>
        /// <returns>The <see cref="IExpressionEditorInstance"/> that was created.</returns>
        public IExpressionEditorInstance CreateExpressionEditor(AssemblyContextControlItem assemblies, ImportedNamespaceContextItem importedNamespaces, List <ModelItem> variables, string text)
        {
            var editor = new MyExpressionEditorInstance(designer, variables, language);

            editor.Text = text;
            editor.LostAggregateFocus += OnEditorLostFocus;
            editors.Add(editor);
            return(editor);
        }
Пример #7
0
        public static void SelectionChanged(AssemblyContextControlItem assemblyContext)
        {
            var nameSpace = assemblyContext.AllAssemblyNamesInContext;

            while (nameSpace != null)
            {
                var name = string.Join(";", nameSpace);
            }
        }
Пример #8
0
        private void UpdateExpressionEditors()
        {
            AssemblyContextControlItem assemblies = this.Context.Items.GetValue <AssemblyContextControlItem>();
            IExpressionEditorService   expressionEditorService = this.Context.Services.GetService <IExpressionEditorService>();

            if (expressionEditorService != null)
            {
                expressionEditorService.UpdateContext(assemblies, this.importedNamespacesItem);
            }
        }
        public IExpressionEditorInstance CreateExpressionEditor(AssemblyContextControlItem assemblies, ImportedNamespaceContextItem importedNamespaces, List <ModelItem> variables, string text, Type expressionType, Size initialSize)
        {
            UpdateContext(assemblies, importedNamespaces);
            var editor = new RoslynExpressionEditorInstance(initialSize);

            editor.UpdateInstance(variables, text, importedNamespaces);

            //生成命名空间树
            editor.m_namespaceNodeRoot = AddNamespacesToAutoCompletionList(EditorUtil.autoCompletionTree, importedNamespaces);

            return(editor);
        }
Пример #10
0
 internal void OnReferenceUpdated(AssemblyName updatedReference, bool isAdded)
 {
     if (this.availableNamespaces != null)
     {
         IMultiTargetingSupportService multiTargetingService = this.Context.Services.GetService <IMultiTargetingSupportService>();
         Assembly assembly = AssemblyContextControlItem.GetAssembly(updatedReference, multiTargetingService);
         Fx.Assert(assembly != null, "Assembly shouldn't be null here.");
         // In normal case, assembly shouldn't be null. In case there's any situation we're overlooked, we should ignore instead of throwing exceptions.
         if (assembly != null)
         {
             OnReferenceUpdated(assembly, isAdded);
         }
     }
 }
Пример #11
0
        private IExpressionEditorInstance CreateExpressionEditorPrivate(AssemblyContextControlItem assemblies, ImportedNamespaceContextItem importedNamespaces, System.Collections.Generic.List <ModelItem> variables, string text, System.Type expressionType, System.Windows.Size initialSize)
        {
            EditorInstance editor = new EditorInstance
            {
                IntellisenseList = this.CreateUpdatedIntellisense(variables),
                HighlightWords   = this.EditorKeyWord,
                ExpressionType   = expressionType,
                Guid             = Guid.NewGuid(),
                Text             = text,
            };

            editor.LostAggregateFocus += LostFocus;

            editorInstances.Add(editor.Guid.ToString(), editor);
            return(editor);
        }
Пример #12
0
        /// <summary>
        /// Creates a new expression editor using the specified assemblies, imported namespaces, variables, expression text, expression type, and the initial size.
        /// </summary>
        /// <returns>
        /// A new instance of the <see cref="T:System.Activities.Presentation.View.IExpressionEditorInstance"/>.
        /// </returns>
        /// <param name="assemblies">The local and referenced assemblies in the environment.</param><param name="importedNamespaces">The imported namespaces used by the expression editor.</param><param name="variables">Local variables for the expression editor.</param><param name="text">A string used to populate the expression editor.</param><param name="expressionType">The type of the expression.</param><param name="initialSize">The initial height and width of the expression editor control.</param>
        public IExpressionEditorInstance CreateExpressionEditor(AssemblyContextControlItem assemblies, ImportedNamespaceContextItem importedNamespaces, List <ModelItem> variables, string text, Type expressionType, Size initialSize)
        {
            var instance = new EditorInstance
            {
                IntellisenseData   = this.CreateUpdatedIntellisense(variables),
                ImportedNamespaces = importedNamespaces.ImportedNamespaces.ToList(),
                HighlightWords     = vbKeywords,
                ExpressionType     = expressionType,
                Guid = Guid.NewGuid(),
                Text = text
            };

            instance.LostAggregateFocus += this.LostFocus;
            this._editorInstances.Add(instance.Guid.ToString(), instance);
            return(instance);
        }
        /// <summary>
        /// Launch the user interface for developer to pick a contract type.
        /// </summary>
        /// <param name="localAssemblyName">The local assembly name.</param>
        /// <param name="referencedAssemblies">The list of referenced assembly names.</param>
        /// <param name="editingContext">The editing context.</param>
        /// <returns>The contract type selected by user or null if user cancels.</returns>
        public static Type SelectContractType(AssemblyName localAssemblyName, IList <AssemblyName> referencedAssemblies, EditingContext editingContext)
        {
            AssemblyContextControlItem assemblyContextControlItem = new AssemblyContextControlItem {
                LocalAssemblyName = localAssemblyName, ReferencedAssemblyNames = referencedAssemblies
            };
            TypeBrowser typeBrowser  = new TypeBrowser(assemblyContextControlItem, editingContext, FilterFunction);
            bool?       dialogResult = typeBrowser.ShowDialog(/* owner = */ null);

            if (dialogResult.HasValue && dialogResult.Value)
            {
                return(typeBrowser.ConcreteType);
            }
            else
            {
                return(null);
            }
        }
        public void UpdateContext(AssemblyContextControlItem assemblies, ImportedNamespaceContextItem importedNamespaces)
        {
            var references = new List <MetadataReference>();

            foreach (var assembly in assemblies.AllAssemblyNamesInContext)
            {
                try
                {
                    references.Add(MetadataReference.CreateFromFile(System.Reflection.Assembly.Load(assembly).Location));
                }
                catch { }
            }

            baseAssemblies = references.ToArray();

            usingNamespaces = string.Join("", importedNamespaces.ImportedNamespaces.Select(ns => "using " + ns + ";\n").ToArray());
        }
Пример #15
0
        private IExpressionEditorInstance CreateExpressionEditorPrivate(AssemblyContextControlItem assemblies,
                                                                        ImportedNamespaceContextItem importedNamespaces, IEnumerable <ModelItem> variables
                                                                        , string text, System.Type expressionType, Size?initialSize)
        {
            var editor = new EditorInstance()
            {
                IntellisenceList = this.CreateUpdatedIntellisense(variables),
                HighlightWords   = this.EditorKeyWord,
                ExpressionType   = expressionType,
                Guid             = Guid.NewGuid(),
                Text             = text ?? ""
            };

            editor.LostAggregateFocus += LostFocus;



            editorInstances.Add(editor.Guid.ToString(), editor);
            return(editor);
        }
Пример #16
0
        public TypeBrowser(AssemblyContextControlItem assemblyContext, EditingContext context, Func <Type, bool> filter)
        {
            this.assemblyContext = assemblyContext;
            this.Context         = context;
            this.filter          = filter;
            SetValue(GenericTypeMappingProperty, new ObservableCollection <TypeKeyValue>());
            GenericTypeMapping.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(GenericTypeMappingCollectionChanged);
            InitializeComponent();
            this.typeEntryTextBox.Focus();

            if (!size.IsEmpty)
            {
                this.Height = size.Height;
                this.Width  = size.Width;
            }

            this.SizeChanged += new SizeChangedEventHandler(TypeBrowser_SizeChanged);

            this.HelpKeyword       = HelpKeywords.TypeBrowser;
            this.perfEventProvider = new DesignerPerfEventProvider();
        }
Пример #17
0
        //When assemblyContextItem is null, it means the assembly cannot be local assembly
        private void UpdateAvailableNamespaces(Assembly assembly, AssemblyContextControlItem assemblyContextItem)
        {
            string assemblyName             = assembly.GetName().Name;
            IEnumerable <string> namespaces = this.GetUniqueNamespacesInAssembly(assembly, assemblyContextItem);

            foreach (string ns in namespaces)
            {
                if (!string.IsNullOrEmpty(ns))
                {
                    List <string> assemblyList;
                    if (!this.availableNamespaces.TryGetValue(ns, out assemblyList))
                    {
                        assemblyList = new List <string> {
                            assemblyName
                        };
                        this.availableNamespaces.Add(ns, assemblyList);
                    }
                    else if (!assemblyList.Contains(assemblyName))
                    {
                        assemblyList.Add(assemblyName);
                    }
                }
            }
        }
Пример #18
0
        private void AddDynamicAssembly(Assembly asm)
        {
            AssemblyContextControlItem acci = (AssemblyContextControlItem)(_WorkflowDesigner.Context.Items.GetValue(typeof(AssemblyContextControlItem)));
            var root     = GetRootElement();
            var fullname = asm.FullName;

            if (null == root)
            {
                return;
            }
            VisualBasicSettings vbs = VisualBasic.GetSettings(root) ?? new VisualBasicSettings();

            var namespaces = (from type in asm.GetTypes() select type.Namespace).Distinct();

            foreach (var name in namespaces)
            {
                var import = new VisualBasicImportReference()
                {
                    Assembly = fullname, Import = name
                };
                vbs.ImportReferences.Add(import);
            }
            VisualBasic.SetSettings(root, vbs);
        }
        private void OnEditorLoaded(object sender, RoutedEventArgs e)
        {
            if (!IsEditorLoaded)
            {
                // If the service exists, create an expression editor and add it to the grid - else switch to the textbox data template
                if (ExpressionEditorService1 != null)
                {
                    Border border = (Border)sender;
                    // Get the references and variables in scope
                    AssemblyContextControlItem assemblies        = (AssemblyContextControlItem)Context.Items.GetValue(typeof(AssemblyContextControlItem));
                    List <ModelItem>           declaredVariables = CSharpExpressionHelper.GetVariablesInScope(OwnerActivity);

                    ImportedNamespaceContextItem importedNamespaces = Context.Items.GetValue <ImportedNamespaceContextItem>();
                    importedNamespaces.EnsureInitialized(Context);
                    //if the expression text is empty and the expression type is set, then we initialize the text to prompt text
                    if (string.Equals(Text, string.Empty, StringComparison.OrdinalIgnoreCase) && ExpressionType != null)
                    {
                        Text = TypeToPromptTextConverter.GetPromptText(ExpressionType);
                    }

                    //this is a hack
                    BlockWidth = Math.Max(ActualWidth - 8, 0);  //8 is the margin
                    if (HasErrors)
                    {
                        BlockWidth = Math.Max(BlockWidth - 16, 0); //give 16 for error icon
                    }
                    try
                    {
                        if (ExpressionType != null)
                        {
                            ExpressionEditorInstance = ExpressionEditorService1.CreateExpressionEditor(assemblies, importedNamespaces, declaredVariables, Text, ExpressionType, new Size(BlockWidth, BlockHeight));
                        }
                        else
                        {
                            ExpressionEditorInstance = ExpressionEditorService1.CreateExpressionEditor(assemblies, importedNamespaces, declaredVariables, Text, new Size(BlockWidth, BlockHeight));
                        }
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }

                    if (ExpressionEditorInstance != null)
                    {
                        try
                        {
                            ExpressionEditorInstance.VerticalScrollBarVisibility   = VerticalScrollBarVisibility;
                            ExpressionEditorInstance.HorizontalScrollBarVisibility = HorizontalScrollBarVisibility;

                            ExpressionEditorInstance.AcceptsReturn = AcceptsReturn;
                            ExpressionEditorInstance.AcceptsTab    = AcceptsTab;

                            // Add the expression editor to the text panel, at column 1
                            HostControl = ExpressionEditorInstance.HostControl;

                            // Subscribe to this event to change scrollbar visibility on the fly for auto, and to resize the hostable editor
                            // as necessary
                            ExpressionEditorInstance.LostAggregateFocus += new EventHandler(OnEditorLostAggregateFocus);
                            ExpressionEditorInstance.Closing            += new EventHandler(OnEditorClosing);

                            // Set up Hostable Editor properties
                            ExpressionEditorInstance.MinLines = MinLines;
                            ExpressionEditorInstance.MaxLines = MaxLines;

                            ExpressionEditorInstance.HostControl.Style = (Style)FindResource("editorStyle");

                            border.Child = HostControl;
                            ExpressionEditorInstance.Focus();
                        }
                        catch (KeyNotFoundException ex)
                        {
                            new ApplicationException("Unable to find editor with the following editor name: " + EditorName);
                        }
                    }
                }
                IsEditorLoaded = true;
            }
        }
Пример #20
0
        internal static void ConvertToVBSettings(IList <string> importedNamespaces, IList <AssemblyReference> references, EditingContext context, out VisualBasicSettings settings)
        {
            Dictionary <string, List <string> > visualBasicImports = new Dictionary <string, List <string> >();

            foreach (string importedNamespace in importedNamespaces)
            {
                visualBasicImports.Add(importedNamespace, new List <string>());
            }

            Collection <Assembly>         assemblies            = new Collection <Assembly>();
            IMultiTargetingSupportService multiTargetingService = context.Services.GetService <IMultiTargetingSupportService>();

            foreach (AssemblyReference reference in references)
            {
                Assembly assembly;
                if (multiTargetingService == null)
                {
                    reference.LoadAssembly();
                    assembly = reference.Assembly;
                }
                else
                {
                    assembly = AssemblyContextControlItem.GetAssembly(reference.AssemblyName, multiTargetingService);
                }

                if (assembly != null)
                {
                    assemblies.Add(assembly);
                }
            }

            AssemblyContextControlItem assemblyContextItem = context.Items.GetValue <AssemblyContextControlItem>();
            AssemblyName localAssembly = null;

            if (assemblyContextItem != null)
            {
                localAssembly = assemblyContextItem.LocalAssemblyName;
            }

            if (localAssembly != null)
            {
                Assembly assembly = AssemblyContextControlItem.GetAssembly(localAssembly, multiTargetingService);
                if (assembly != null)
                {
                    assemblies.Add(assembly);
                }
            }

            foreach (Assembly assembly in assemblies)
            {
                foreach (Type type in assembly.GetTypes())
                {
                    string ns = type.Namespace;
                    if ((ns != null) && visualBasicImports.ContainsKey(ns))
                    {
                        string assemblyName = assembly.GetName().Name;
                        visualBasicImports[ns].Add(assemblyName);
                    }
                }
            }

            settings = new VisualBasicSettings();
            foreach (KeyValuePair <string, List <string> > entries in visualBasicImports)
            {
                string importedNamespace = entries.Key;
                foreach (string assemblyName in entries.Value)
                {
                    settings.ImportReferences.Add(new VisualBasicImportReference
                    {
                        Import   = importedNamespace,
                        Assembly = assemblyName
                    });
                }
            }
        }
Пример #21
0
 public void UpdateContext(AssemblyContextControlItem assemblies, ImportedNamespaceContextItem importedNamespaces)
 {
     // throw new NotImplementedException();
 }
Пример #22
0
        public IExpressionEditorInstance CreateExpressionEditor(AssemblyContextControlItem assemblies, ImportedNamespaceContextItem importedNamespaces, List <ModelItem> variables, string text, Type expressionType, System.Windows.Size initialSize)
        {
            var instance = new ExpressionEditorInstance();

            return(instance);
        }
Пример #23
0
 public IExpressionEditorInstance CreateExpressionEditor(AssemblyContextControlItem assemblies, ImportedNamespaceContextItem importedNamespaces, List <ModelItem> variables, string text, Size initialSize)
 {
     return(CreateEditor(importedNamespaces, variables, text, null, initialSize));
 }
Пример #24
0
 /// <summary>
 /// Creates a new expression editor.
 /// </summary>
 /// <returns>
 /// Returns a<see cref="T:System.Activities.Presentation.View.IExpressionEditorInstance"/>.
 /// </returns>
 /// <param name="assemblies">Used to set the context for the editor session.</param><param name="importedNamespaces">The imported namespaces to be used by the expression editor.</param><param name="variables">Local variables for the expression editor.</param><param name="text">A string used to populate the expression editor.</param>
 public IExpressionEditorInstance CreateExpressionEditor(AssemblyContextControlItem assemblies, ImportedNamespaceContextItem importedNamespaces, List <ModelItem> variables, string text)
 {
     return(this.CreateExpressionEditor(assemblies, importedNamespaces, variables, text, null, new Size()));
 }
Пример #25
0
 public IExpressionEditorInstance CreateExpressionEditor(AssemblyContextControlItem assemblies, ImportedNamespaceContextItem importedNamespaces, System.Collections.Generic.List <ModelItem> variables, string text, System.Windows.Size initialSize)
 {
     return(CreateExpressionEditorPrivate(assemblies, importedNamespaces, variables, text, null, initialSize));
 }
        string GetLocalAssemblyName()
        {
            AssemblyContextControlItem assemblyItem = this.Context.Items.GetValue <AssemblyContextControlItem>();

            return(assemblyItem != null && assemblyItem.LocalAssemblyName != null ? assemblyItem.LocalAssemblyName.Name : null);
        }
Пример #27
0
 public IExpressionEditorInstance CreateExpressionEditor(AssemblyContextControlItem assemblies, ImportedNamespaceContextItem importedNamespaces, List <ModelItem> variables, string text, Type expressionType)
 {
     return(CreateEditor(importedNamespaces, variables, text, expressionType, Size.Empty));
 }
Пример #28
0
        protected override XamlType GetXamlType(string xamlNamespace, string name, params XamlType[] typeArguments)
        {
            if (!string.IsNullOrEmpty(this.localAssemblyNsPostfix) &&
                IsClrNamespaceWithNoAssembly(xamlNamespace))
            {
                xamlNamespace = AddLocalAssembly(xamlNamespace);
            }

            var xamlType = base.GetXamlType(xamlNamespace, name, typeArguments);

            if (xamlType == null && environmentAssembliesLoaded == false && editingContext != null)
            {
                // Failed to find the type, this might because the namespace is a custom namespace
                //  and the dependent assembly hasn't been loaded yet. Load all dependent assemblies
                //  and try to load the same xaml type again.
                AssemblyContextControlItem assemblyItem = this.editingContext.Items.GetValue <AssemblyContextControlItem>();
                var environmentAssemblies = assemblyItem.GetEnvironmentAssemblies(null);
                if (assemblyItem.LocalAssemblyName != null)
                {
                    AssemblyContextControlItem.GetAssembly(assemblyItem.LocalAssemblyName, null);
                }

                environmentAssembliesLoaded = true;
                xamlType = base.GetXamlType(xamlNamespace, name, typeArguments);
            }

            if (xamlType == null || xamlType.UnderlyingType == null || this.editingContext == null)
            {
                return(xamlType);
            }

            MultiTargetingSupportService multiTargetingService = editingContext.Services.GetService <IMultiTargetingSupportService>() as MultiTargetingSupportService;
            DesignerConfigurationService config = editingContext.Services.GetService <DesignerConfigurationService>();

            if (multiTargetingService == null || config == null)
            {
                return(xamlType);
            }

            // do not filter out new types and new properties if targeting to current framework and it's a full SKU
            if (config.TargetFrameworkName.Version == CurrentFramework.Version && config.TargetFrameworkName.IsFullProfile())
            {
                return(xamlType);
            }

            // Filter out new types and new properties
            if (this.resolverCache == null)
            {
                this.resolverCache = new ResolverCache();
            }

            if (supportedTypes.Contains(xamlType.UnderlyingType))
            {
                return(xamlType);
            }

            // only check if conversion is needed when target framework is less than 4.5
            if (config.TargetFrameworkName.Version < CurrentFramework.Version)
            {
                if (conversionRequiredTypes.Contains(xamlType.UnderlyingType))
                {
                    this.ContainsConversionRequiredType = true;
                    return(xamlType);
                }
            }

            ResolverResult resolverResult = this.resolverCache.Lookup(xamlType.UnderlyingType);

            if (resolverResult == null)
            {
                resolverResult = MultiTargetingTypeResolver.Resolve(multiTargetingService, xamlType.UnderlyingType);
                this.resolverCache.Update(xamlType.UnderlyingType, resolverResult);
            }

            return(MultiTargetingTypeResolver.GetXamlType(resolverResult, xamlType));
        }
Пример #29
0
 public void UpdateContext(AssemblyContextControlItem assemblies, ImportedNamespaceContextItem importedNamespaces)
 {
 }
Пример #30
0
        public IExpressionEditorInstance CreateExpressionEditor(AssemblyContextControlItem assemblies, ImportedNamespaceContextItem importedNamespaces, List <ModelItem> variables, string text)
        {
            var instance = new ExpressionEditorInstance();

            return(instance);
        }