static void Main(string[] args) { ControlComputer controlComputer = new ControlComputer(); controlComputer.SetVolDown(); controlComputer.SetVolUp(); controlComputer.SetVolMute(); controlComputer.Turnoffmonitor(); Console.ReadLine(); }
/// <summary> /// 执行 /// </summary> public void Exetue() { ControlComputer controlComputer = new ControlComputer(); this.ResultObject = new MResultObject(); try { switch (this.requsetParam.ControlType) { case ControlType.NONE: break; case ControlType.关机: controlComputer.ShutDown(); this.ResultObject.Result = true; break; case ControlType.重启: controlComputer.Restart(); this.ResultObject.Result = true; break; case ControlType.注销: controlComputer.LogOff(); this.ResultObject.Result = true; break; case ControlType.锁定: controlComputer.LockPC(); this.ResultObject.Result = true; break; case ControlType.显示器: controlComputer.Turnoffmonitor(); this.ResultObject.Result = true; break; case ControlType.音量: if (this.requsetParam.VoiceValue > 0) { controlComputer.SetVolUp(); } else if (this.requsetParam.VoiceValue < 0) { controlComputer.SetVolMute(); } this.ResultObject.Result = true; break; case ControlType.命令: this.ResultObject = new ExecuteCommand().ExecuteCommandReturnValue(this.requsetParam.Commendstr); break; default: break; } } catch (Exception ex) { this.ResultObject.Result = false; this.ResultObject.ReturnObject = ex; } }
/// <summary> /// 执行 /// </summary> public void Exetue() { ControlComputer controlComputer = new ControlComputer(); this.ResultObject = new MResultObject(); try { switch (this.requsetParam.ControlType) { case ControlType.NONE: break; case ControlType.关机: controlComputer.ShutDown(); this.ResultObject.Result = true; break; case ControlType.重启: controlComputer.Restart(); this.ResultObject.Result = true; break; case ControlType.注销: controlComputer.LogOff(); this.ResultObject.Result = true; break; case ControlType.锁定: controlComputer.LockPC(); this.ResultObject.Result = true; break; case ControlType.显示器: controlComputer.Turnoffmonitor(); this.ResultObject.Result = true; break; case ControlType.音量: if (this.requsetParam.VoiceValue > 0) { controlComputer.SetVolUp(); } else if (this.requsetParam.VoiceValue < 0) { controlComputer.SetVolMute(); } this.ResultObject.Result = true; break; case ControlType.命令: this.ResultObject = new ExecuteCommand().ExecuteCommandReturnValue(this.requsetParam.Commendstr); break; default: break; } } catch (Exception ex) { this.ResultObject.Result = false; this.ResultObject.ReturnObject = ex; } }