public async Task Run(Action Action) { await IsReady; Worker.PostMessage("MNData", Uint8Array.From(Action.Serialize())); var Message = Worker.GetMessage(); await Worker.Run($"self.MN.RunAction()"); await Message; }
private async Task GetReady() { Worker = new WebWorkerClient(); var AssembellyNames = "["; foreach (var Asm in Monsajem_Incs.Assembly.Assembly.AllAppAssemblies) { AssembellyNames += $"'{Asm.GetName().Name}.dll',"; } if (Monsajem_Incs.Assembly.Assembly.AllAppAssemblies.Length > 0) { AssembellyNames = AssembellyNames.Substring(0, AssembellyNames.Length - 1); } AssembellyNames += "]"; var Location = Window.window.Location; await Worker.Run($"self.MN={{}};self.MN.AssemblyFilenames={AssembellyNames};self.MN.baseUrl = '{Location.Protocol}//{Location.Hostname}:{Location.Port}/_framework/';"); var Ready = Worker.GetMessage(); await Worker.Run(WebWorkerJs); await Ready; }
public async Task <object> Run(Func <Task <object> > Func) { await IsReady; Worker.PostMessage("MNData", Uint8Array.From(Func.Serialize())); var Message = Worker.GetMessage(); await Worker.Run($"self.MN.RunFunctionTaskResult()"); var Result = (await Message).GetData <Uint8Array>().ToArray(); if (Result.Length == 0) { throw new Exception("Error On Proccess"); } return(Result.Deserialize <object>()); }