private void BtnScan_Click(object sender, EventArgs e)
        {
            var device = GetSelectedDevice();

            LVMissing.ClearObjects();
            LVNew.ClearObjects();
            if (device != null)
            {
                if (CbxLocation.SelectedIndex == 0)                 //All
                {
                    for (int i = 1; i < CbxLocation.Items.Count; i++)
                    {
                        ScanLocation(CbxLocation.Items[i] as LocationBase, device);
                    }
                }
                else
                {
                    ScanLocation(CbxLocation.SelectedItem as LocationBase, device);
                }
                FindMoved();
            }
            LVNew.EmptyListMsg     = "No New Items Found";
            LVMissing.EmptyListMsg = "Nothing Missing";
            BtnApply.Enabled       = true;
        }
 private void ScanLocation(LocationBase location, Device device)
 {
     UpdateWaitStatus("Processing " + location.Name + " ...");
     try
     {
         if (location == null || device == null)
         {
             return;
         }
         m_rescanResults = RescanResults.Run(location.Id, device.Id);
         LVNew.AddObjects(m_rescanResults.NewFiles);
         LVMissing.AddObjects(m_rescanResults.MissingFiles);
         Application.DoEvents();
     }
     catch (Exception err)
     {
         MessageBox.Show(err.Message);
     }
 }
        private void BtnApply_Click(object sender, EventArgs e)
        {
            if (m_rescanResults == null)
            {
                return;
            }

            //Remove missing
            UpdateWaitStatus("Removing missing...");
            foreach (var mf in m_rescanResults.MissingFiles)
            {
                if (mf.ShouldDelete)
                {
                    mf.Delete();
                }
                else
                {
                    if (mf.NewLocationBaseId > 0 && !string.IsNullOrEmpty(mf.NewLocationData))
                    {
                        mf.SetNewLocation();
                    }
                }
            }
            LVMissing.ClearObjects();


            //Add new
            UpdateWaitStatus("Adding new...");
            foreach (var nf in m_rescanResults.NewFiles)
            {
                nf.Save();
            }
            LVNew.ClearObjects();

            m_rescanResults = null;

            UpdateWaitStatus(null);
        }