void devicesCombo_SelectedValueChanged(object sender, EventArgs e)
 {
     if (devicesCombo.SelectedIndex != -1)
     {
         saveCurrentMonitorToList();
         currentComboIndex = devicesCombo.SelectedIndex;
         resolutionSet newMonitor = (resolutionSet)devicesCombo.Items[devicesCombo.SelectedIndex];
         setDataIntoForm(newMonitor.width, newMonitor.height, newMonitor.refreshRate, newMonitor.active);
     }
 }
 void saveCurrentMonitorToList()
 {
     if (currentComboIndex != -1)
     {
         resolutionSet lastMonitor = (resolutionSet)devicesCombo.Items[currentComboIndex];
         if (lastMonitor != null)
         {
             lastMonitor.width       = int.Parse(primWidth.Text);
             lastMonitor.height      = int.Parse(primHeight.Text);
             lastMonitor.refreshRate = int.Parse(primRefresh.Text);
             lastMonitor.active      = activeChkBox.Checked;
         }
     }
 }
        static void getMonitorsAndResolutions()
        {
            allResolution.Clear();
            allResolution = Resolution.ScreenResolution.getDevices();

            String res = fixedResolutionSysTray.Properties.Settings.Default.resolutions;

            if (res == "x")
            {
                fixedResolutionSysTray.Program.appIsPaused = true;
            }
            else
            {
                String[] resArray = res.Split(';');
                foreach (String oneResString in resArray)
                {
                    String[] data     = oneResString.Split(',');
                    int      width    = 0;
                    int      height   = 0;
                    int      freq     = 0;
                    Boolean  active   = false;
                    int      deviceId = 0;

                    if (int.TryParse(data[0].ToString(), out width) &&
                        int.TryParse(data[1].ToString(), out height) &&
                        int.TryParse(data[2].ToString(), out freq) &&
                        Boolean.TryParse(data[3].ToString(), out active) &&
                        int.TryParse(data[4].ToString(), out deviceId))
                    {
                        resolutionSet device = fixedResolutionSysTray.Program.allResolution.Find(foundDevice => foundDevice.deviceId == deviceId);
                        if (device != null)
                        {
                            device.setConfig(width, height, freq, active);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Unable to parse your settings!\r\nSettings is reseted.");
                        fixedResolutionSysTray.Properties.Settings.Default.resolutions = "x";
                        fixedResolutionSysTray.Properties.Settings.Default.Save();
                        fixedResolutionSysTray.MainClass.pauseApp(true);
                    }
                }
                changedAllResolutons();
            }
        }