Esempio n. 1
0
 private void OnOkClick(object sender, System.EventArgs e)
 {
     try
     {
         int current = 0;
         // Enable/Disable as appropriate.
         foreach (ListViewItem item in changed)
         {
             Config.Manifest.GuidancePackage Package = (Config.Manifest.GuidancePackage)item.Tag;
             if (item.Checked)
             {
                 // Only enable if it wasn't previously enabled.
                 if (base.RecipeManagerService.GetPackage(Package.Name) == null)
                 {
                     current++;
                     try
                     {
                         base.RecipeManagerService.EnablePackage(Package.Name);
                     }
                     catch (Exception exception)
                     {
                         // Just ask if it is necessary
                         bool   askForTheRest = ((changed.Count - current) > 0);
                         string message       = string.Format(
                             CultureInfo.CurrentCulture,
                             askForTheRest ? Configuration.Resources.PackageManager_CannotLoadPackageAsking :
                             Configuration.Resources.PackageManager_CannotLoadPackage,
                             Package.Caption);
                         DialogResult result = ErrorHelper.Show(this.Site, exception, message,
                                                                askForTheRest ? MessageBoxButtons.YesNo : MessageBoxButtons.OK);
                         if (askForTheRest && result == DialogResult.No)
                         {
                             break;
                         }
                     }
                 }
             }
             else
             {
                 base.RecipeManagerService.DisablePackage(Package.Name);
             }
         }
         this.Close();
     }
     catch (Exception ex)
     {
         ErrorHelper.Show(this.Site, ex);
     }
     finally
     {
         // Do not close if something went wrong.
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Initializes the form with a parent provider.
 /// </summary>
 /// <param name="provider"></param>
 /// <param name="Package"></param>
 public PackageViewer(IServiceProvider provider, Config.Manifest.GuidancePackage Package) : base(provider)
 {
     InitializeComponent();
     this.Package = Package;
 }