コード例 #1
0
ファイル: Frm_Main.cs プロジェクト: xhyangxianjun/wangliang
        private void Frm_load_Tick()
        {
            Frm_LoadProcess.Ex = "正在加载参数配置文件...    10%";
            Application.DoEvents();

            PVar.ReDimSpassWord(); //定义用户
            Frm_Engineering.fEngineering.DataGridView_par.RowCount = 12;
            ArrayInit();           //数组重新定义
            for (short i = 0; i <= 99; i++)
            {
                PVar.BarcodeArrayList[i] = BVar.FileRorW.ReadINI((i).ToString(), "SN", "", PVar.ListDataIniPath);
            }
            Frm_Engineering.ReadParAxis(PVar.ParAxisPath, PVar.ParAxis);//读取机械参数
            Frm_Par FrmPar = new DAB.Frm_Par();

            FrmPar.Par_Normal("Read"); //加载参数界面参数
            if (!PVar.IsReadParData)
            {
                if (Interaction.MsgBox("ReadParData()函数读取数据失败,程序拒绝加载!", Constants.vbExclamation, "重要参数文件") == Constants.vbOK)
                {
                    ProjectData.EndApp();
                }
            }

            mFunction.ReDimData();
            mFunction.ReadPosData(PVar.BZ_ParameterPath + "\\PosData.dat", mFunction.Pos);
            if (!PVar.IsReadPosData)
            {
                if (Interaction.MsgBox("ReadPosData()函数读取数据失败,程序拒绝加载!", Constants.vbExclamation, "重要参数文件") == Constants.vbOK)
                {
                    ProjectData.EndApp();
                }
            }

            Frm_LoadProcess.Ex = "正在初始化工程界面...    70%";
            Application.DoEvents();
            MainUserNameDisplay(); //新用户添加到主界面
            if (MainUserName.Items.Count <= 0)
            {
                PVar.Login.NewGroup[1]         = "Engineering";
                PVar.Login.NewUser[0]          = "Engineering";
                PVar.Login.NewPassword[0]      = "BZ";
                PVar.Login.NewUserAuthority[0] = 2;
                MainUserName.Items.Add(PVar.Login.NewUser[0]);
                Frm_Login.fLogin.MainUserName.Items.Add(PVar.Login.NewUser[0]);
                FileRw.WriteDatFilePassWord(PVar.BZ_ParameterPath + "PassWord.dat", PVar.Login);
            }
            PVar.LampStatus       = 10;
            Btn_Stop.BZ_BackColor = PVar.BZColor_SelectedEndBtn;
            Frm_Engineering.fEngineering.Show(this);
            Frm_Engineering.fEngineering.Visible = false;
            Frm_Production FrmProduction = new Frm_Production();

            FrmProduction.Show(this);
            Frm_Production.fProduction.Visible = false;
            Btn_Pause.Enabled         = false;
            Btn_Stop.Enabled          = false;
            PVar.IsOpenFrmEngineering = false;
            PVar.IsOpenFrmProduction  = false;
            Frm_Engineering.fEngineering.TestDataGridInit(); //加载表格数据
            Frm_LoadProcess.Ex = "正在初始化运动控制卡...    95%";
            Application.DoEvents();
            Gg.GTS_MotionInit(0, 8, (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath + "\\GTS_Config\\GTS800-00.cfg");

            Gg.GTS_ExtmdlInit(1, (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath + "\\GTS_Config\\ExtModule.cfg");
            Command.Com3_Send("LMD,4SPLN,00" + ",000,000,000,000,"); //关闭所有光源
            Frm_LoadProcess.Ex = "加载完成...    100%";
            Application.DoEvents();
            PVar.WorkMode = 0;
            //WriteCsvErrorCodePRE();
            this.Show();
        }