public override PcActionResult Execute(PcActionParam param) { var p = param.ConvertParam <AppExecuteAppParam>(); var appName = ChineseConvertHelper.ToTraditional(p.AppName); var appInfo = appList.SingleOrDefault(x => ChineseConvertHelper.ToTraditional(x.AppName) == appName); if (appInfo != null) { if (!File.Exists(appInfo.Path)) { return(new PcActionResult() { Msg = $"電腦上的{appName}未安裝!", Success = true }); } Process.Start(appInfo.Path); return(new PcActionResult() { Msg = $"電腦{appName}打開啦!", Success = true }); } return(new PcActionResult() { Msg = $"你所講應用{appName}未設定!", Success = true }); }
protected override ShutdownDelayParam ConvertParam(PcActionParam param) { return(new ShutdownDelayParam() { Minute = AppConfigManger.GetConfig().ActionConfig.ShutdownNowActionConfig.DefaultShutdownMinute }); }
public override PcActionResult Execute(PcActionParam param) { Process.Start("shutdown", "-a"); return(new PcActionResult() { Msg = $"电脑关机已取消!", Success = true }); }
public abstract PcActionResult Execute(PcActionParam param);
public override PcActionResult Execute(PcActionParam param) { var p = this.ConvertParam(param); return(this.Shutdown(p)); }
protected virtual ShutdownDelayParam ConvertParam(PcActionParam param) { return(param.ConvertParam <ShutdownDelayParam>()); }
public PcActionResult DoAction([FromBody] PcActionParam param) { var action = PcActionManager.Default.GetActionByKey(param.ActionKey); return(action.Execute(param)); }