LoadDisplaySettings() public method

Load the current display settings
public LoadDisplaySettings ( ) : bool
return bool
コード例 #1
0
        protected override void DoWork()
        {
            _display.LoadDisplaySettings();
            if (_display.PopulatedSettings)
            {
                //Get task info
                var response = Communication.GetResponse("/service/displaymanager.php", true);

                if (response.Error)
                {
                    return;
                }

                try
                {
                    var x = int.Parse(response.GetField("#x"));
                    var y = int.Parse(response.GetField("#y"));
                    var r = int.Parse(response.GetField("#r"));

                    ChangeResolution(GetDisplays().Count > 0 ? GetDisplays()[0] : "", x, y, r);
                }
                catch (Exception ex)
                {
                    Log.Error(Name, ex);
                }
            }
            else
            {
                Log.Error(Name, "Settings are not populated; will not attempt to change resolution");
            }
        }
コード例 #2
0
        protected override void DoWork(Response data, DataContracts.DisplayManager msg)
        {
            if (_display == null)
            {
                _display = new Display();
            }

            _display.LoadDisplaySettings();
            if (_display.PopulatedSettings)
            {
                if (msg.X <= 0 || msg.Y <= 0)
                {
                    Log.Error(Name, "Invalid settings provided");
                    return;
                }
                ChangeResolution(GetDisplays().Count > 0 ? GetDisplays()[0] : "", msg.X, msg.Y, msg.R);
            }
            else
            {
                Log.Error(Name, "Settings are not populated; will not attempt to change resolution");
            }
        }