mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-26 23:02:04 -04:00
Syle: Less LINQ
This commit is contained in:
parent
509f900ecf
commit
11468cf4af
@ -19,7 +19,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
|
||||
@ -230,9 +229,13 @@ namespace MCGalaxy.Gui {
|
||||
main_Maps.DataSource = lc;
|
||||
|
||||
// Try to keep the same selection on update
|
||||
string selected = null;
|
||||
List<string> selected = null;
|
||||
if (lc.Count > 0 && main_Maps.SelectedRows.Count > 0) {
|
||||
selected = (from DataGridViewRow row in main_Maps.Rows where row.Selected select lc[row.Index]).First().name;
|
||||
selected = new List<string>();
|
||||
foreach (DataGridViewRow row in main_Maps.SelectedRows) {
|
||||
string lvlName = (string)row.Cells[0].Value;
|
||||
selected.Add(lvlName);
|
||||
}
|
||||
}
|
||||
|
||||
// Update the data source and control
|
||||
@ -261,10 +264,13 @@ namespace MCGalaxy.Gui {
|
||||
//dgvPlayers.Invalidate();
|
||||
main_Maps.DataSource = null;
|
||||
main_Maps.DataSource = lc;
|
||||
|
||||
// Reselect map
|
||||
if (selected != null) {
|
||||
foreach (DataGridViewRow row in Server.levels.SelectMany(l => main_Maps.Rows.Cast<DataGridViewRow>().Where(row => (string)row.Cells[0].Value == selected)))
|
||||
row.Selected = true;
|
||||
foreach (DataGridViewRow row in main_Maps.Rows) {
|
||||
string lvlName = (string)row.Cells[0].Value;
|
||||
if (selected.Contains(lvlName)) row.Selected = true;
|
||||
}
|
||||
}
|
||||
|
||||
main_Maps.Refresh();
|
||||
|
6
GUI/app.config
Normal file
6
GUI/app.config
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
|
||||
</startup>
|
||||
</configuration>
|
Loading…
x
Reference in New Issue
Block a user