Пример #1
0
        internal static async Task <AnimatedVisualFactory?> LoadAsync(
            ImageAssetHandler?imageLoader,
            Uri uri,
            LottieVisualOptions options)
        {
            if (uri is null)
            {
                return(null);
            }

            var absoluteUri = Uris.GetAbsoluteUri(uri);

            if (absoluteUri.Scheme.StartsWith("ms-"))
            {
                // The URI is an application URI. Defer to the StorageFileLoader.
                return(await StorageFileLoader.LoadAsync(imageLoader, absoluteUri, options));
            }
            else
            {
                var loader = new UriLoader(imageLoader);

                return(await Loader.LoadAsync(
                           () => GetJsonStreamAsync(uri),
                           loader,
                           options));
            }
        }
Пример #2
0
        internal static async Task <AnimatedVisualFactory?> LoadAsync(
            ImageAssetHandler?imageLoader,
            StorageFile file,
            LottieVisualOptions options)
        {
            if (file is null)
            {
                return(null);
            }

            if (file.Name.EndsWith(".lottie", StringComparison.OrdinalIgnoreCase))
            {
                // It's a .lottie file. Defer to the DotLottieLoader.
                return(await DotLottieLoader.LoadAsync(file, options));
            }

            var loader = new StorageFileLoader(imageLoader, file);

            return(await Loader.LoadAsync(
                       loader.GetJsonStreamAsync,
                       loader,
                       options));
        }