Exemple #1
0
        private static void Main(string[] args)
        {
            ChannelServices.RegisterChannel(new IpcChannel(args[0]), false);

            var    rt = new Remote();
            ObjRef r  = RemotingServices.Marshal(rt, Remote.ObjectName);

            using var p           = Process.GetProcessById(int.Parse(args[1], CultureInfo.InvariantCulture));
            p.EnableRaisingEvents = true;
            p.Exited += delegate { rt.Exit(); };

            rt.Wait();
        }
Exemple #2
0
 protected override void OnClosed(EventArgs e)
 {
     tasks.Clear();
     base.OnClosed(e);
     if (remote != null)
     {
         try
         {
             remote.Exit();
         }
         catch (RemotingException)
         {
         }
     }
 }
Exemple #3
0
        static void Main(string[] args)
        {
            ChannelServices.RegisterChannel(new IpcChannel(args[0]), false);

            Remote rt = new Remote();
            ObjRef r = RemotingServices.Marshal(rt, Remote.ObjectName);

            using (Process p = Process.GetProcessById(int.Parse(args[1], CultureInfo.InvariantCulture)))
            {
                p.EnableRaisingEvents = true;
                p.Exited += delegate(object sender, EventArgs e) { rt.Exit(); };

                rt.Wait();
            }
        }