70 lines
1.6 KiB
C#
70 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using WeifenLuo.WinFormsUI.Docking;
|
|
|
|
namespace friction
|
|
{
|
|
public partial class PanelResult : DockContent
|
|
{
|
|
MainForm m_Owner = null;
|
|
|
|
public PanelResult(MainForm owner)
|
|
{
|
|
InitializeComponent();
|
|
|
|
m_Owner = owner;
|
|
}
|
|
|
|
public void UpdateData(DataHandler data)
|
|
{
|
|
dgvData.DataSource = data.GetData();
|
|
|
|
|
|
Dictionary<string, bool> CacheChecked = new Dictionary<string, bool>();
|
|
foreach (ListViewItem item in lvColumn.Items)
|
|
{
|
|
string key = item.SubItems[1].Text;
|
|
bool bChecked = item.Checked;
|
|
CacheChecked.Add(key, bChecked);
|
|
}
|
|
|
|
lvColumn.Groups[0].Items.Clear();
|
|
lvColumn.Groups[1].Items.Clear();
|
|
lvColumn.Items.Clear();
|
|
|
|
List<List<string>> Columns = new List<List<string>>() { data.GetActiveColumns(), data.GetNonactiveColumns() };
|
|
for(int iGroup=0; iGroup<Columns.Count; iGroup++)
|
|
{
|
|
foreach(string col in Columns[iGroup])
|
|
{
|
|
ListViewItem item = new ListViewItem(new string[] { "", col });
|
|
item.Text = col;
|
|
if (CacheChecked.ContainsKey(col) == true)
|
|
item.Checked = CacheChecked[col];
|
|
else if (iGroup == 0)
|
|
item.Checked = true;
|
|
else
|
|
item.Checked = false;
|
|
lvColumn.Items.Add(item);
|
|
lvColumn.Groups[iGroup].Items.Add(item);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void lvColumn_ItemChecked(object sender, ItemCheckedEventArgs e)
|
|
{
|
|
string strColName = e.Item.SubItems[1].Text;
|
|
bool bShow = e.Item.Checked;
|
|
|
|
dgvData.Columns[strColName].Visible = bShow;
|
|
}
|
|
}
|
|
}
|