private static VirtualizationServer GetVirtualizationProxy(int serviceId)
 {
     VirtualizationServer ws = new VirtualizationServer();
     ServiceProviderProxy.Init(ws, serviceId);
     return ws;
 }
        private static bool JobCompleted(VirtualizationServer vs, ConcreteJob job)
        {
            TaskManager.IndicatorMaximum = 100;
            bool jobCompleted = true;

            while (job.JobState == ConcreteJobState.Starting ||
                job.JobState == ConcreteJobState.Running)
            {
                System.Threading.Thread.Sleep(1000);
                job = vs.GetJob(job.Id);
                TaskManager.IndicatorCurrent = job.PercentComplete;
            }

            if (job.JobState != ConcreteJobState.Completed)
            {
                jobCompleted = false;
            }

            TaskManager.IndicatorCurrent = 0; // reset indicator

            return jobCompleted;
        }
 public static VirtualSwitch[] GetExternalSwitches(int serviceId, string computerName)
 {
     VirtualizationServer vs = new VirtualizationServer();
     ServiceProviderProxy.Init(vs, serviceId);
     return vs.GetExternalSwitches(computerName);
 }