コード例 #1
0
        private void ServeHoloJsApp(ServeAppOptions opts)
        {
            XrsPackage xrsApp = null;

            try
            {
                xrsApp = XrsPackage.Open(opts.Path);
            }
            catch (Exception)
            {
                Console.WriteLine("Cannot open the specified HoloJs app. Make sure the source points to a valid Spin app.");
                return;
            }

            DebugHttpServer = new AppServer(opts.Path);

            var appUrl = DebugHttpServer.GetLaunchUrl() + xrsApp.XsrFileName;

            Console.WriteLine("HTTP server running for " + appUrl + ". Ctrl - C to stop.");
            Console.CancelKeyPress += Console_CancelKeyPress;

            if (opts.ShowQr)
            {
                DebugHttpServer.RunAsync();

                QRConnectWindow = new QrConnect();
                QRConnectWindow.SetUrl(appUrl);
                QRConnectWindow.ShowDialog();
            }
            else
            {
                DebugHttpServer.Run();
            }

            Console.WriteLine("HTTP server exited");
        }