static void Main(string[] args) { AppInitializer.Initialize(); Console.WriteLine("调用addPermission的服务"); //以下是调用远程服务的代码 var result = ServiceContext.Invoke("AddPermission", (arg) => { //arg.Name = "测试权限的名称"; }); Console.WriteLine("调用deletePermission的服务"); var permissionId = result.GetValue <Guid>("id"); ServiceContext.Invoke("deletePermission", (arg) => { //arg.Id = permissionId; }); Console.WriteLine("执行完毕,按任意键退出"); AppInitializer.Cleanup(); Console.ReadLine(); }
static void Main(string[] args) { AppInitializer.Initialize(); Console.WriteLine("按任意键结束"); Console.ReadLine(); AppInitializer.Cleanup(); }
static void Main(string[] args) { AppInitializer.Initialize(); var cmd = new StartEventTest(_simple); cmd.Execute(); Console.WriteLine("按任意键结束"); Console.ReadLine(); AppInitializer.Cleanup(); }
static void Main(string[] args) { AppInitializer.Initialize(); Console.WriteLine("调用addGenerator的服务"); //XY20170807 //创建规则对象 var hardcode = DTObject.CreateReusable(); hardcode["ruleType"] = "hardcode"; hardcode["content"] = "XY"; var dateCode = DTObject.CreateReusable(); dateCode["ruleType"] = "dateCode"; var rules = new DTObject[] { hardcode, dateCode }; //以下是调用远程服务的代码 var result = ServiceContext.InvokeDynamic("addGenerator", (arg) => { arg.Name = "第一个测试用的"; arg.MarkedCode = "first"; arg.Rules = rules; }); //Console.WriteLine("调用deleteGenerator的服务"); //var permissionId = result.GetValue<Guid>("id"); //ServiceContext.Invoke("deletePermission", (arg) => //{ // arg.Id = permissionId; //}); //Console.WriteLine("执行完毕,按任意键退出"); AppInitializer.Cleanup(); Console.ReadLine(); }
public static void Start(Action initialize = null) { RPCEvents.ServerOpened += OnServerOpened; RPCEvents.ServerError += OnServerError; RPCEvents.ServerClosed += OnServerClosed; AppInitializer.Initialize(); if (initialize != null) { initialize(); } Console.WriteLine(MQ.Strings.CloseServiceHost); Console.ReadLine(); AppInitializer.Cleanup(); }
static void Main(string[] args) { try { AppInitializer.Initialize(); var fileName = args[0]; var folder = args[1]; //转换的图片存放的目录 var progressFileName = args[2]; //记录进度的文件 DTObject gt = DTObject.Create(); using (var doc = DocumentFactory.Create(fileName)) { if (doc != null) { var token = new CancelToken(); var range = GetRange(folder, doc); doc.ExtractImages(range.Index, range.Count, (pageIndex, content, g) => { SavePage(folder, pageIndex, content, token, g); RaiseCallback(progressFileName, g, gt); //更新进度 }, token); RaiseCallback(progressFileName, new Progress(doc.PageCount, doc.PageCount), gt); } } } catch (Exception ex) { var errorFileName = args[3]; //记录错误的文件 WriteError(errorFileName, ex); } finally { AppInitializer.Cleanup(); } }
public static void Cleanup() { AppInitializer.Cleanup(); }