コード例 #1
0
 public void RevokeInformer(WmiReadynessInformer obj, bool force = false)
 {
     if (!ContainsInformer(obj))
     {
         throw new ArgumentException("Informer with specified ApplicationName has not been published through this provider.");
     }
     try
     {
         if (obj.GetType().GetCustomAttributes(typeof(ManagementEntityAttribute), false).Any())
         {
             InstrumentationManager.Revoke(obj);
         }
         else
         {
             Instrumentation.Revoke(obj);
         }
     }
     catch (Exception ex)
     {
         if (!force)
         {
             throw ex;
         }
     }
     _pub.Remove(obj.ApplicationName);
 }
コード例 #2
0
 public void PublishInformer(WmiReadynessInformer obj)
 {
     if (ContainsInformer(obj))
     {
         throw new ArgumentException("This informer has already been already published.", "obj.ApplicationName = " + obj.ApplicationName);
     }
     if (obj.GetType().GetCustomAttributes(typeof(ManagementEntityAttribute), false).Any())
     {
         InstrumentationManager.Publish(obj);
     }
     else
     {
         Instrumentation.Publish(obj);
     }
     _inform.Add(obj.ApplicationName, obj);
 }
コード例 #3
0
 public bool ContainsInformer(WmiReadynessInformer informer)
 {
     return(_inform.ContainsKey(informer.ApplicationName));
 }