private async void ConnectButton_Click(object sender, RoutedEventArgs e) { ConnectButton.IsEnabled = false; Loading.IsActive = true; try { Xmpp.Connection conn = await Xmpp.Connection.Open(ServerUrlTextbox.Text, PortTextbox.Text, UsernameTextbox.Text, PasswordTextbox.Password); this.Frame.Navigate(typeof(ChatPage), conn); } finally { Loading.IsActive = false; } }
protected override async void OnNavigatedTo(NavigationEventArgs e) { if (e.Parameter is Xmpp.Connection) { connection = (Xmpp.Connection)e.Parameter; } XmlDocument doc = new XmlDocument(); XmlNode query = doc.CreateElement("query", "jabber:iq:roster"); rosterId = Guid.NewGuid().ToString(); connection.NewIq += FillRoster; await connection.SendIq(rosterId, "get", query); base.OnNavigatedTo(e); }