|
|
@@ -57,12 +57,20 @@ namespace OTSModelSharp.Measure.GetStageInfo
|
|
|
|
|
|
private void DlgStageMgr_Load(object sender, EventArgs e)
|
|
|
{
|
|
|
-
|
|
|
+ SetStageListControlData();
|
|
|
+ m_ctrlListBoxStageList.Text = MultiLang.GetInstance().GetStringByKey(OTSModelresource.GrpOtherParam, OTSModelresource.DlgStageMgr_StageList);
|
|
|
+ m_ctrlBtnApply.Text = MultiLang.GetInstance().GetStringByKey(OTSModelresource.GrpOtherParam, OTSModelresource.DlgStageMgr_Apply);
|
|
|
+ m_ctrlBtnDelete.Text = MultiLang.GetInstance().GetStringByKey(OTSModelresource.GrpOtherParam, OTSModelresource.DlgStageMgr_Delete);
|
|
|
+ m_ctrlBtnRename.Text=MultiLang.GetInstance().GetStringByKey(OTSModelresource.GrpOtherParam, OTSModelresource.DlgStageMgr_Rename);
|
|
|
+ IDC_BTN_IMPORT.Text= MultiLang.GetInstance().GetStringByKey(OTSModelresource.GrpOtherParam, OTSModelresource.DlgStageMgr_Import);
|
|
|
+ m_ctrlBtnExport.Text=MultiLang.GetInstance().GetStringByKey(OTSModelresource.GrpOtherParam, OTSModelresource.DlgStageMgr_Export);
|
|
|
+
|
|
|
+ this.Text=MultiLang.GetInstance().GetStringByKey(OTSModelresource.GrpOtherParam, OTSModelresource.DlgStageMgr_Title);
|
|
|
}
|
|
|
|
|
|
|
|
|
// CDlgStageMgr message map
|
|
|
- public void OnClickedBtnImport()
|
|
|
+ public void OnClickedBtnImport(object sender, EventArgs e)
|
|
|
{
|
|
|
loger.Trace("OnClickedBtnImport: import a stage from txt file.");
|
|
|
|
|
|
@@ -112,7 +120,7 @@ namespace OTSModelSharp.Measure.GetStageInfo
|
|
|
|
|
|
}
|
|
|
|
|
|
- public void OnClickedBtnAply()
|
|
|
+ public void OnClickedBtnAply(object sender, EventArgs e)
|
|
|
{
|
|
|
|
|
|
loger.Info("OnClickedBtnAply: the selected stage will be the working stage.");
|
|
|
@@ -132,7 +140,7 @@ namespace OTSModelSharp.Measure.GetStageInfo
|
|
|
this.Close(); //CDialog::OnOK();
|
|
|
}
|
|
|
|
|
|
- public void OnClickedBtnDel()
|
|
|
+ public void OnClickedBtnDel(object sender, EventArgs e)
|
|
|
{
|
|
|
loger.Info("OnClickedBtnDel: the selected stage will be deleted.");
|
|
|
|
|
|
@@ -161,47 +169,76 @@ namespace OTSModelSharp.Measure.GetStageInfo
|
|
|
|
|
|
}
|
|
|
|
|
|
- public void OnClickedBtnExport()
|
|
|
+ public void OnClickedBtnExport(object sender, EventArgs e)
|
|
|
{
|
|
|
loger.Info("OnClickedBtnExport: the selected stage will be export stage into a txt.");
|
|
|
|
|
|
UpdateStageFileData(true);
|
|
|
+ // export a stage into text file
|
|
|
+ SaveFileDialog saveFileDialog = new SaveFileDialog();
|
|
|
+ saveFileDialog.DefaultExt = null;
|
|
|
+ saveFileDialog.InitialDirectory = null;
|
|
|
+ saveFileDialog.CheckPathExists = true;
|
|
|
+ saveFileDialog.Filter = "txt files(*.txt)|*.txt|All files(*.*)|*.*";
|
|
|
|
|
|
+ DialogResult dr = saveFileDialog.ShowDialog();
|
|
|
|
|
|
- // export a stage into text file
|
|
|
- CFileDialog dlg(FALSE, NULL, NULL, OFN_FILEMUSTEXIST, TEXTFILE_FILTER);
|
|
|
- if (dlg.DoModal() == IDOK)
|
|
|
+ if (dr == System.Windows.Forms.DialogResult.OK)
|
|
|
{
|
|
|
- // get file path
|
|
|
- CString strPathName = dlg.GetPathName() + TEXTFILE_FILE_EXT;
|
|
|
- if (strPathName.IsEmpty())
|
|
|
+ string strPathName = saveFileDialog.FileName;
|
|
|
+ if (string.IsNullOrEmpty(strPathName))
|
|
|
{
|
|
|
- LogErrorTrace(__FILE__, __LINE__, _T("OnClickedBtnExport: empty path."));
|
|
|
+ loger.Error("OnClickedBtnExport: empty path.");
|
|
|
return;
|
|
|
}
|
|
|
- m_pStageFile->SaveStageIntoTextFile(m_nListBoxStageList, strPathName);
|
|
|
+ m_pStageFile.SaveStageIntoTextFile(m_nListBoxStageList, strPathName);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- LogErrorTrace(__FILE__, __LINE__, _T("OnClickedBtnExport: export action is cancled."));
|
|
|
+ loger.Error("OnClickedBtnExport: export action is cancled.");
|
|
|
return;
|
|
|
}
|
|
|
+ SetStageListControlData();
|
|
|
+ }
|
|
|
|
|
|
- SaveFileDialog saveFileDialog = new SaveFileDialog();
|
|
|
- saveFileDialog.DefaultExt = null;
|
|
|
- saveFileDialog.InitialDirectory = null;
|
|
|
- saveFileDialog.
|
|
|
+ public void OnClickedBtnRename(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ loger.Trace("OnClickedBtnRename: the selected stage will be renamed.");
|
|
|
|
|
|
- DialogResult dr = saveFileDialog.ShowDialog();
|
|
|
- if (dr == System.Windows.Forms.DialogResult.OK && !string.IsNullOrEmpty(saveFileDialog.FileName.ToString()))
|
|
|
+ UpdateStageFileData(true);
|
|
|
+
|
|
|
+ DlgStageRename dlg = new DlgStageRename(); ;
|
|
|
+ if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
|
|
+ {
|
|
|
+ CStage pStage = m_pStageFile.GetStagesList()[m_nListBoxStageList];
|
|
|
+ pStage.SetName(dlg.m_sStageName);
|
|
|
+ m_pStageFile.SetModify();
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- StreamWriter sw = new StreamWriter(filename, true, Encoding.UTF8);
|
|
|
- sw.Write(textBox1.Text);
|
|
|
- sw.Close();
|
|
|
+ loger.Error("OnClickedBtnRename: rename action is cancled.");
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
+ SetStageListControlData();
|
|
|
+ }
|
|
|
|
|
|
+ void OnSelchangeListStage(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ loger.Trace("OnSelchangeListStage: change a working stage.");
|
|
|
+ UpdateStageFileData(true);
|
|
|
SetStageListControlData();
|
|
|
+ DrawStage();
|
|
|
+ }
|
|
|
+
|
|
|
+ void OnPaint(object sender, PaintEventArgs e)
|
|
|
+ {
|
|
|
+ //CPaintDC dc(this); // device context for painting
|
|
|
+
|
|
|
+ if (!m_bShowFlag)
|
|
|
+ {
|
|
|
+ this.DrawStage();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public void SetStageListControlData()
|
|
|
@@ -382,9 +419,9 @@ namespace OTSModelSharp.Measure.GetStageInfo
|
|
|
}
|
|
|
|
|
|
// soft pack id get and set
|
|
|
- public OTS_SOFT_PACKAGE_ID GetPackId() { return m_nPackId; }
|
|
|
+ public otsdataconst.OTS_SOFT_PACKAGE_ID GetPackId() { return m_nPackId; }
|
|
|
|
|
|
- public void SetPackId(OTS_SOFT_PACKAGE_ID a_nPackId) { m_nPackId = a_nPackId; }
|
|
|
+ public void SetPackId(otsdataconst.OTS_SOFT_PACKAGE_ID a_nPackId) { m_nPackId = a_nPackId; }
|
|
|
|
|
|
// draw shape
|
|
|
public void DrawShape(Rectangle a_PixRect, Object a_pDC, DOMAIN_SHAPE a_nShape, bool a_bIsRand) { }
|
|
|
@@ -470,7 +507,7 @@ namespace OTSModelSharp.Measure.GetStageInfo
|
|
|
|
|
|
}
|
|
|
|
|
|
- public CStageFile ShowStageMgrDialog(OTS_SOFT_PACKAGE_ID a_nPackId, CStageFile a_pStageFile)
|
|
|
+ public CStageFile ShowStageMgrDialog(otsdataconst.OTS_SOFT_PACKAGE_ID a_nPackId, CStageFile a_pStageFile)
|
|
|
{
|
|
|
if (a_pStageFile == null)
|
|
|
{
|