Пример #1
0
        /// <summary>
        /// Registers resources that classes will depend on
        /// </summary>
        /// <returns>Task.</returns>
        protected virtual Task RegisterResources()
        {
            return(Task.Run(() =>
            {
                RegisterSingleInstance(ConfigurationManager);
                RegisterSingleInstance <IApplicationHost>(this);

                RegisterSingleInstance <IApplicationPaths>(ApplicationPaths);

                TaskManager = new TaskManager(ApplicationPaths, JsonSerializer, Logger);

                RegisterSingleInstance(JsonSerializer);
                RegisterSingleInstance(XmlSerializer);

                RegisterSingleInstance(LogManager);
                RegisterSingleInstance(Logger);

                RegisterSingleInstance(TaskManager);

                HttpClient = new HttpClientManager.HttpClientManager(ApplicationPaths, Logger);
                RegisterSingleInstance(HttpClient);

                NetworkManager = new NetworkManager();
                RegisterSingleInstance(NetworkManager);

                SecurityManager = new PluginSecurityManager(this, HttpClient, JsonSerializer, ApplicationPaths);
                RegisterSingleInstance(SecurityManager);

                PackageManager = new PackageManager(SecurityManager, NetworkManager, HttpClient, ApplicationPaths, JsonSerializer, Logger);
                RegisterSingleInstance(PackageManager);

                InstallationManager = new InstallationManager(HttpClient, PackageManager, JsonSerializer, Logger, this);
                RegisterSingleInstance(InstallationManager);
            }));
        }
        /// <summary>
        /// Registers resources that classes will depend on
        /// </summary>
        /// <returns>Task.</returns>
        protected virtual Task RegisterResources(IProgress <double> progress)
        {
            return(Task.Run(() =>
            {
                RegisterSingleInstance(ConfigurationManager);
                RegisterSingleInstance <IApplicationHost>(this);

                RegisterSingleInstance <IApplicationPaths>(ApplicationPaths);

                TaskManager = new TaskManager(ApplicationPaths, JsonSerializer, Logger);

                RegisterSingleInstance(JsonSerializer);
                RegisterSingleInstance(XmlSerializer);

                RegisterSingleInstance(LogManager);
                RegisterSingleInstance(Logger);

                RegisterSingleInstance(TaskManager);

                FileSystemManager = CreateFileSystemManager();
                RegisterSingleInstance(FileSystemManager);

                HttpClient = new HttpClientManager.HttpClientManager(ApplicationPaths, Logger, FileSystemManager, ConfigurationManager);
                RegisterSingleInstance(HttpClient);

                NetworkManager = CreateNetworkManager();
                RegisterSingleInstance(NetworkManager);

                SecurityManager = new PluginSecurityManager(this, HttpClient, JsonSerializer, ApplicationPaths, NetworkManager, LogManager);
                RegisterSingleInstance(SecurityManager);

                InstallationManager = new InstallationManager(Logger, this, ApplicationPaths, HttpClient, JsonSerializer, SecurityManager, NetworkManager, ConfigurationManager);
                RegisterSingleInstance(InstallationManager);

                ZipClient = new ZipClient();
                RegisterSingleInstance(ZipClient);

                IsoManager = new IsoManager();
                RegisterSingleInstance(IsoManager);

                RegisterModules();
            }));
        }
        /// <summary>
        /// Registers resources that classes will depend on
        /// </summary>
        /// <returns>Task.</returns>
        protected virtual Task RegisterResources(IProgress <double> progress)
        {
            RegisterSingleInstance(ConfigurationManager);
            RegisterSingleInstance <IApplicationHost>(this);

            RegisterSingleInstance <IApplicationPaths>(ApplicationPaths);

            TaskManager = new TaskManager(ApplicationPaths, JsonSerializer, LogManager.GetLogger("TaskManager"), FileSystemManager);

            RegisterSingleInstance(JsonSerializer);
            RegisterSingleInstance(XmlSerializer);
            RegisterSingleInstance(MemoryStreamProvider);

            RegisterSingleInstance(LogManager);
            RegisterSingleInstance(Logger);

            RegisterSingleInstance(TaskManager);

            RegisterSingleInstance(FileSystemManager);

            HttpClient = new HttpClientManager.HttpClientManager(ApplicationPaths, LogManager.GetLogger("HttpClient"), FileSystemManager, MemoryStreamProvider);
            RegisterSingleInstance(HttpClient);

            NetworkManager = CreateNetworkManager(LogManager.GetLogger("NetworkManager"));
            RegisterSingleInstance(NetworkManager);

            SecurityManager = new PluginSecurityManager(this, HttpClient, JsonSerializer, ApplicationPaths, LogManager);
            RegisterSingleInstance(SecurityManager);

            InstallationManager = new InstallationManager(LogManager.GetLogger("InstallationManager"), this, ApplicationPaths, HttpClient, JsonSerializer, SecurityManager, ConfigurationManager, FileSystemManager);
            RegisterSingleInstance(InstallationManager);

            ZipClient = new ZipClient(FileSystemManager);
            RegisterSingleInstance(ZipClient);

            IsoManager = new IsoManager();
            RegisterSingleInstance(IsoManager);

            return(Task.FromResult(true));
        }
Пример #4
0
        /// <summary>
        /// Loads our registration information
        ///
        /// </summary>
        /// <returns></returns>
        public async Task LoadRegistrationInfoAsync()
        {
            Plugin.Instance.Registration = await PluginSecurityManager.GetRegistrationStatus("PodCasts").ConfigureAwait(false);

            Plugin.Logger.Debug("PodCasts Registration Status - Registered: {0} In trial: {2} Expiration Date: {1} Is Valid: {3}", Plugin.Instance.Registration.IsRegistered, Plugin.Instance.Registration.ExpirationDate, Plugin.Instance.Registration.TrialVersion, Plugin.Instance.Registration.IsValid);
        }