Exemplo n.º 1
0
 public BindingModeResolver(
     Lazy <IReadOnlyDictionary <string, IReadOnlyCollection <string> > > defaultOneWayBindingProperties,
     CodeAnalyzer codeAnalyzer,
     XamlPlatform xamlPlatform)
 {
     this.defaultOneWayBindingProperties = defaultOneWayBindingProperties;
     this.codeAnalyzer = codeAnalyzer;
     this.xamlPlatform = xamlPlatform;
 }
Exemplo n.º 2
0
        /// <summary>Initializes a new instance of the <see cref="XamlPlatformInfo"/> class.</summary>
        /// <param name="xamlPlatform">The xaml platform.</param>
        /// <param name="presentationNamespace">The presentation namespace.</param>
        /// <param name="sundewXamlOptimizationsNamespace">The sundew xaml optimizations namespace.</param>
        public XamlPlatformInfo(
            XamlPlatform xamlPlatform,
            XNamespace presentationNamespace,
            XNamespace sundewXamlOptimizationsNamespace)
        {
            this.XamlPlatform                     = xamlPlatform;
            this.PresentationNamespace            = presentationNamespace;
            this.SundewXamlOptimizationsNamespace = sundewXamlOptimizationsNamespace;
            var xmlNamespaceManager = new XmlNamespaceManager(new NameTable());

            xmlNamespaceManager.AddNamespace(Constants.SystemPrefix, presentationNamespace.NamespaceName);
            xmlNamespaceManager.AddNamespace(Constants.XamlPrefix, Constants.XamlNamespace.NamespaceName);
            xmlNamespaceManager.AddNamespace(Constants.MarkupCompatibilityPrefix, Constants.MarkupCompatibilityNamespace.NamespaceName);
            xmlNamespaceManager.AddNamespace(Constants.DesignerPrefix, Constants.DesignerNamespace.NamespaceName);
            this.XmlNamespaceResolver         = xmlNamespaceManager;
            this.SystemResourceDictionaryName = this.PresentationNamespace + Constants.ResourceDictionaryText;
        }
        /// <summary>Gets a <see cref="XamlPlatformInfo"/> based on the specified <see cref="XamlPlatform"/>.</summary>
        /// <param name="xamlPlatform">The xaml platform.</param>
        /// <returns>The xaml platform info.</returns>
        /// <exception cref="ArgumentOutOfRangeException">xamlPlatform - The specified value: {xamlPlatform}.</exception>
        public static XamlPlatformInfo GetXamlPlatformInfo(XamlPlatform xamlPlatform)
        {
            switch (xamlPlatform)
            {
            case XamlPlatform.WPF:
                return(WpfXamlPlatformInfo);

            case XamlPlatform.UWP:
                return(UwpXamlPlatformInfo);

            case XamlPlatform.XF:
                return(XfXamlPlatformInfo);

            default:
                throw new ArgumentOutOfRangeException(nameof(xamlPlatform), xamlPlatform, $"The specified value: {xamlPlatform} is not supported");
            }
        }
Exemplo n.º 4
0
        private IReadOnlyList <IAssemblyReference> GetAssemblyReferences(XamlPlatform xamlPlatform)
        {
            if (xamlPlatform == XamlPlatform.WPF)
            {
                return(new[]
                {
                    typeof(int).Assembly.Location,
                    typeof(DependencyObject).Assembly.Location,
                    typeof(FrameworkElement).Assembly.Location,
                    typeof(ICommand).Assembly.Location,
                    typeof(sx::Sundew.Xaml.Optimizations.Bindings.BindingConnection).Assembly.Location,
                }.Select(
                           x =>
                {
                    var assemblyReference = Substitute.For <IAssemblyReference>();
                    assemblyReference.Path.Returns(x);
                    return assemblyReference;
                }).ToList());
            }

            throw new NotSupportedException("Currently only WPF is supported.");
        }