예제 #1
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            UiDispatcher state = new UiDispatcher(this);

            // Update the UI state
            state.UpdateState();

            // Create connection
            _Connection = new HubConnection("http://swmsignalrsite.azurewebsites.net/");
            _Connection.StateChanged += change => ReportChange(change);
            _Connection.Closed += () => ReportClosed();

            // Create hub proxy
            _Hub = _Connection.CreateHubProxy("erpTicker");
            _Hub.On<string>("addResponse", data => OnResponse(data));

            // Start the connection
            _Connection.Start();
        }