Exemple #1
0
 private void installationManager_PreRemovePlugin(object sender, PluginInfrastructureCancelEventArgs e)
 {
     if (e.Plugins.Count() > 0)
     {
         e.Cancel = (bool)Invoke((Func <IEnumerable <IPluginDescription>, bool>)ConfirmRemoveAction, e.Plugins) == false;
     }
 }
Exemple #2
0
 private void OnPreInstall(PluginInfrastructureCancelEventArgs args)
 {
     if (PreInstallPlugin != null)
     {
         PreInstallPlugin(this, args);
     }
 }
Exemple #3
0
 private void OnPreDelete(PluginInfrastructureCancelEventArgs args)
 {
     if (PreRemovePlugin != null)
     {
         PreRemovePlugin(this, args);
     }
 }
Exemple #4
0
 private void installationManager_PreInstallPlugin(object sender, PluginInfrastructureCancelEventArgs e)
 {
     if (e.Plugins.Count() > 0)
     {
         if ((bool)Invoke((Func <IEnumerable <IPluginDescription>, bool>)ConfirmInstallAction, e.Plugins) == true)
         {
             SetStatusStrip("Installing " + e.Plugins.Aggregate("", (a, b) => a.ToString() + "; " + b.ToString()));
             e.Cancel = false;
         }
         else
         {
             e.Cancel = true;
             SetStatusStrip("Install canceled");
         }
     }
 }
Exemple #5
0
        /// <summary>
        /// Deletes all plugin files from local installation
        /// </summary>
        /// <param name="plugins"></param>
        public void Remove(IEnumerable <IPluginDescription> plugins)
        {
            var fileNames = from pluginToDelete in plugins
                            from file in pluginToDelete.Files
                            select Path.Combine(pluginDir, file.Name);

            var args = new PluginInfrastructureCancelEventArgs(plugins);

            OnPreDelete(args);
            if (!args.Cancel)
            {
                foreach (string fileName in fileNames)
                {
                    File.Delete(fileName);
                    OnDeleted(new PluginInfrastructureEventArgs(fileName));
                }
            }
        }
Exemple #6
0
        /// <summary>
        /// Updates plugins from remote server
        /// </summary>
        /// <param name="plugins"></param>
        public void Update(IEnumerable <IPluginDescription> plugins, out bool cancelled)
        {
            PluginInfrastructureCancelEventArgs args = new PluginInfrastructureCancelEventArgs(plugins);

            OnPreUpdate(args);
            if (!args.Cancel)
            {
                cancelled = false;
                var client = DeploymentService.UpdateServiceClientFactory.CreateClient();
                try {
                    foreach (DeploymentService.PluginDescription plugin in plugins)
                    {
                        byte[] zippedPackage = client.GetPlugin(plugin);
                        Unpack(zippedPackage);
                        OnUpdated(new PluginInfrastructureEventArgs(plugin));
                    }
                    client.Close();
                }
                catch (TimeoutException e) {
                    client.Abort();
                    throw new InstallationManagerException("Time out while connecting to server.", e);
                }
                catch (FaultException e) {
                    client.Abort();
                    throw new InstallationManagerException("Fault in connection to server.", e);
                }
                catch (CommunicationException e) {
                    client.Abort();
                    throw new InstallationManagerException("General communication exception in connection to server.", e);
                }
            }
            else
            {
                cancelled = true;
            }
        }