/// <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)
        {
            HideAllControls();

            if (_triggeredConnectSupported || _browseConnectSupported)
            {
                // Initially only the advertise button, Role list and DiscoveryData box should be visible.
                PeerFinder_MessageBox.Text    = "Hello World";
                PeerFinder_DiscoveryData.Text = "What's happening today?";

                ToggleAdvertiseControls(true);

                PeerFinderOutputText.Text = "";

                _launchByTap = rootPage.IsLaunchedByTap();

                if (_launchByTap)
                {
                    rootPage.NotifyUser("Launched by tap", NotifyType.StatusMessage);
                    PeerFinder_StartAdvertising(null, null);
                }
                else
                {
                    if (!_triggeredConnectSupported)
                    {
                        rootPage.NotifyUser("Tap based discovery of peers not supported", NotifyType.ErrorMessage);
                    }
                    else if (!_browseConnectSupported)
                    {
                        rootPage.NotifyUser("Browsing for peers not supported", NotifyType.ErrorMessage);
                    }
                }
            }
            else
            {
                rootPage.NotifyUser("Tap based discovery of peers not supported" + Environment.NewLine + "Browsing for peers not supported", NotifyType.ErrorMessage);
            }
        }