示例#1
0
        private void LaunchWebAppCommandExecute(object obj)
        {
            var listener = new ResponseListener
                           (
                loadEventArg =>
            {
                var webappSession = LoadEventArgs.GetValue <WebAppSession>(loadEventArg);

                webappSession.WebAppSessionListener = webAppListener;
                isLaunched = true;
                DisconnectMediaPlayerSession();
                mWebAppSession = webappSession;
                if (selectedDevice.HasAnyCapability(new List <string>
                {
                    WebAppLauncher.MessageSend,
                    WebAppLauncher.MessageReceive,
                    WebAppLauncher.MessageReceiveJson,
                    WebAppLauncher.MessageSendJson
                }))
                {
                    webappSession.Connect(connectionListener);
                }
                else
                {
                    connectionListener.OnSuccess(webappSession.LaunchSession);
                }
            },
                serviceCommandError =>
            {
                var msg =
                    new MessageDialog(
                        "Error launching webapp");
                msg.ShowAsync();
            }
                           );

            webAppLauncher.LaunchWebApp(webAppId, listener);
        }