예제 #1
0
 public start_game()
 {
     this.InitializeComponent();
     if (ListaAmigosConec != null)
     {
         foreach (Amigo m in AmigoModel.GetAllAmigos())
         {
             ListaAmigosConec.Add(m);
         }
     }
     if (ListaAmigosDesconec != null)
     {
         foreach (Amigo m in AmigoModel.GetAllAmigosDesc())
         {
             ListaAmigosDesconec.Add(m);
         }
     }
     if (ListatChatGeneral != null)
     {
         foreach (Chat m in ChatModel.GetChatGeneral())
         {
             ListatChatGeneral.Add(m);
         }
     }
     if (ListatChatAmigos != null)
     {
         foreach (Chat m in ChatModel.GetChatAmigos())
         {
             ListatChatAmigos.Add(m);
         }
     }
 }
예제 #2
0
        private void TextBox_KeyDown(object sender, KeyRoutedEventArgs e)
        {
            if (e.Key == Windows.System.VirtualKey.Enter)
            {
                if (chat_general.Visibility == Visibility.Visible)
                {
                    ListatChatGeneral.Add(new Chat("You", "You : " + (e.OriginalSource as TextBox).Text));
                    chat_general.ScrollIntoView(chat_general.Items.Last());
                    (e.OriginalSource as TextBox).Text = "";
                }

                else if (chat_amigos.Visibility == Visibility.Visible)
                {
                    ListatChatAmigos.Add(new Chat("You", "You : " + (e.OriginalSource as TextBox).Text));
                    chat_amigos.ScrollIntoView(chat_amigos.Items.Last());
                    (e.OriginalSource as TextBox).Text = "";
                }
            }
        }