Exemple #1
0
        /// <summary>
        /// Returns the Cx code for a factory that will instantiate the given <see cref="Visual"/> as a
        /// Windows.UI.Composition Visual.
        /// </summary>
        /// <returns>A value tuple containing the cpp code, header code, and list of referenced asset files.</returns>
        public static (string cppText, string hText, IEnumerable <Uri> assetList) CreateFactoryCode(
            string className,
            Visual rootVisual,
            float width,
            float height,
            TimeSpan duration,
            string headerFileName,
            bool disableFieldOptimization)
        {
            var generator = new CxInstantiatorGenerator(
                className: className,
                graphRoot: rootVisual,
                duration: duration,
                disableFieldOptimization: disableFieldOptimization,
                setCommentProperties: false,
                stringifier: new CppStringifier(),
                headerFileName: headerFileName);

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

            var hText = GenerateHeaderText(className);

            var assetList = generator.GetAssetsList();

            return(cppText, hText, assetList);
        }
        /// <summary>
        /// Returns the Cx code for a factory that will instantiate the given <see cref="Visual"/> as a
        /// Windows.UI.Composition Visual.
        /// </summary>
        /// <returns>A value tuple containing the cpp code, header code, and list of referenced asset files.</returns>
        public static (string cppText, string hText, IEnumerable <Uri> assetList) CreateFactoryCode(
            CodegenConfiguration configuration,
            string headerFileName)
        {
            var generator = new CxInstantiatorGenerator(
                configuration: configuration,
                headerFileName: headerFileName);

            var cppText = generator.GenerateCode();

            var hText = generator.GenerateHeaderText(generator.AnimatedVisualSourceInfo);

            var assetList = generator.GetAssetsList();

            return(cppText, hText, assetList);
        }