예제 #1
0
        /// <summary>
        /// Add process card to process planning tree
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnConfirm_Click(object sender, EventArgs e)
        {
            if (tvProcessCard.SelectedNode == null || tvProcessCard.SelectedNode.Parent == null)
            {
                MessageBox.Show("请选择工艺文件夹", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            int count = cklProcessCardModuleNames.Items.Count;

            ///这节代码是为了--方便后面扩展
            List <object> objList = new List <object>();

            for (int i = 0; i < count; i++)
            {
                if (cklProcessCardModuleNames.GetItemChecked(i))
                {
                    if (!objList.Contains(cklProcessCardModuleNames.Items[i]))
                    {
                        objList.Add(cklProcessCardModuleNames.Items[i]);
                    }
                }
            }

            if (string.IsNullOrEmpty(txtProcessPlanningName.Text.Trim()))
            {
                MessageBox.Show(GlobalResource.HAVENOTFILLPROCESSPLANNINGNAME);
                txtProcessPlanningName.Focus();
                return;
            }

            if (objList.Count <= 0)
            {
                MessageBox.Show(GlobalResource.HAVENOTSELECTEDCARDMODULE);
                return;
            }
            else
            {
                ProcessPlanning processPlanning = new ProcessPlanning();
                processPlanning.ProcessPlanningId = Guid.NewGuid();
                processPlanning.Name = txtProcessPlanningName.Text.Trim();

                /// 保存工艺规程和卡片
                SaveProcessPlanning(ProcessCardModules, processPlanning);

                ProcessPlanningTreeFrm processProcedureTree = ProcessPlanningTreeFrm.GetInstance();
                processProcedureTree.ShowProcessPlanningTreeFromNew(ProcessCard, processPlanning, tvProcessCard.SelectedNode.Tag.ToString());


                if (processProcedureTree != null && !processProcedureTree.IsDisposed)
                {
                    processProcedureTree.Show(LefttDockPanel, DockState.DockLeft);
                }

                ///关闭当前窗口
                Close();
            }
        }
예제 #2
0
 public static ProcessPlanningTreeFrm GetInstance()
 {
     if (instance == null || instance.IsDisposed)
     {
         lock (_lock)
         {
             if (instance == null || instance.IsDisposed)
             {
                 instance = new ProcessPlanningTreeFrm();
             }
         }
     }
     return(instance);
 }
예제 #3
0
 public SelectProcessCardModuleFrm(ProcessPlanningTreeFrm processPlanningTree)
 {
     InitializeComponent();
     this.dgvProcessCardModule.AutoGenerateColumns = false;
     ProcessPlanningTree = processPlanningTree;
 }