|
@@ -198,65 +198,49 @@ namespace OTSPartA_STDEditor
|
|
|
if (m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row >= 0)
|
|
|
{
|
|
|
SaveDataOfSelRule(m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row, m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Column);
|
|
|
-
|
|
|
- try
|
|
|
+ }
|
|
|
+ try
|
|
|
+ {
|
|
|
+ SaveFileDialog saveFile = new SaveFileDialog();
|
|
|
+ saveFile.Title = "Please select the path which to save the file";
|
|
|
+ saveFile.Filter = "Database File(*.db)|*.db";
|
|
|
+ saveFile.InitialDirectory = Application.StartupPath + "\\Config\\SysData\\";
|
|
|
+ saveFile.OverwritePrompt = false; //是否覆盖当前文件
|
|
|
+ if (saveFile.ShowDialog() == DialogResult.OK)
|
|
|
{
|
|
|
- SaveFileDialog saveFile = new SaveFileDialog();
|
|
|
- saveFile.Title = "Please select the path which to save the file";
|
|
|
- saveFile.Filter = "Database File(*.db)|*.db";
|
|
|
- saveFile.InitialDirectory = Application.StartupPath + "\\Config\\SysData\\";
|
|
|
- saveFile.OverwritePrompt = false; //是否覆盖当前文件
|
|
|
- //saveFile.RestoreDirectory = true; //还原上次目录
|
|
|
- if (saveFile.ShowDialog() == DialogResult.OK)
|
|
|
+ if (STDDBAddress == saveFile.FileName)
|
|
|
{
|
|
|
- if (STDDBAddress == saveFile.FileName)
|
|
|
- {
|
|
|
- MessageBox.Show("不能另存为同名文件!", "Tip");
|
|
|
- return;
|
|
|
- }
|
|
|
- System.IO.File.Copy(STDDBAddress, saveFile.FileName, true);
|
|
|
- bool result = SaveAsDictionaryToClassify(saveFile.FileName);
|
|
|
+ MessageBox.Show("不能另存为同名文件!", "Tip");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ FormForWaiting forWaiting = new FormForWaiting();
|
|
|
+ forWaiting.Show();
|
|
|
+ System.IO.File.Copy(STDDBAddress, saveFile.FileName, true);
|
|
|
+ bool result = SaveAsDictionaryToClassify(saveFile.FileName);
|
|
|
+ if (result)
|
|
|
+ {
|
|
|
+ STDDictionaryInitial.Clear();
|
|
|
+ STDDictionaryInitial = Clone(STDDictionary) as Dictionary<int, STDdata>;
|
|
|
STDDBAddress = saveFile.FileName;
|
|
|
this.Text = this.Text.Split(' ')[0] + " " + saveFile.FileName;
|
|
|
+ IsModified = false;
|
|
|
+ forWaiting.Close();
|
|
|
+ MessageBox.Show("Save successful!", "Tip");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- return;
|
|
|
+ forWaiting.Close();
|
|
|
+ MessageBox.Show("Save failed!", "Tip");
|
|
|
}
|
|
|
}
|
|
|
- catch (Exception ex)
|
|
|
+ else
|
|
|
{
|
|
|
- MessageBox.Show(ex.Message);
|
|
|
+ return;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
- else
|
|
|
+ catch (Exception ex)
|
|
|
{
|
|
|
- try
|
|
|
- {
|
|
|
- SaveFileDialog saveFile = new SaveFileDialog();
|
|
|
- saveFile.Title = "Please select the path which to save the file";
|
|
|
- saveFile.Filter = "Database File(*.db)|*.db";
|
|
|
- saveFile.OverwritePrompt = true; //是否覆盖当前文件
|
|
|
- saveFile.RestoreDirectory = true; //还原上次目录
|
|
|
- if (saveFile.ShowDialog() == DialogResult.OK)
|
|
|
- {
|
|
|
- System.IO.File.Copy(STDDBAddress, saveFile.FileName, true);
|
|
|
- bool result = SaveDictionaryToClassify(saveFile.FileName);
|
|
|
- if (result)
|
|
|
- {
|
|
|
- MessageBox.Show("Export file successful!", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- MessageBox.Show(ex.Message);
|
|
|
- }
|
|
|
+ MessageBox.Show(ex.Message);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -294,65 +278,32 @@ namespace OTSPartA_STDEditor
|
|
|
|
|
|
private void rbSave_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
- if (m_STDRuleslist.Grid_Minerals.RowsCount > 1)
|
|
|
+ if (m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row > 0)
|
|
|
+ {
|
|
|
+ SaveDataOfSelRule(m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row, 0);
|
|
|
+ }
|
|
|
+ if (RuleformatcheckAndSave())
|
|
|
{
|
|
|
- if (m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row > 0)
|
|
|
+ FormForWaiting forWaiting = new FormForWaiting();
|
|
|
+ forWaiting.Show();
|
|
|
+ bool result = SaveDictionaryToClassify(STDDBAddress);
|
|
|
+ if (result)
|
|
|
{
|
|
|
- if (m_STDRuleslist.Grid_Minerals[m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row, 0].Value.ToString().Replace(" ", "").Trim() != "")
|
|
|
- {
|
|
|
- SaveDataOfSelRule(m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row, 0);
|
|
|
- if (RuleformatcheckAndSave())
|
|
|
- {
|
|
|
- FormForWaiting forWaiting = new FormForWaiting();
|
|
|
- forWaiting.Show();
|
|
|
- bool result = SaveDictionaryToClassify(STDDBAddress);
|
|
|
- if (result)
|
|
|
- {
|
|
|
- STDDictionaryInitial.Clear();
|
|
|
- STDDictionaryInitial = Clone(STDDictionary) as Dictionary<int, STDdata>;
|
|
|
- forWaiting.Close();
|
|
|
- IsModified = false;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- forWaiting.Close();
|
|
|
- MessageBox.Show("Save failed!", "Tip");
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
+ STDDictionaryInitial.Clear();
|
|
|
+ STDDictionaryInitial = Clone(STDDictionary) as Dictionary<int, STDdata>;
|
|
|
+ forWaiting.Close();
|
|
|
+ IsModified = false;
|
|
|
+ MessageBox.Show("Save successful!", "Tip");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- Position pos = new Position(1, 0);
|
|
|
- m_STDRuleslist.Grid_Minerals[1, 0].Grid.Select();
|
|
|
- if (m_STDRuleslist.Grid_Minerals[m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row, 0].Value.ToString().Replace(" ", "").Trim() != "")
|
|
|
- {
|
|
|
- FormForWaiting forWaiting = new FormForWaiting();
|
|
|
- forWaiting.Show();
|
|
|
- SaveDataOfSelRule(m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row, 0);
|
|
|
- bool result = SaveDictionaryToClassify(STDDBAddress);
|
|
|
- if (result)
|
|
|
- {
|
|
|
- STDDictionaryInitial.Clear();
|
|
|
- STDDictionaryInitial = new Dictionary<int, STDdata>(STDDictionary);
|
|
|
- forWaiting.Close();
|
|
|
- IsModified = false;
|
|
|
- MessageBox.Show("Save successful!", "Tip");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- forWaiting.Close();
|
|
|
- MessageBox.Show("Save failed!", "Tip");
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
+ forWaiting.Close();
|
|
|
+ MessageBox.Show("Save failed!", "Tip");
|
|
|
}
|
|
|
-
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -373,7 +324,6 @@ namespace OTSPartA_STDEditor
|
|
|
m_STDRuleslist.Grid_Minerals.Refresh();
|
|
|
ChangeSTDEditorAndGrid_Attributes(ite.Key);
|
|
|
m_STDRuleslist.PreRow = Convert.ToInt32(ite.Value.ListNum);
|
|
|
- //MessageBox.Show("The expresstion is error!", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
|
return false;
|
|
|
}
|
|
|
}
|