Beispiel #1
0
 static private void HandleLifecycle()
 {
     UWP.Connected          += () => ChildProcesses.Send("uwp-connected");
     UWP.Opened             += () => ChildProcesses.Send("uwp-opened");
     UWP.Closed             += () => ChildProcesses.Send("uwp-closed");
     ChildProcesses.Message += (message, pipe) => {
         if (message.Contains(":"))
         {
             var sections = message.Split(':');
             OnMessage(sections[0], sections[1]);
         }
         else
         {
             OnMessage(message);
         }
     };
 }
Beispiel #2
0
 static private void PassDataBetweenUwpAndChildren()
 {
     // Pass the IIPC messages from UWP down to child process.
     UWP.Message += async(ValueSet req) => {
         //Console.WriteLine("----- UWP MESSAGE -----");
         //foreach (var pair in req)
         //	Console.WriteLine($"{pair.Key}: {pair.Value}");
         if (req.ContainsKey("iipc"))
         {
             var cmd = req["iipc"] as string;
             await ChildProcesses.Send(cmd);
         }
     };
     // Receive Internal IPC messages (IIPC) from child's uwp-node.js lib
     // and propagate them to UWP app as well as (potential) other child processes.
     ChildProcesses.Message += (message, pipe) => {
         //Console.WriteLine("----- CHILD MESSAGE -----");
         //Console.WriteLine(message);
         var vs = new ValueSet();
         vs.Add("iipc", message);
         UWP.Send(vs);
         ChildProcesses.Send(message, pipe);
     };
 }
Beispiel #3
0
 static public void Send(string message)
 {
     UWP.Send(message);
     ChildProcesses.Send(message, null);
 }