Esempio n. 1
0
 void DisplayUpdates(Object sender, PropertyFilterUpdateEventArgs eArgs)
 {
    foreach(PropertyChange change in eArgs.FilterUpdate.objectSet[0].changeSet)
    {
       if(change.op == PropertyChangeOp.add || change.op == PropertyChangeOp.assign)
       {
          if("guest" == change.name) 
          {
             GuestInfo gi = (GuestInfo)change.val;
             System.Console.WriteLine("GuestInfo.state->{0}\tGuestInfo.toolsStatus->{1}",
                gi.guestState, gi.toolsStatusSpecified?gi.toolsStatus.ToString():"not-present");
          }
          else if("summary.quickStats" == change.name)
          {
             VirtualMachineQuickStats qs = (VirtualMachineQuickStats)change.val;
             System.Console.WriteLine("QuickStats.guestHeartbeatStatus->{0}\tQuickStats.overallCpuUsage->{1}",
                qs.guestHeartbeatStatus, qs.overallCpuUsage);
          }
          else if("summary.runtime.powerState" == change.name)
          {
             System.Console.WriteLine("PowerState->{0}", change.val);
          }
       }
    }
 }
 private void WaitForTaskHandler(object sender, PropertyFilterUpdateEventArgs args)
 {
     foreach (PropertyChange change in args.FilterUpdate.objectSet[0].changeSet)
     {
         System.Console.WriteLine("Change: name->{0}, op->{1}, val->{2}", change.name, change.op, change.val);
         if (change.name == "info.error")
         {
             if ((change.op == PropertyChangeOp.assign ||
                  change.op == PropertyChangeOp.add) &&
                 change.val != null)
             {
                 // Signal we are done...
                 _done.Set();
             }
         }
         else if (change.name == "info.state")
         {
             if (change.op == PropertyChangeOp.assign ||
                 change.op == PropertyChangeOp.add)
             {
                 TaskInfoState tis = (TaskInfoState)change.val;
                 if (tis != TaskInfoState.queued && tis != TaskInfoState.running)
                 {
                     // Signal we are done...
                     _done.Set();
                 }
             }
         }
     }
 }
 private void WaitForTaskHandler(object sender, PropertyFilterUpdateEventArgs args)
 {
     foreach (PropertyChange change in args.FilterUpdate.objectSet[0].changeSet)
     {
         System.Console.WriteLine("Change: name->{0}, op->{1}, val->{2}", change.name, change.op, change.val);
         if (change.name == "info.error")
         {
             if ((change.op == PropertyChangeOp.assign ||
                  change.op == PropertyChangeOp.add) &&
                  change.val != null)
             {
                 // Signal we are done...
                 _done.Set();
             }
         }
         else if (change.name == "info.state")
         {
             if (change.op == PropertyChangeOp.assign ||
                change.op == PropertyChangeOp.add)
             {
                 TaskInfoState tis = (TaskInfoState)change.val;
                 if (tis != TaskInfoState.queued && tis != TaskInfoState.running)
                 {
                     // Signal we are done...
                     _done.Set();
                 }
             }
         }
     }
 }