本文整理汇总了C#中SortableBindingList.SetDefaultDirection方法的典型用法代码示例。如果您正苦于以下问题:C# SortableBindingList.SetDefaultDirection方法的具体用法?C# SortableBindingList.SetDefaultDirection怎么用?C# SortableBindingList.SetDefaultDirection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SortableBindingList
的用法示例。
在下文中一共展示了SortableBindingList.SetDefaultDirection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadData
private void LoadData()
{
Invoke(new Action(Show));
logData = database.Select();
Invoke(new Action(() => {
gameTable.DataSource = gameData = new SortableBindingList<GameStats>(logData.Select(log => new GameStats(log)));
gameData.SetDefaultDirection("Date", -1);
}));
summoners = new Dictionary<string, SummonerStats>();
foreach (var row in logData) {
foreach (var x in row.BlueTeam.Concat(row.PurpleTeam)) {
if (!x.IsBot && (!row.BotGame || !x.Name.EndsWith(" Bot"))) {
var key = x.Name;
// Is this someone on a different server?
if (summoners.ContainsKey(x.Name) && !String.IsNullOrEmpty(row.Server) && !String.IsNullOrEmpty(summoners[x.Name].Server)) {
if (row.Server != summoners[x.Name].Server) {
key = x.Name + "_" + row.Server;
}
}
if (!summoners.ContainsKey(key)) {
summoners[key] = new SummonerStats(x.Name);
}
summoners[key].AddGame(row);
}
}
}
Invoke(new Action(() => {
summonerTable.DataSource = summonerData = new SortableBindingList<SummonerStats>(summoners.Values.OrderByDescending(x => x.Games));
summonerData.SetDefaultDirection("Games", -1);
summonerData.SetDefaultDirection("PlayedWith", -1);
summonerData.SetDefaultDirection("PlayedVs", -1);
summonerData.SetDefaultDirection("KnownWins", -1);
summonerData.SetDefaultDirection("KnownLosses", -1);
}));
}
示例2: LoadChampionStats
private void LoadChampionStats()
{
championData = new SortableBindingList<SummonerStats.ChampionStats>(Data.ChampStats.Values.OrderByDescending(x => x.Games));
championData.SetDefaultDirection("Games", -1);
championData.SetDefaultDirection("Wins", -1);
championData.SetDefaultDirection("Losses", -1);
championData.SetDefaultDirection("WinRate", -1);
championTable.DataSource = championData;
championTable.ColumnHeadersBorderStyle = Util.ProperColumnHeadersBorderStyle;
championTable.Columns["Wins"].HeaderText = "W";
championTable.Columns["Losses"].HeaderText = "L";
championTable.Columns["WinRate"].HeaderText = "WR";
if (Data.GamesAs > 0) {
championTable.Columns["DeathsPerGame"].HeaderText = "D/G";
championTable.Columns["DeathsPerGame"].ToolTipText = "Deaths per game";
} else {
championTable.Columns["DeathsPerGame"].Visible = false;
}
championTable.Columns["Name"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
championTable.Select();
}