Ejemplo n.º 1
0
 protected override void OnNavigatedFrom(NavigationEventArgs e)
 {
     base.OnNavigatedFrom(e);
     PushConnectMessageHandler.Dispose();
     PushDisconnectMessageHandler.Dispose();
     receiveMessageHandler.Dispose();
     PushAskForGameHandler.Dispose();
     SaveMessagesHandler.Dispose();
     AnswerToGameHandler.Dispose();
     GameCacnceledHandler.Dispose();
 }
Ejemplo n.º 2
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            List <string> recentMessages = new List <string>();
            var           secondUser     = (sender as Button).Tag.ToString();

            if (secondUser == App.CurrentUser.Username)
            {
                await new MessageDialog("You can't chat with yourself ;)").ShowAsync();
            }
            else
            {
                SaveMessagesHandler.Dispose();
                var connId = myApp.MyHubConnection.ConnectionId;
                if (App.MessagesReceivedLists.ContainsKey(secondUser))
                {
                    recentMessages = App.MessagesReceivedLists[secondUser];
                }
                dynamic info = new { connId = connId, userName = App.CurrentUser.Username, secondUser = secondUser, recentMessages = recentMessages };
                Frame.Navigate(typeof(Chat), info);
            }
        }