/// <summary> /// 配置项目中的文件配置 /// </summary> /// <param name="fileConfig"></param> private void ConfigProjectPara(LaserProject InProjectdata) { if (InProjectdata.ProjectName != "") { MainLaserProject = new LaserProject(InProjectdata); } }
/// <summary> /// 新建项目 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CreateProject_Click(object sender, EventArgs e) { if ((MainLaserProject.ProjectName == "") || (MainLaserProject.ProjectName == null))//项目名为空 { ProjectConfig projectConfig = new ProjectConfig(); projectConfig.SendData += IniProjectPara; projectConfig.ShowDialog(); } else { DialogResult dr = MessageBox.Show(string.Format("是否保存当前项目\"{0}\"到文件", MainLaserProject.ProductName), "项目关闭", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dr == DialogResult.OK) { SaveProjectToFile(); MainLaserProjectpath = null; } else { MainLaserProject = new LaserProject();//清空项目 } ProjectConfig projectConfig = new ProjectConfig(); projectConfig.SendData += IniProjectPara; projectConfig.ShowDialog(); } }
/// <summary> /// 获取当前项目参数 /// </summary> /// <param name="Indata"></param> public void GetProject(LaserProject Indata) { ScissorFormProject = new LaserProject(Indata); //刷新产品名称列表 RefreshProductNamecomboBox(); //刷新文档信息 RefreshDocument(); }
/// <summary> /// 打开项目 /// </summary> private void OpenProjectByFile() { OpenFileDialog OpenFileDialog = new OpenFileDialog(); OpenFileDialog.Filter = "laserpro files (*.laserpro)|*.laserpro"; OpenFileDialog.FilterIndex = 2; OpenFileDialog.RestoreDirectory = true; if (OpenFileDialog.ShowDialog() == DialogResult.OK) { MainLaserProject = new LaserProject(); MainLaserProject = OperatePara.LoadXmlNoPath <LaserProject> .LoadPara(OpenFileDialog.FileName); } }
/// <summary> /// 打开项目 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OpenProject_Click(object sender, EventArgs e) { if ((MainLaserProject.ProjectName == "") || (MainLaserProject.ProjectName == null))//项目名为空 { OpenProjectByFile(); } else { DialogResult dr = MessageBox.Show(string.Format("是否保存当前项目\"{0}\"到文件", MainLaserProject.ProductName), "项目关闭", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dr == DialogResult.OK) { SaveProjectToFile(); MainLaserProjectpath = null; } else { MainLaserProject = new LaserProject(); //清空项目 } OpenProjectByFile(); //打开项目 } }
/// <summary> /// 关闭项目 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CloseProject_Click(object sender, EventArgs e) { if ((MainLaserProject.ProjectName == "") || (MainLaserProject.ProjectName == null))//项目名为空 { MessageBox.Show("当前项目为空,请先建立项目!"); return; } if (MainLaserProjectpath != null) { return; //项目已经保存过 } DialogResult dr = MessageBox.Show(string.Format("是否保存项目\"{0}\"到文件", MainLaserProject.ProductName), "项目关闭", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dr == DialogResult.OK) { SaveProjectToFile(); MainLaserProjectpath = null; } else { MainLaserProject = new LaserProject();//清空项目 } }
/// <summary> /// 新建项目参数修改 /// </summary> /// <param name="ProjectName"></param> /// <param name="ProductName"></param> /// <param name="MaterialName"></param> private void IniProjectPara(string ProjectName, string ProductName, string MaterialName) { if (ProjectName == "") { MessageBox.Show("项目名称不能为空"); return; } else if (ProductName == "") { MessageBox.Show("产品名称不能为空"); return; } else if (MaterialName == "") { MessageBox.Show("材料名称不能为空"); return; } //正确的生成参数 MainLaserProject = new LaserProject();//释放资源 MainLaserProject.ProjectName = ProjectName; MainLaserProject.ProductName = ProductName; MainLaserProject.MaterialName = MaterialName; //使能按钮操作部分 }
/// <summary> /// 获取当前项目参数 /// </summary> /// <param name="Indata"></param> public void GetProject(LaserProject Indata) { MarkConfigProject = new LaserProject(Indata); //刷新产品名称列表 RefreshDocumentcomboBox(); }