예제 #1
0
 public static void CheckIfPCHasMoreThan20GbAndPassesWMI(Computer pc)
 {
     if (pc.FreeSpace == "WMI Failed")
     {
         OfflineComputer offlinePCWmiFail = new OfflineComputer(pc.PCName);
         if (!offlineComputerList.Contains(offlinePCWmiFail))
         {
             offlinePCWmiFail.Reason = "WMI Failed, unable to get disk space";
             offlineComputerList.Add(offlinePCWmiFail);
         }
     }
     else
     {
         // free space check
         if (IsThereEnoughFreeSpace(pc))
         {
             if (!CheckIfPCExistsinOnlineComputerList(pc))
             {
                 pc.getCurrentVersion();
                 onlineComputerList.Add(pc);
             }
             ;
         }
         else
         {
             OfflineComputer offlinePCNoSpace = new OfflineComputer(pc.PCName);
             if (!offlineComputerList.Contains(offlinePCNoSpace))
             {
                 offlinePCNoSpace.Reason = "Less than 20GB avail";
                 offlineComputerList.Add(offlinePCNoSpace);
             }
         }
     }
 }
예제 #2
0
        //TODO: add this everywhere if it isn't already
        public static void moveToOfflineList(Computer tempPC, string reason, string lastLogResult)
        {
            OfflineComputer upgradeFailed = new OfflineComputer(tempPC.PCName, reason, lastLogResult);

            offlineComputerList.Add(upgradeFailed);
            if (onlineComputerList.Contains(tempPC))
            {
                onlineComputerList.Remove(tempPC);
            }
            updateDataGridSafeCall();
        }
예제 #3
0
        private async Task CheckPCListForStatus(List <Computer> pcList, bool showLabel)
        {
            await Task.Run(() =>
            {
                for (var i = 0; i < pcList.Count; i++)
                {
                    var pc = pcList[i];

                    if (showLabel)
                    {
                        updateStatusLabelSafe(pc.PCName);
                    }


                    pc.getOnlineStatus();
                    if (pc.OnlineStatus == "Online")
                    {
                        pc.getFreeSpace();
                        CheckIfPCHasMoreThan20GbAndPassesWMI(pc);
                    }
                    else
                    {
                        if (onlineComputerList.Contains(pc))
                        {
                            onlineComputerList.Remove(pc);
                        }
                        OfflineComputer offlinePC = new OfflineComputer(pc.PCName, "Offline");

                        if (!offlineComputerList.Contains(offlinePC))
                        {
                            offlineComputerList.Add(offlinePC);
                        }
                    }
                }
                initialComputerList.Clear();
            });
        }