コード例 #1
0
        // Usage: Xamarin.Interactive.Console.exe {IdentifyAgentRequest args}
        // Passing no arguments is supported for debug scenarios.
        public static void Main()
        {
            var ctx = new SingleThreadSynchronizationContext();

            SynchronizationContext.SetSynchronizationContext(ctx);

            var agent = new ConsoleAgent();

            MacIntegration.Integrate(agent);

            try {
                var request = IdentifyAgentRequest.FromCommandLineArguments(Environment.GetCommandLineArgs());
                if (request != null && request.ProcessId >= 0)
                {
                    if (Environment.OSVersion.Platform == PlatformID.Unix)
                    {
                        new Thread(() => {
                            MonoTouch.Hosting.ProcessMonitor.WaitPid(request.ProcessId);
                            Environment.Exit(0);
                        })
                        {
                            IsBackground = true
                        }.Start();
                    }
                    else
                    {
                        var parentProcess = Process.GetProcessById(request.ProcessId);
                        parentProcess.EnableRaisingEvents = true;
                        parentProcess.Exited += (o, e) => Environment.Exit(0);
                    }
                }
            } catch (Exception e) {
                Log.Error("Main", e);
            }

            agent.Start(new AgentStartOptions {
                ClientSessionKind = ClientSessionKind.Workbook
            });

            DebuggingSupport.LaunchClientAppForDebugging(agent);

            ctx.RunOnCurrentThread();
        }
コード例 #2
0
ファイル: AppDelegate.cs プロジェクト: pietervp/workbooks-1
        public override void DidFinishLaunching(NSNotification notification)
        {
            var ppid = getppid();

            NSWorkspace.Notifications.ObserveDidTerminateApplication((sender, e) => {
                if (e.Application.ProcessIdentifier == ppid)
                {
                    NSApplication.SharedApplication.Terminate(e.Application);
                }
            });

            var agent = new MacAgent();

            agent.Start(new AgentStartOptions {
                ClientSessionKind = ClientSessionKind.Workbook
            });

            DebuggingSupport.LaunchClientAppForDebugging(agent);
        }
コード例 #3
0
        void App_OnStartup(object sender, StartupEventArgs e)
        {
            var agent = new WpfAgent(() => new MainWindow());

            try {
                var request = IdentifyAgentRequest.FromCommandLineArguments(Environment.GetCommandLineArgs());
                if (request.ProcessId >= 0)
                {
                    var parentProcess = Process.GetProcessById(request.ProcessId);
                    parentProcess.EnableRaisingEvents = true;
                    parentProcess.Exited += (o, _) => Environment.Exit(0);
                }
            } catch (Exception ex) {
                Log.Error("App", ex);
            }

            agent.Start(new AgentStartOptions {
                ClientSessionKind = ClientSessionKind.Workbook
            });

            DebuggingSupport.LaunchClientAppForDebugging(agent);
        }