Beispiel #1
0
        async void _installationManager_PackageInstallationCompleted(object sender, InstallationEventArgs e)
        {
            var installationInfo = e.InstallationInfo;

            foreach (var user in _userManager
                     .Users
                     .Where(i => i.Configuration.IsAdministrator)
                     .ToList())
            {
                var notification = new Notification
                {
                    UserId      = user.Id,
                    Category    = "PackageInstallationCompleted",
                    Name        = installationInfo.Name + " " + installationInfo.Version + " was installed",
                    RelatedId   = installationInfo.Name,
                    Description = e.PackageVersionInfo.description
                };

                try
                {
                    await _notificationsRepo.AddNotification(notification, CancellationToken.None).ConfigureAwait(false);
                }
                catch (Exception ex)
                {
                    _logger.ErrorException("Error adding notification", ex);
                }
            }
        }
Beispiel #2
0
        private void ExtractedInfoFile_Handler(object sender, EventArgs e)
        {
            InstallationEventArgs eArg = (InstallationEventArgs)e;

            if (appDataPath != "")
            {
                using (FileStream stream = File.Open(appDataPath, FileMode.Open))
                {
                    //Hier wird anschließend kontrolliert ob das Plugin und alle benötigten .dll Dateien bereits installiert sind
                }
            }
        }
Beispiel #3
0
        private void ProgressUpdated_Handler(object sender, EventArgs e)
        {
            InstallationEventArgs eArg = (InstallationEventArgs)e;

            InstallationProgress = (int)(10.0 * ((float)eArg.ActualEntryNumber / (float)eArg.EntrieCount));

            if (eArg.ActualEntryNumber == eArg.EntrieCount)
            {
                ProgressBarVisible    = false;
                InstallMessageVisible = true;
            }
        }
Beispiel #4
0
        /// <summary>
        /// Installs the package.
        /// </summary>
        /// <param name="package">The package.</param>
        /// <param name="progress">The progress.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>Task.</returns>
        /// <exception cref="System.ArgumentNullException">package</exception>
        public async Task InstallPackage(PackageVersionInfo package, IProgress <double> progress, CancellationToken cancellationToken)
        {
            if (package == null)
            {
                throw new ArgumentNullException("package");
            }

            if (progress == null)
            {
                throw new ArgumentNullException("progress");
            }

            var installationInfo = new InstallationInfo
            {
                Id           = Guid.NewGuid().ToString("N"),
                Name         = package.name,
                AssemblyGuid = package.guid,
                UpdateClass  = package.classification,
                Version      = package.versionStr
            };

            var innerCancellationTokenSource = new CancellationTokenSource();

            var tuple = new Tuple <InstallationInfo, CancellationTokenSource>(installationInfo, innerCancellationTokenSource);

            // Add it to the in-progress list
            lock (CurrentInstallations)
            {
                CurrentInstallations.Add(tuple);
            }

            var innerProgress = new ActionableProgress <double>();

            // Whenever the progress updates, update the outer progress object and InstallationInfo
            innerProgress.RegisterAction(percent =>
            {
                progress.Report(percent);

                installationInfo.PercentComplete = percent;
            });

            var linkedToken = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, innerCancellationTokenSource.Token).Token;

            var installationEventArgs = new InstallationEventArgs
            {
                InstallationInfo   = installationInfo,
                PackageVersionInfo = package
            };

            EventHelper.FireEventIfNotNull(PackageInstalling, this, installationEventArgs, _logger);

            try
            {
                await InstallPackageInternal(package, innerProgress, linkedToken).ConfigureAwait(false);

                lock (CurrentInstallations)
                {
                    CurrentInstallations.Remove(tuple);
                }

                progress.Report(100);

                CompletedInstallations.Add(installationInfo);

                EventHelper.FireEventIfNotNull(PackageInstallationCompleted, this, installationEventArgs, _logger);
            }
            catch (OperationCanceledException)
            {
                lock (CurrentInstallations)
                {
                    CurrentInstallations.Remove(tuple);
                }

                _logger.Info("Package installation cancelled: {0} {1}", package.name, package.versionStr);

                EventHelper.FireEventIfNotNull(PackageInstallationCancelled, this, installationEventArgs, _logger);

                throw;
            }
            catch (Exception ex)
            {
                _logger.ErrorException("Package installation failed", ex);

                lock (CurrentInstallations)
                {
                    CurrentInstallations.Remove(tuple);
                }

                EventHelper.FireEventIfNotNull(PackageInstallationFailed, this, new InstallationFailedEventArgs
                {
                    InstallationInfo = installationInfo,
                    Exception        = ex
                }, _logger);

                throw;
            }
            finally
            {
                // Dispose the progress object and remove the installation from the in-progress list
                innerProgress.Dispose();
                tuple.Item2.Dispose();
            }
        }
 void _installationManager_PackageInstallationCompleted(object sender, InstallationEventArgs e)
 {
     SendMessageToAdminSessions("PackageInstallationCompleted", e.InstallationInfo);
 }
Beispiel #6
0
 void _installationManager_PackageInstalling(object sender, InstallationEventArgs e)
 {
     _serverManager.SendWebSocketMessage("PackageInstalling", e.InstallationInfo);
 }
Beispiel #7
0
 void _installationManager_PackageInstalling(object sender, InstallationEventArgs e)
 {
     Dispatcher.InvokeAsync(UpdateInProgressInstallations);
 }
Beispiel #8
0
 private async void OnPackageInstallationCompleted(object sender, InstallationEventArgs e)
 {
     await SendMessageToAdminSessions("PackageInstallationCompleted", e.InstallationInfo).ConfigureAwait(false);
 }
Beispiel #9
0
 private void OnPackageInstallationCompleted(object sender, InstallationEventArgs e)
 {
     SendMessageToAdminSessions("PackageInstallationCompleted", e.InstallationInfo);
 }