コード例 #1
0
 // Channel column functions
 private async void ChannelListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         UserInfo.Visibility = Visibility.Collapsed;
         var item = (Channel)ChannelListView.SelectedItem;
         if (item.IsText == Visibility.Visible)
         {
             ChannelTitle.Text           = item.ID.ToString();
             RightColumnStack.Visibility = Visibility.Visible;
             chatViewModel.Messages.Clear();
             memberViewModel.Members.Clear();
             await Task.Run(() =>
             {
                 foreach (Message m in item.Messages)
                 {
                     chatViewModel.AddText(m);
                 }
                 foreach (Member m in item.Members)
                 {
                     memberViewModel.AddMember(m);
                 }
                 Application.Current.Dispatcher.Invoke(new Action(() =>
                 {
                     ChatListView.ScrollIntoView(chatViewModel.Messages[chatViewModel.Messages.Count() - 1]);
                 }));
             });
         }
         else
         {
             try
             {
                 ChannelListView.SelectedItem = e.RemovedItems[0];
             }
             catch (Exception)
             {
                 ChannelListView.SelectedItem = null;
             }
         }
     }
     catch (Exception)
     {
         //TextChannelGrid.Visibility = Visibility.Collapsed;
     }
 }