private async Task GetResourceHostNameTask(RemoteMachineModel model)
 {
     if (model.IsOnNetwork)
     {
         await model.GetHostNameAsync();
     }
 }
        private async Task FindResourceHostNamesTask(RemoteMachineModel model)
        {
            await model.CheckIsOnNetworkTask();

            if (model.IsOnNetwork)
            {
                await model.GetHostNameAsync();

                deviceCount++;
            }

            scansRemaining -= 1;
            ScanProgress    = Convert.ToInt32(Math.Round(((255 - scansRemaining) / 255) * 100));
        }
        public async void StartAudit()
        {
            AllNetworkResources = new List <RemoteMachineModel>();
            string localIPAddress = "";
            bool   connected      = false;

            deviceCount    = 0;
            scanProgress   = 0;
            scansRemaining = 255;

            CanBeginNetworkAudit = false;

            LocalMachineModel localobj = new LocalMachineModel();

            localIPAddress = localobj.LocalIPAddress;
            connected      = localobj.Connected;
            InternetSpeed  = localobj.InternetSpeed;

            CheckConnectionColor(connected);

            if (connected)
            {
                for (int i = 0; i < 255; i++)
                {
                    RemoteMachineModel myObj = new RemoteMachineModel(localIPAddress, i);
                    AllNetworkResources.Add(myObj);
                }

                await FindResourceHostNamesAsync(AllNetworkResources);
            }
            else
            {
                MessageBox.Show("Unable to scan. Network is unavailable.");
            }

            CanBeginNetworkAudit = true;
        }