/// <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. /// This parameter is typically used to configure the page.</param> protected override void OnNavigatedTo(NavigationEventArgs e) { // TODO: Prepare page for display here. // TODO: If your application contains multiple pages, ensure that you are // handling the hardware Back button by registering for the // Windows.Phone.UI.Input.HardwareButtons.BackPressed event. // If you are using the NavigationHelper provided by some templates, // this event is handled for you. _controlProtocol = e.Parameter as RemoteControlClientProtocol; }
private async void Connect_Click(object sender, RoutedEventArgs e) { ControlProtocol = new RemoteControlClientProtocol(ServerHostName.Text, ServerPort.Text); this.ProgressRing.IsActive = true; this.MainGrid.Opacity = 0.5; this.ProgressGrid.Visibility = Visibility.Visible; bool connected = await ControlProtocol.Connect(); if (connected) { StatusText.Text = "Connected"; } else { StatusText.Text = "Error while connecting"; } this.ProgressRing.IsActive = false; this.ProgressGrid.Visibility = Visibility.Collapsed; this.MainGrid.Opacity = 1; }
/// <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. /// This parameter is typically used to configure the page.</param> protected override void OnNavigatedTo(NavigationEventArgs e) { _controlProtocol = e.Parameter as RemoteControlClientProtocol; }