/// <summary> /// 同步运行 /// </summary> /// <param name="args"></param> public override bool Run(ExtensionStartArgs args) { try { ScriptArgs sargs = new ScriptArgs(this, args.DeviceInfo); MainMethod(sargs); return(true); } catch (Exception ex) { OpenApi.Log.Warn(this, "发生严重错误", ex); var wasFailedMsg = $"{Name} {OpenApi.Gui.GetPublicResouce<String>(this, "msgExtensionWasFailed")}"; OpenApi.Gui.ShowMessageBox(this, Name, wasFailedMsg); return(false); } }
/// <summary> /// 运行 /// </summary> /// <param name="args"></param> public bool Run(ExtensionStartArgs args) { try { OnStartCommand(new StartArgs() { Device = args.DeviceInfo }); OnFinished(); return(true); } catch (Exception ex) { OpenApi.Log.Warn(this, "发生严重错误", ex); var wasFailedMsg = $"{Name} {OpenApi.Gui.GetPublicResouce<String>(this, "msgExtensionWasFailed")}"; OpenApi.Gui.ShowMessageBox(this, Name, wasFailedMsg); return(false); } }
/// <summary> /// 运行 /// </summary> /// <param name="args"></param> /// <returns></returns> public abstract bool Run(ExtensionStartArgs args);