public static DisplayData FindData(IList <DisplayData> list, DisplayData data)
 {
     foreach (DisplayData test in list)
     {
         if (IsEqual(test.Data, data.Data))
         {
             return(test);
         }
     }
     return(null);
 }
        public static int ChangeSettings(DisplayData data, out string err)
        {
            err = "";

            Win32.DEVMODE            devmode = data.Data;
            Win32.ChangeDisplayFlags flags   = Win32.ChangeDisplayFlags.CDS_UPDATEREGISTRY;
            Win32.ReturnValues       iRet    = (Win32.ReturnValues)Win32.ChangeDisplaySettings(ref devmode, (int)flags);

            switch (iRet)
            {
            case Win32.ReturnValues.DISP_CHANGE_SUCCESSFUL:
                err = Win32.ReturnValueText.DISP_CHANGE_SUCCESSFUL;
                break;

            case Win32.ReturnValues.DISP_CHANGE_RESTART:
                err = Win32.ReturnValueText.DISP_CHANGE_RESTART;
                break;

            case Win32.ReturnValues.DISP_CHANGE_FAILED:
                err = Win32.ReturnValueText.DISP_CHANGE_FAILED;
                break;

            case Win32.ReturnValues.DISP_CHANGE_BADDUALVIEW:
                err = Win32.ReturnValueText.DISP_CHANGE_BADDUALVIEW;
                break;

            case Win32.ReturnValues.DISP_CHANGE_BADFLAGS:
                err = Win32.ReturnValueText.DISP_CHANGE_BADFLAGS;
                break;

            case Win32.ReturnValues.DISP_CHANGE_BADPARAM:
                err = Win32.ReturnValueText.DISP_CHANGE_BADPARAM;
                break;

            case Win32.ReturnValues.DISP_CHANGE_NOTUPDATED:
                err = Win32.ReturnValueText.DISP_CHANGE_NOTUPDATED;
                break;

            default:
                err = Win32.ReturnValueText.DISP_CHANGE_OTHER;
                break;
            }
            return((int)iRet);
        }
 public static bool IsEqual(DisplayData x, DisplayData y)
 {
     return(IsEqual(x.Data, y.Data));
 }