private void installationManager_PreUpdatePlugin(object sender, PluginInfrastructureCancelEventArgs e) {
   if (e.Plugins.Count() > 0) {
     e.Cancel = (bool)Invoke((Func<IEnumerable<IPluginDescription>, bool>)ConfirmUpdateAction, e.Plugins) == false;
   }
 }
 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");
     }
 }
Esempio n. 3
0
 /// <summary>
 ///  Installs plugins from remote server
 /// </summary>
 /// <param name="plugins"></param>
 public void Install(IEnumerable<IPluginDescription> plugins, out bool cancelled) {
   var args = new PluginInfrastructureCancelEventArgs(plugins);
   OnPreInstall(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);
         OnInstalled(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;
   }
 }
Esempio n. 4
0
 private void OnPreInstall(PluginInfrastructureCancelEventArgs args) {
   if (PreInstallPlugin != null) PreInstallPlugin(this, args);
 }
Esempio n. 5
0
 private void OnPreDelete(PluginInfrastructureCancelEventArgs args) {
   if (PreRemovePlugin != null) PreRemovePlugin(this, args);
 }
Esempio n. 6
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));
     }
   }
 }