Beispiel #1
0
        /// <summary>
        /// Runs update checking. For each discovered module performs check for update. Uses <see cref="IDependencyChecker"/> to distinguish whether
        /// the module needs to be updated or not.
        /// </summary>
        /// <remarks>
        /// <para>
        ///     Method return result by <see cref="NomadAvailableUpdatesMessage"/> event, so it may be invoked asynchronously.
        /// </para>
        /// <para>
        ///     This methods does not throw any exception in case of failure, because the <see cref="Exception"/> derived classes
        /// cannot cross app domain boundaries. All information about failures are passed through <see cref="IEventAggregator"/> message bus.
        /// </para>
        /// </remarks>
        public void CheckUpdates()
        {
            Status = UpdaterStatus.Checking;

            AvailableModules availableModules;

            try
            {
                // connect to repository - fail safe
                availableModules = _modulesRepository.GetAvailableModules();
            }
            catch (Exception e)
            {
                InvokeErrorAvaliableMessage(e.Message);
                return;
            }

            // null handling in repository if repository does not throw
            if (availableModules == null)
            {
                InvokeErrorAvaliableMessage("Null from repository");
                return;
            }

            Status = UpdaterStatus.Checked;

            InvokeAvailableUpdates(new NomadAvailableUpdatesMessage(availableModules.Manifests));

            // if in automatic mode begin the download phase, use all the modules discovered as available
            if (Mode == UpdaterType.Automatic)
            {
                PrepareUpdate(new List <ModuleManifest>(availableModules.Manifests));
            }
        }