ModuleCatalog that allows the downloading of all modules dynamically based on the ModuleInfo.Ref property.
Inheritance: ModuleCatalog, IDownloadingModuleCatalog
Ejemplo n.º 1
0
        /// <summary>
        /// Creates a <see cref="ModuleCatalog"/> from a XAML that is located on the internet. This method creates the
        /// <see cref="ModuleCatalog"/> asynchronously.
        /// </summary>
        /// <param name="builderResourceUri">The builder resource URI.</param>
        /// <param name="completedCallback">The completed callback, can be <c>null</c>.</param>
        /// <returns>
        /// An empty instance of <see cref="ModuleCatalog"/>, will be populated as soon as the download is complete.
        /// </returns>
        /// <exception cref="ArgumentNullException">The <paramref name="builderResourceUri"/> is <c>null</c>.</exception>
        public static DownloadingModuleCatalog CreateFromXamlAsync(Uri builderResourceUri, Action <ModuleCatalog> completedCallback = null)
        {
            Argument.IsNotNull("builderResourceUri", builderResourceUri);

            Log.Debug("Downloading file '{0}'", builderResourceUri);

            var moduleCatalog = new DownloadingModuleCatalog();

            var webClient = new WebClient();

            webClient.DownloadStringCompleted += OnModuleCatalogXmlCompleted;
            webClient.DownloadStringAsync(builderResourceUri, new Tuple <ModuleCatalog, Action <ModuleCatalog> >(moduleCatalog, completedCallback));

            return(moduleCatalog);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a <see cref="ModuleCatalog"/> from a XAML that is located on the internet. This method creates the
        /// <see cref="ModuleCatalog"/> asynchronously.
        /// </summary>
        /// <param name="builderResourceUri">The builder resource URI.</param>
        /// <param name="completedCallback">The completed callback, can be <c>null</c>.</param>
        /// <returns>
        /// An empty instance of <see cref="ModuleCatalog"/>, will be populated as soon as the download is complete.
        /// </returns>
        /// <exception cref="ArgumentNullException">The <paramref name="builderResourceUri"/> is <c>null</c>.</exception>
        public static DownloadingModuleCatalog CreateFromXamlAsync(Uri builderResourceUri, Action<ModuleCatalog> completedCallback = null)
        {
            Argument.IsNotNull("builderResourceUri", builderResourceUri);

            Log.Debug("Downloading file '{0}'", builderResourceUri);

            var moduleCatalog = new DownloadingModuleCatalog();

            var webClient = new WebClient();
            webClient.DownloadStringCompleted += OnModuleCatalogXmlCompleted;
            webClient.DownloadStringAsync(builderResourceUri, new Tuple<ModuleCatalog, Action<ModuleCatalog>>(moduleCatalog, completedCallback));

            return moduleCatalog;
        }