예제 #1
0
        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
            });
        }
예제 #2
0
 protected override ShutdownDelayParam ConvertParam(PcActionParam param)
 {
     return(new ShutdownDelayParam()
     {
         Minute = AppConfigManger.GetConfig().ActionConfig.ShutdownNowActionConfig.DefaultShutdownMinute
     });
 }
예제 #3
0
 public override PcActionResult Execute(PcActionParam param)
 {
     Process.Start("shutdown", "-a");
     return(new PcActionResult()
     {
         Msg = $"电脑关机已取消!",
         Success = true
     });
 }
예제 #4
0
 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>());
 }
예제 #7
0
        public PcActionResult DoAction([FromBody] PcActionParam param)
        {
            var action = PcActionManager.Default.GetActionByKey(param.ActionKey);

            return(action.Execute(param));
        }