コード例 #1
0
ファイル: MainForm2.cs プロジェクト: qwdingyu/C-
        private void button8_Click(object sender, EventArgs e)
        {
            Matcher.Matcher.readAllCarParams("", @"D:\柔性参数填报系统\上海通用\data.xls");
            ChooseSample cs = new ChooseSample();

            cs.ShowDialog();
            LoginAction.tryLogin(this.mainWebBrowser);
        }
コード例 #2
0
ファイル: MainRibbonForm.cs プロジェクト: qwdingyu/C-
        //private void Form1_FormClosing(object sender, EventArgs e)
        //{
        //    Application.Exit();
        //}

        //protected override void OnResize(EventArgs e)
        //{
        //    base.OnResize(e);
        //    if (cccFiller != null && ribbon.SelectedPage.Text == "CCC")
        //        cccFiller.SetWindowPos();
        //}

        //protected override void OnLocationChanged(EventArgs e)
        //{
        //    base.OnLocationChanged(e);
        //    if (cccFiller != null && ribbon.SelectedPage.Text == "CCC")
        //        cccFiller.SetWindowPos();
        //}

        //protected override void OnSizeChanged(EventArgs e)
        //{
        //    base.OnSizeChanged(e);
        //    if (cccFiller != null && ribbon.SelectedPage.Text == "CCC")
        //        cccFiller.SetWindowPos();
        //}

        private void barButtonItem2_ItemClick(object sender, ItemClickEventArgs e)
        {
            try
            {
                //判断dataFile地址是不是为空
                if (this.dataFileTextBox.EditValue == null)
                {
                    throw new Exception("数据文件未导入,请选择数据文件");
                }
                String        dataFilePath    = this.dataFileTextBox.EditValue.ToString();
                String        ruleFilePath    = ParamsCollection.localAddr + "rules.xls";
                ImportAction  importAction    = new ImportAction();
                List <String> listPackageCode = importAction.importDataAndRules(ruleFilePath, dataFilePath);

                ChooseSample cs = new ChooseSample();
                if (cs.ShowDialog() == System.Windows.Forms.DialogResult.Yes)
                {
                    importAction.deleteUnselectedCarParams(ParamsCollection.selectedPackageCodes);
                    StringBuilder sb = new StringBuilder();
                    for (int i = 0; i < ParamsCollection.carParams.Count; i++)
                    {
                        CarParams cps = ParamsCollection.carParams[i];
                        ParamsCollection.runningCarParams = cps;
                        this.RunningCarInfo.Caption       = "当前正在处理的车型为" + cps.packageCode + "  (" + (i + 1) + "/" + ParamsCollection.carParams.Count + ")";
                        cps.listHtmlAttributes.Clear();
                        cps.listHtmlAttributes.AddRange(DataTransformServiceForHCBM.getAllHAInACar(cps.listParams, ParamsCollection.dicRules));
                        LoginAction.tryLogin(this.mainWebBrowser);
                        this.wait(1);
                        this.mainWebBrowser.Navigate(Constants.APPLY_TEMPORARY_SEQUENCE_NUMBER_PAGE);
                        this.wait(1);
                        FillConfigurationAction f = new FillConfigurationAction(this.mainWebBrowser);
                        f.fillConfigTest(cps.listHtmlAttributes);
                        this.wait(1);
                        //f.submit();
                        this.wait(1);
                        //while (String.IsNullOrEmpty(ParamsCollection.runningCarParams.configCode))
                        //{
                        //    Application.DoEvents();
                        //}
                        this.wait(1);
                        f = new FillConfigurationAction(this.mainWebBrowser);
                        ExportServiceForHCBM.exportCarParams(dataFilePath, cps);
                        //在网页上直接提交车型
                        //f.submitConfigCode(ParamsCollection.runningCarParams.configCode);
                        //while (ParamsCollection.runningCarParams.submitConfigCode != true)
                        //{
                        //    Application.DoEvents();
                        //}
                    }
                    //LoggerUtils.LoggerUtils.loggerTxt(@"d:\test.txt", sb.ToString());
                    this.mainWebBrowser.Url     = new Uri(DeclarationSite.PZSite);
                    this.RunningCarInfo.Caption = "全部任务完成";
                }
                else
                {
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.StackTrace + ex.Message);
            }
        }