|
@@ -9,6 +9,7 @@ using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
using System.Windows.Forms;
|
|
|
+using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
|
|
|
|
|
namespace OTSPartA_STDEditor
|
|
|
{
|
|
@@ -17,7 +18,7 @@ namespace OTSPartA_STDEditor
|
|
|
public int PreRow = 1;//之前选中的位置
|
|
|
public Form_Main m_MainForm = null;
|
|
|
ValueChangedEvent m_ValueChangedEvent = null;//单元格内容改变事件
|
|
|
-
|
|
|
+ Dictionary<int,STDGroups> GroupViewDic=null;
|
|
|
public STDRuleslist(Form_Main mainForm)
|
|
|
{
|
|
|
InitializeComponent();
|
|
@@ -120,7 +121,42 @@ namespace OTSPartA_STDEditor
|
|
|
|
|
|
private void MineralsGrid_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
+ SourceGrid.Grid ls_gd = (SourceGrid.Grid)sender;
|
|
|
+ ls_gd.Focus();
|
|
|
+ int i = ls_gd.Selection.ActivePosition.Row;
|
|
|
+ int j = ls_gd.Selection.ActivePosition.Column;
|
|
|
+ //string jj =m_MainForm.m_Attributes.Grid_Attributes[10, 1].Value.ToString();
|
|
|
+ /// 保证鼠标点击的GRID行和列是有效的
|
|
|
+ if (i >= 0 && j >= 0)
|
|
|
+ {
|
|
|
+ ////规则名称不为空
|
|
|
+ //if (Grid_Minerals[i, 0].Value.ToString().Replace(" ", "").Trim() != "")
|
|
|
+ //{
|
|
|
+ // if (m_MainForm.CheckAttributes() && m_MainForm.Checktextbox_STDEditor())
|
|
|
+ // {
|
|
|
+
|
|
|
+ m_MainForm.SaveDataOfSelRule(PreRow, 0);
|
|
|
+ m_MainForm.ChangeSTDEditorAndGrid_Attributes(int.Parse(Grid_Minerals[i, 0].Tag.ToString()));
|
|
|
+ m_MainForm.m_SubMidWindow.m_ComparativeLibrary.MakeCheckboxUnchecked();
|
|
|
+ PreRow = i;
|
|
|
+
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // Position pos = new Position(PreRow, 0);
|
|
|
+ // Grid_Minerals.Selection.Focus(pos, true);
|
|
|
+ // m_MainForm.m_SubMidWindow.m_ComparativeLibrary.MakeCheckboxUnchecked();
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+ // Position pos = new Position(PreRow, 0);
|
|
|
+ // Grid_Minerals.Selection.Focus(pos, true);
|
|
|
+ // m_MainForm.m_SubMidWindow.m_ComparativeLibrary.MakeCheckboxUnchecked();
|
|
|
+ //}
|
|
|
+ }
|
|
|
|
|
|
+ SetOrderButtonsStatus();
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 新建
|
|
@@ -517,7 +553,6 @@ namespace OTSPartA_STDEditor
|
|
|
button_DownOrder.Enabled = false;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
{
|
|
|
if (tabControl1.SelectedIndex == 0)
|
|
@@ -526,13 +561,56 @@ namespace OTSPartA_STDEditor
|
|
|
}
|
|
|
else if (tabControl1.SelectedIndex == 1)
|
|
|
{
|
|
|
-
|
|
|
+ ConvertToRuleViewDic();
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
void InitGroupEditorView()
|
|
|
{
|
|
|
+ GroupViewDic = ConvertToGroupViewDic();
|
|
|
+ foreach(STDGroups group in GroupViewDic.Values)
|
|
|
+ {
|
|
|
+ TreeNode treeNode = new TreeNode();
|
|
|
+ treeNode.Tag = group;
|
|
|
+ treeNode.Text=group.name;
|
|
|
+ treeNode.BackColor= Attributes.colorHx16toRGB(group.color);
|
|
|
+ treeView_G.Nodes.Add(treeNode);
|
|
|
+ foreach(STDdata ddata in group.ContainSTD)
|
|
|
+ {
|
|
|
+ TreeNode childtreeNode = new TreeNode();
|
|
|
+ childtreeNode.Tag = ddata;
|
|
|
+ childtreeNode.Text = ddata.StrName;
|
|
|
+ treeNode.Nodes.Add(childtreeNode);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ treeView_G.Font = new Font("微软雅黑", 12);
|
|
|
+ treeView_G.ShowLines=false;
|
|
|
+ //treeView_G.ExpandAll();
|
|
|
+ this.Refresh();
|
|
|
+ }
|
|
|
+ Dictionary<int, STDGroups> ConvertToGroupViewDic()
|
|
|
+ {
|
|
|
+ Dictionary<int, STDGroups> keyValuePairs = new Dictionary<int, STDGroups>();
|
|
|
+ keyValuePairs = m_MainForm._sTDEditor.GroupDictionary;
|
|
|
+ foreach (STDGroups group in keyValuePairs.Values)
|
|
|
+ {
|
|
|
+ group.ContainSTD.Clear();
|
|
|
+ }
|
|
|
+ foreach (STDdata Ddata in m_MainForm._sTDEditor.STDDictionary.Values)
|
|
|
+ {
|
|
|
+ keyValuePairs[int.Parse(Ddata.GroupId)].ContainSTD.Add(Ddata);
|
|
|
+ }
|
|
|
+ return keyValuePairs;
|
|
|
+ }
|
|
|
+ void ConvertToRuleViewDic()
|
|
|
+ {
|
|
|
+ foreach (STDGroups group in GroupViewDic.Values)
|
|
|
+ {
|
|
|
+ foreach (STDdata Ddata in group.ContainSTD)
|
|
|
+ {
|
|
|
+ m_MainForm._sTDEditor.STDDictionary[int.Parse(Ddata.STDId)].GroupId = group.id.ToString();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|