public void OpenSelectedGame() { if (SelectedItems[0] is PlayerGameModel pgc) { OpenViewModel?.Invoke(pgc, new OpenModelViewerEventArgs(pgc)); } }
private void OpenUserClick(object sender, RoutedEventArgs e) { if (SelectedItem is UserModel u) { OpenViewModel?.Invoke(e.OriginalSource, new OpenModelViewerEventArgs(u, e)); e.Handled = true; } }
private void OpenUserMouseDoubleClick(object sender, MouseButtonEventArgs e) { if (DataGridHelper.GetSourceCellElement(e) is DataGridCell dgc && dgc.DataContext is UserModel u) { OpenViewModel?.Invoke(e.OriginalSource, new OpenModelViewerEventArgs(u, e)); e.Handled = true; } }
public MapsControl() { InitializeComponent(); PlayerGamesDataGrid = ScrollableHeaderedControl_Scroller.Content as PlayerGamesDataGrid; // Hide map column PlayerGamesDataGrid.Columns.FirstOrDefault(x => String.Equals(x.Header as string, "Map", StringComparison.InvariantCultureIgnoreCase)).Visibility = Visibility.Hidden; // Passthought OpenViewModel event PlayerGamesDataGrid.OpenViewModel += (s, e) => OpenViewModel?.Invoke(s, e); }
public UserGamesControl() { InitializeComponent(); var scroller = (Content as Grid).FindChild <ScrollableHeaderedControl>(); var header = scroller.HeaderContent as Grid; DataGridGames = scroller.Content as PlayerGamesDataGrid; GameListFilter = header.FindChild <GameListFilter>(); GamesChart = header.FindChild <Expander>().Content as PlayerGamesChart; GamesChart.OpenViewModel += (s, e) => OpenViewModel?.Invoke(s, e); }
public void OpenSelectedGamesUsers() { if (SelectedItems == null || SelectedItems.Count == 0) { return; } var users = new ObservableCollection <UserModel>(User.Parse(SelectedItems .Cast <PlayerGameModel>() .Select(x => x.Game.Game)) .Select(x => new UserModel(x))); OpenViewModel?.Invoke(this, new OpenModelViewerEventArgs(new UserListModel(users))); }
public async Task OpenAllGamesUsers() { var items = Dispatcher.InvokeAsync(() => CollectionViewSource.GetDefaultView(ItemsSource)); //items in collectionview respect the current filter var games = new List <Game>(); Parallel.ForEach((await items).Cast <PlayerGameModel>(), delegate(PlayerGameModel item) { games.Add(item.Game.Game); }); var users = await Task.Run(() => User.Parse(games)); var models = new UserModel[users.Count]; Parallel.For(0, users.Count, delegate(int index) { models[index] = new UserModel(users[index]); }); OpenViewModel?.Invoke(this, new OpenModelViewerEventArgs(new UserListModel(new ObservableCollection <UserModel>(models)))); }