Exemple #1
0
        private void ActivationsControl_Load(object sender, EventArgs e)
        {
            InstallOperation operation = this.Form.Operation;

            ActivationReporter.ReportActivationsToList(operation, ActivationsList);
            ActivationCount.Text = ActivationsList.Items.Count.ToString() + " Instances";
        }
Exemple #2
0
        public static void ReportActivationsToList(InstallOperation operation, ListView list)
        {
            ActivationReporter reporter = new ActivationReporter(operation, list);

            reporter.ReportActivations();
            return;
        }
Exemple #3
0
        private void DoWebAppActivations()
        {
            string method = string.Format(CommonUIStrings.deactivateWebAppFeatureMessage
                                          , requestedLocs.WebAppFeatures.Count, requestedLocs.WebAppLocations.Count);

            if (direction == ActivationDirection.Activate)
            {
                method = string.Format(CommonUIStrings.activateWebAppFeatureMessage
                                       , requestedLocs.WebAppFeatures.Count, requestedLocs.WebAppLocations.Count);
            }

            string context = method;

            log.Info(context);
            try
            {
                foreach (FeatureLoc floc in requestedLocs.WebAppLocations)
                {
                    FeatureLoc       completedLoc = FeatureLoc.CopyExceptFeatureList(floc);
                    SPWebApplication webapp       = ActivationReporter.GetWebAppById(floc.WebAppId);
                    string           webappName   = ActivationReporter.GetWebAppName(webapp);

                    foreach (Guid featureId in floc.featureList)
                    {
                        context = method + " feature: " + featureId.ToString();

                        if (direction == ActivationDirection.Activate)
                        {
                            if (IsFeatureActivatedOnWebApp(webapp, featureId))
                            {
                                string msg = string.Format(CommonUIStrings.ActivatingSkipped_FeatureAlreadyActiveOnWebApp
                                                           , GetFeatureName(featureId), webappName);
                                log.Warn(msg);
                            }
                            else
                            {
                                ActivateOneFeature(webapp.Features, featureId, log);

                                if (!IsFeatureActivatedOnWebApp(webapp, featureId))
                                {
                                    // do not add to completedLocs, b/c it didn't complete
                                    log.Warn("Activation failed on webapp : " + GetFeatureName(featureId));
                                }
                                else
                                {
                                    AddFeatureIdToFeatureLoc(completedLoc, featureId);
                                    log.Info(context + " : " + GetFeatureName(featureId));
                                }
                            }
                        }
                        else
                        {
                            if (IsFeatureActivatedOnWebApp(webapp, featureId))
                            {
                                webapp.Features.Remove(featureId, true);
                                AddFeatureIdToFeatureLoc(completedLoc, featureId);
                                log.Info(context + " : " + GetFeatureName(featureId));
                            }
                            else
                            {
                                string msg = string.Format(CommonUIStrings.DeactivatingSkipped_FeatureAlreadyActiveOnWebApp
                                                           , GetFeatureName(featureId), webappName);
                                log.Warn(msg);
                            }
                        }
                    }
                    if (completedLoc.featureList != null)
                    {
                        completedLocs.AddFeatureLocation(completedLoc);
                    }
                }
            }
            catch (Exception exc)
            {
                log.Error(context, exc);
                throw exc;
            }
        }
 public static void ReportActivationsToList(InstallOperation operation, ListView list)
 {
     ActivationReporter reporter = new ActivationReporter(operation, list);
     reporter.ReportActivations();
     return;
 }