示例#1
0
        private void UserGame_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            SelectedGameView = sender as UserGameView;
            UserGameViewModel userGame = SelectedGameView?.Value ?? (UserGamesList.Items.Count > 0
                ? (UserGameViewModel)UserGamesList.Items[0]
                : null);

            usersMeetList.Items.Clear();

            if (userGame != null)
            {
                MainWindow.GamePortal.GetUsers(sortBy, userGame.Model).ForEach(p =>
                {
                    Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        WCFUserGame usergame = p.EndedUserGames.Single(p2 => p2.GameId == userGame.Model.GameId);
                        usersMeetList.Items.Add(new GamePersonItemViewModel()
                        {
                            User     = p,
                            HomeType = MainWindow.ClientInfo.WorldData.HomeType
                                       .Single(p1 => p1.WCFHomeType.Name == usergame.HomeType),
                            IsLikePanelVisible = Visibility.Visible,
                            UserGame           = usergame
                        });
                    }), DispatcherPriority.ApplicationIdle);
                });
            }
        }
 private void PassRate_MouseLeftButtonUp(object sender, RoutedEventArgs e)
 {
     MainWindow.GamePortal.PassRateAsync(Value.Model.Id, () =>
     {
         Application.Current.Dispatcher.BeginInvoke(new Action(() =>
         {
             var game    = MainWindow.GamePortal.User.EndedUserGames.Single(p => p.Id == Value.Model.Id);
             DataContext = new UserGameViewModel(game);
         }), DispatcherPriority.ApplicationIdle);
     });
 }
 void UserGameView_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     Value = (UserGameViewModel)e.NewValue;
 }