Example #1
0
 private void FMain_Activated(object sender, EventArgs e)
 {
     if (this.panelMain.Controls.Count > 0 && this.panelMain.Controls[0] is FImpFormBase)
     {
         this.panelMain.Focus();
         FImpFormBase f = (FImpFormBase)this.panelMain.Controls[0];
         f.Activate();
         f.Focus();
         f.SetActive();
     }
 }
Example #2
0
        private FImpFormBase CreateImportForm(ConfigObject cfgObj)
        {
            FImpFormBase fImp = null;

            switch (cfgObj.Name)
            {
            case "Operation":
                fImp = new FImpOP();
                break;

            case "Item2Route":
                fImp = new FImpItemRoute();
                break;

            default:
                fImp = new FImpFormBase();
                break;
            }
            return(fImp);
        }
Example #3
0
        private void trvMain_DoubleClick(object sender, EventArgs e)
        {
            TreeNode selectedNode = trvMain.SelectedNode;

            if (selectedNode == null)
            {
                return;
            }
            XmlNode nodeCfg = (XmlNode)selectedNode.Tag;

            if (nodeCfg == null)
            {
                return;
            }
            if (nodeCfg.Attributes["ImportItemName"] == null)
            {
                return;
            }

            string strImportName = nodeCfg.Attributes["ImportItemName"].FirstChild.Value;

            if (strImportName == "")
            {
                return;
            }
            ConfigObject cfgObj = null;

            for (int i = 0; i < this.configObjList.Count; i++)
            {
                if (this.configObjList[i].Name == strImportName)
                {
                    cfgObj = this.configObjList[i];
                    break;
                }
            }
            if (cfgObj == null)
            {
                return;
            }

            this.Cursor = Cursors.WaitCursor;
            for (int i = 0; i < this.panelMain.Controls.Count; i++)
            {
                if (this.panelMain.Controls[i] is FImpFormBase)
                {
                    ((FImpFormBase)this.panelMain.Controls[i]).Close();
                }
            }

            string strFile = ApplicationService.TemplateFolder + cfgObj.TemplateFileName;

            //2#条码的导入做特殊处理
            if (nodeCfg.Attributes["ImportItemName"].Value == "No2Seq")
            {
                string path = nodeCfg.Attributes["FromFile"].Value;
                if (path != null && path != string.Empty)
                {
                    try
                    {
                        System.IO.File.Copy(path, strFile, true);
                    }
                    catch { }
                }
            }

            FImpFormBase fImp = null;

            if (this.panelMain.Controls.Count > 0 && this.panelMain.Controls[0] is FImpFormBase)
            {
                fImp = (FImpFormBase)this.panelMain.Controls[0];
                //fImp.CloseExcelWorkbook();

                this.panelMain.Controls.Clear();
                Application.DoEvents();
                fImp          = CreateImportForm(cfgObj);
                fImp.MainForm = this;
                fImp.TopLevel = false;
                fImp.Dock     = DockStyle.Fill;
                this.panelMain.Controls.Add(fImp);
            }
            else
            {
                this.panelMain.Controls.Clear();
                fImp          = CreateImportForm(cfgObj);
                fImp.MainForm = this;
                fImp.TopLevel = false;
                fImp.Dock     = DockStyle.Fill;
                this.panelMain.Controls.Add(fImp);
            }
            fImp.CurrentImportName = cfgObj.Name;
            fImp.configMatchType   = this.configMatchType;
            fImp.configObjList     = this.configObjList;

            fImp.ShowExcel(strFile);
            fImp.Visible = true;

            this.Cursor = Cursors.Default;

            this.Activate();
        }