private void saveTaskBtn_Click(object sender, EventArgs e) { // check. if (m_nestPartList.Size() == 0) { MessageBox.Show("No part will be nested.", "NestProfessor DEMO"); return; } if (m_matList.Size() == 0) { MessageBox.Show("No material will be used for nesting.", "NestProfessor DEMO"); return; } SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "Task File|*.xml"; saveFileDialog.RestoreDirectory = true; if (saveFileDialog.ShowDialog() == DialogResult.OK) { String strFilePath = saveFileDialog.FileName; NestTaskEx nestTask = new NestTaskEx(m_nestPartList, m_matList, m_nestParam); TaskStorage.SaveNestTask(strFilePath, nestTask, m_partDxfPath, m_partColorConfig, m_matDxfPath, m_iNestingTime); } }
private void loadTaskBtn_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "Task Files|*.xml"; openFileDialog.RestoreDirectory = true; openFileDialog.FilterIndex = 1; if (openFileDialog.ShowDialog() == DialogResult.OK) { String strFilePath = openFileDialog.FileName; NestTaskEx nestTask = TaskStorage.LoadNestTask_from_taskFile(strFilePath, m_partDxfPath, m_matDxfPath, m_partColorConfig, m_impDataList, ref m_iNestingTime); m_nestParam = nestTask.GetNestParam(); // disable select-change event. m_bDisableSelChgEvent = true; // clean list. partListView.Items.Clear(); matListView.Items.Clear(); // init part list. { m_nestPartList = nestTask.GetNestPartList(); for (int i = 0; i < m_nestPartList.Size(); i++) { AddPart_to_listCtrl(m_nestPartList.GetNestPartByIndex(i), ""); } // select the last row. if (partListView.Items.Count > 0) { partListView.SelectedItems.Clear(); partListView.Items[partListView.Items.Count - 1].Selected = true; partListView.Items[partListView.Items.Count - 1].Focused = true; partListView.Items[partListView.Items.Count - 1].EnsureVisible(); } } // init material. { m_matList = nestTask.GetMatList(); for (int i = 0; i < m_matList.Size(); i++) { AddMat(m_matList.GetMatByIndex(i)); } } // enable select-change event. m_bDisableSelChgEvent = false; Preview_selected_part(); Preview_selected_material(); } }