Exemplo n.º 1
0
        /// <summary>
        /// Returns the C# code for a factory that will instantiate the given <see cref="Visual"/> as a
        /// Windows.UI.Composition Visual.
        /// </summary>
        /// <returns>A tuple containing the C# code and list of referenced asset files.</returns>
        public static (string csText, IEnumerable <Uri> assetList) CreateFactoryCode(CodegenConfiguration configuration)
        {
            var generator = new CSharpInstantiatorGenerator(
                configuration: configuration,
                stringifier: new Stringifier());

            var csText = generator.GenerateCode();

            var assetList = generator.GetAssetsList();

            return(csText, assetList);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns the C# code for a factory that will instantiate the given <see cref="Visual"/> as a
        /// Windows.UI.Composition Visual.
        /// </summary>
        /// <returns>A tuple containing the C# code and list of referenced asset files.</returns>
        public static (string csText, IEnumerable <Uri> assetList) CreateFactoryCode(
            string className,
            Visual rootVisual,
            float width,
            float height,
            TimeSpan duration,
            bool disableFieldOptimization)
        {
            var generator = new CSharpInstantiatorGenerator(
                className: className,
                graphRoot: rootVisual,
                duration: duration,
                setCommentProperties: false,
                disableFieldOptimization: disableFieldOptimization,
                stringifier: new CSharpStringifier());

            var csText = generator.GenerateCode(className, width, height);

            var assetList = generator.GetAssetsList();

            return(csText, assetList);
        }