Server/MainForm.cs
changeset 152 03a1757a38df
parent 148 878904899ff0
child 153 95f253aaf588
     1.1 --- a/Server/MainForm.cs	Wed Sep 02 00:24:34 2015 +0200
     1.2 +++ b/Server/MainForm.cs	Wed Sep 02 12:54:07 2015 +0200
     1.3 @@ -126,6 +126,9 @@
     1.4  			//Populate device types
     1.5  			PopulateDeviceTypes();
     1.6  
     1.7 +            //Populate optical drives
     1.8 +            PopulateOpticalDrives();
     1.9 +
    1.10  			//Initial status update 
    1.11              UpdateStatus();
    1.12  
    1.13 @@ -484,6 +487,46 @@
    1.14  			}
    1.15  		}
    1.16  
    1.17 +        /// <summary>
    1.18 +        /// 
    1.19 +        /// </summary>
    1.20 +        private void PopulateOpticalDrives()
    1.21 +        {
    1.22 +            //Reset our list of drives
    1.23 +            comboBoxOpticalDrives.Items.Clear();
    1.24 +
    1.25 +            //Go through each drives on our system and collected the optical ones in our list
    1.26 +            DriveInfo[] allDrives = DriveInfo.GetDrives();
    1.27 +            foreach (DriveInfo d in allDrives)
    1.28 +            {
    1.29 +                Debug.WriteLine("Drive {0}", d.Name);
    1.30 +                Debug.WriteLine("  Drive type: {0}", d.DriveType);
    1.31 +
    1.32 +                if (d.DriveType==DriveType.CDRom)
    1.33 +                {
    1.34 +                    //This is an optical drive, add it now
    1.35 +                    comboBoxOpticalDrives.Items.Add(d.Name.Substring(0,2));
    1.36 +                }                
    1.37 +            }
    1.38 +
    1.39 +            //Select current drive to eject
    1.40 +            if (comboBoxOpticalDrives.Items.Count>0)
    1.41 +            {
    1.42 +                comboBoxOpticalDrives.SelectedIndex = 0;
    1.43 +            }            
    1.44 +        }
    1.45 +
    1.46 +        /// <summary>
    1.47 +        /// 
    1.48 +        /// </summary>
    1.49 +        /// <returns></returns>
    1.50 +        public string OpticalDriveToEject()
    1.51 +        {
    1.52 +            return comboBoxOpticalDrives.Items[comboBoxOpticalDrives.SelectedIndex].ToString();
    1.53 +        }
    1.54 +
    1.55 +
    1.56 +
    1.57  		/// <summary>
    1.58  		///
    1.59  		/// </summary>