|
@@ -19,7 +19,7 @@ namespace OTSPartA_STDEditor
|
|
|
|
|
|
string MineralGroupDBAddress = Application.StartupPath + "\\Config\\SysData\\" + "OTSCleanlinesSTD.db";
|
|
|
Dictionary<int,STDGroups> MineralGroupDictionary = new Dictionary<int, STDGroups>();
|
|
|
-
|
|
|
+ //Dictionary<int, STDGroups> MineralGroupDictionaryInitial = new Dictionary<int, STDGroups>();
|
|
|
/// <summary>
|
|
|
///数据库修改状态
|
|
|
/// </summary>
|
|
@@ -29,7 +29,17 @@ namespace OTSPartA_STDEditor
|
|
|
Modify = 1,
|
|
|
Delete = 2
|
|
|
}
|
|
|
-
|
|
|
+ object Clone(Dictionary<int, STDGroups> Dictionary)
|
|
|
+ {
|
|
|
+ Dictionary<int, STDGroups> DictionaryInitial = new Dictionary<int, STDGroups>();
|
|
|
+ foreach (var key in Dictionary.Keys)
|
|
|
+ {
|
|
|
+ STDGroups DGroups = new STDGroups();
|
|
|
+ DGroups = DGroups.Clone(Dictionary[key]) as STDGroups;
|
|
|
+ DictionaryInitial.Add(key,DGroups);
|
|
|
+ }
|
|
|
+ return DictionaryInitial;
|
|
|
+ }
|
|
|
bool LoadDataFromDb(string DBaddress)
|
|
|
{
|
|
|
try
|
|
@@ -45,7 +55,7 @@ namespace OTSPartA_STDEditor
|
|
|
{
|
|
|
STDGroups new_data = new STDGroups();
|
|
|
new_data.name = "Default";
|
|
|
- new_data.color = "#FFFFFF";
|
|
|
+ new_data.color = "#C9C9C9";
|
|
|
new_data.iorder = 999;
|
|
|
MineralGroupDictionary.Add(0, new_data);
|
|
|
|
|
@@ -180,12 +190,9 @@ namespace OTSPartA_STDEditor
|
|
|
|
|
|
void SaveDataIntoDB(string DBAddress)
|
|
|
{
|
|
|
- for (int i = 1; i < Grid_FroupId.RowsCount; i++)
|
|
|
+ for (int i = 2; i < Grid_FroupId.RowsCount; i++)
|
|
|
{
|
|
|
- if(MineralGroupDictionary[(int)Grid_FroupId[i, 0].Tag].iorder!=999)
|
|
|
- {
|
|
|
- MineralGroupDictionary[(int)Grid_FroupId[i, 0].Tag].iorder = i-1;
|
|
|
- }
|
|
|
+ MineralGroupDictionary[(int)Grid_FroupId[i, 0].Tag].iorder = i-1;
|
|
|
}
|
|
|
System.Data.SQLite.SQLiteConnection m_dbConnection = new System.Data.SQLite.SQLiteConnection("data source='" + DBAddress + "'");
|
|
|
m_dbConnection.Open();
|
|
@@ -264,28 +271,41 @@ namespace OTSPartA_STDEditor
|
|
|
Grid_FroupId[0, 0].AddController(SourceGrid.Cells.Controllers.Unselectable.Default);
|
|
|
Grid_FroupId[0, 1].AddController(SourceGrid.Cells.Controllers.Unselectable.Default);
|
|
|
|
|
|
+ Grid_FroupId[1, 0] = new SourceGrid.Cells.Cell("Default", typeof(string));
|
|
|
+ Grid_FroupId[1, 1] = new SourceGrid.Cells.Cell("", typeof(string));
|
|
|
+ Grid_FroupId.Rows[1].Height = 25;
|
|
|
+ Grid_FroupId[1, 0].Tag = 0;
|
|
|
+
|
|
|
+ SourceGrid.Cells.Views.Cell vw = new SourceGrid.Cells.Views.Cell();
|
|
|
+ vw.BackColor = Attributes.colorHx16toRGB("#C9C9C9");
|
|
|
+ Grid_FroupId[1, 1].View = vw;
|
|
|
+ Grid_FroupId[1, 0].AddController(SourceGrid.Cells.Controllers.Unselectable.Default);
|
|
|
+ Grid_FroupId[1, 1].AddController(SourceGrid.Cells.Controllers.Unselectable.Default);
|
|
|
|
|
|
- int i = 1;
|
|
|
+ int i = 2;
|
|
|
foreach (KeyValuePair<int, STDGroups> kv in MineralGroupDictionary)
|
|
|
{
|
|
|
- Grid_FroupId[i, 0] = new SourceGrid.Cells.Cell(kv.Value.name, typeof(string));
|
|
|
- Grid_FroupId[i, 1] = new SourceGrid.Cells.Cell("", typeof(string));
|
|
|
- Grid_FroupId.Rows[i].Height = 25;
|
|
|
- Grid_FroupId[i, 0].Tag = kv.Key;
|
|
|
+ if (kv.Key != 0)
|
|
|
+ {
|
|
|
+ Grid_FroupId[i, 0] = new SourceGrid.Cells.Cell(kv.Value.name, typeof(string));
|
|
|
+ Grid_FroupId[i, 1] = new SourceGrid.Cells.Cell("", typeof(string));
|
|
|
+ Grid_FroupId.Rows[i].Height = 25;
|
|
|
+ Grid_FroupId[i, 0].Tag = kv.Key;
|
|
|
|
|
|
- SourceGrid.Cells.Views.Cell vew = new SourceGrid.Cells.Views.Cell();
|
|
|
- vew.BackColor = Attributes.colorHx16toRGB(kv.Value.color);
|
|
|
- Grid_FroupId[i, 1].View = vew;
|
|
|
+ SourceGrid.Cells.Views.Cell vew = new SourceGrid.Cells.Views.Cell();
|
|
|
+ vew.BackColor = Attributes.colorHx16toRGB(kv.Value.color);
|
|
|
+ Grid_FroupId[i, 1].View = vew;
|
|
|
|
|
|
- SourceGrid.Cells.Controllers.CustomEvents clickEvent = new SourceGrid.Cells.Controllers.CustomEvents();
|
|
|
- clickEvent.ValueChanged += new EventHandler(clickEvent_ValueChanged);
|
|
|
- Grid_FroupId[i, 0].AddController(clickEvent);
|
|
|
+ SourceGrid.Cells.Controllers.CustomEvents clickEvent = new SourceGrid.Cells.Controllers.CustomEvents();
|
|
|
+ clickEvent.ValueChanged += new EventHandler(clickEvent_ValueChanged);
|
|
|
+ Grid_FroupId[i, 0].AddController(clickEvent);
|
|
|
|
|
|
- SourceGrid.Cells.Controllers.CustomEvents clickEvent2 = new SourceGrid.Cells.Controllers.CustomEvents();
|
|
|
- clickEvent2.Click+= new EventHandler(clickEvent_Click);
|
|
|
- Grid_FroupId[i, 1].AddController(clickEvent2);
|
|
|
+ SourceGrid.Cells.Controllers.CustomEvents clickEvent2 = new SourceGrid.Cells.Controllers.CustomEvents();
|
|
|
+ clickEvent2.Click += new EventHandler(clickEvent_Click);
|
|
|
+ Grid_FroupId[i, 1].AddController(clickEvent2);
|
|
|
|
|
|
- i++;
|
|
|
+ i++;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -506,8 +526,8 @@ namespace OTSPartA_STDEditor
|
|
|
if (i == 1)
|
|
|
{
|
|
|
button_up.Enabled = false;
|
|
|
- MessageBox.Show("Group by default, not editable!");
|
|
|
- return;
|
|
|
+ //MessageBox.Show("Group by default, not editable!");
|
|
|
+ //return;
|
|
|
}
|
|
|
else
|
|
|
{
|