CxInstantiatorGenerator(
     CodegenConfiguration configuration,
     string headerFileName)
     : base(
         configuration: configuration,
         setCommentProperties: false,
         new CxStringifier(),
         headerFileName,
         false)
 {
 }
Пример #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(CodegenConfiguration configuration)
        {
            var generator = new CSharpInstantiatorGenerator(
                configuration: configuration,
                stringifier: new Stringifier());

            var csText = generator.GenerateCode();

            var assetList = generator.GetAssetsList();

            return(csText, assetList);
        }
Пример #3
0
 CSharpInstantiatorGenerator(
     CodegenConfiguration configuration,
     Stringifier stringifier)
     : base(
           configuration,
           setCommentProperties: false,
           stringifier: stringifier)
 {
     _s = stringifier;
     _interface = AnimatedVisualSourceInfo.InterfaceType.GetQualifiedName(stringifier);
     _sourceInterface = _interface + "Source";
 }
        /// <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);
        }
Пример #5
0
        CSharpInstantiatorGenerator(
            CodegenConfiguration configuration,
            Stringifier stringifier)
            : base(
                configuration,
                setCommentProperties: false,
                stringifier: stringifier)
        {
            _s               = stringifier;
            _interface       = AnimatedVisualSourceInfo.InterfaceType.GetQualifiedName(stringifier);
            _sourceInterface = _interface + "Source";
            _winUiNamespace  = AnimatedVisualSourceInfo.WinUi3 ? "Microsoft.UI" : "Windows.UI";

            // This is a hack that is required to use Win2D with WinUI3 as of August 2020. It
            // will not be necessary when an official Win2D for WinUI3 is released.
            _winUi3CastHack = AnimatedVisualSourceInfo.WinUi3 ? "(IGeometrySource2D)(object)" : string.Empty;
        }