- form 이름 변경
- UI 수정 - Result Panel Column 연동
This commit is contained in:
69
PanelResult.cs
Normal file
69
PanelResult.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
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 dataHandler)
|
||||
{
|
||||
dgvData.DataSource = dataHandler.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>>() { dataHandler.GetActiveColumns(), dataHandler.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user