Exemple #1
0
        /// <summary>
        /// Installs an update. Shows an error message if the installation failed.
        /// </summary>
        /// <param name="manifest">The update manifest for of the update to install.</param>
        public async Task InstallUpdateAsync(UpdateManifest manifest)
        {
            var fileName = await _updateService.DownloadInstallerAsync(manifest);

            string error = null;

            if (fileName == null)
            {
                error = Strings.ErrorInstallerDownload;
            }
            else
            {
                var executeResult = _updateService.ExecuteInstaller(fileName);

                if (!executeResult)
                {
                    error = Strings.ErrorInstallerExecution;
                }
            }

            if (error != null)
            {
                _eventAggregator.GetEvent <MessageBoxEvent>().Publish(new MessageBoxEventArgs
                {
                    Title   = Strings.Error,
                    Message = error,
                    Type    = MessageBoxType.Error,
                    IsModal = true
                });
            }
        }