void AdjustStaionUI()
 {
     if (InvokeRequired)
     {
         Invoke(new Action(AdjustStaionUI));
         return;
     }
     tabControlCF1.TabPages.Clear();
     if (null == _station)
     {
         return;
     }
     string[] flowNames = _station.WorkFlowNames;
     if (null == flowNames)
     {
         return;
     }
     foreach (string flowName in flowNames)
     {
         TabPage tp = new TabPage(flowName);
         FormStationWorkFlowCfg fm = new FormStationWorkFlowCfg();
         fm.FormBorderStyle = FormBorderStyle.None;
         tabControlCF1.TabPages.Add(tp);
         fm.TopLevel = false;
         tp.Controls.Add(fm);
         fm.Parent = tp;
         fm.Dock   = DockStyle.Fill;
         fm.SetStationWorkFlow(_station, flowName);
         fm.Show();
     }
 }
 void DataGridViewCellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == 1) //调试工作流
     {
         FormStationWorkFlowCfg dlg = new FormStationWorkFlowCfg();
         string workFlowName        = dgvWorkFlows.Rows[e.RowIndex].Cells[0].Value as string;
         dlg.SetStationWorkFlow(_station, workFlowName);
         dlg.ShowDialog();
     }
     else if (e.ColumnIndex == 2) //从文件中导入
     {
         string         workFlowName = dgvWorkFlows.Rows[e.RowIndex].Cells[0].Value as string;
         JFMethodFlow   flow         = _station.GetWorkFlow(workFlowName);
         OpenFileDialog ofd          = new OpenFileDialog();
         ofd.Filter = "JF流程文件(*.jff) | *.jff";
         //ofd.InitialDirectory = Application.StartupPath;
         ofd.ValidateNames   = true;
         ofd.CheckPathExists = true;
         ofd.CheckFileExists = false;
         if (ofd.ShowDialog() == DialogResult.OK)
         {
             if (DialogResult.OK == MessageBox.Show(string.Format("确定将文件:{0} 导入到工作流{1}?", ofd.FileName, workFlowName)))
             {
                 try
                 {
                     flow.Load(ofd.FileName);
                     _station.SaveCfg();
                     MessageBox.Show("导入成功!");
                 }
                 catch (Exception ex)
                 {
                     MessageBox.Show("载入失败!异常信息:" + ex.ToString());
                 }
             }
         }
     }
     else if (e.ColumnIndex == 3) //导出工作流到文件
     {
         string         workFlowName = dgvWorkFlows.Rows[e.RowIndex].Cells[0].Value as string;
         JFMethodFlow   flow         = _station.GetWorkFlow(workFlowName);
         OpenFileDialog ofd          = new OpenFileDialog();
         ofd.Filter = "JF流程文件(*.jff) | *.jff";
         //ofd.InitialDirectory = Application.StartupPath;
         ofd.ValidateNames   = true;
         ofd.CheckPathExists = true;
         ofd.CheckFileExists = false;
         if (ofd.ShowDialog() == DialogResult.OK)
         {
             flow.Save(ofd.FileName);
             MessageBox.Show("导出文件成功!");
         }
     }
 }