예제 #1
0
파일: Form1.cs 프로젝트: vmax44/parser
        private void button1_Click(object sender, EventArgs e)
        {
            string detailCode = "";

            using (Parser browser = new ParserWatinAutodoc())
            {
                //browser.Visible = false;
                browser.GetSelectedManufacturer = SelectFromStringList;
                Excel.Application codesEx = new Excel.Application();

                codesEx.Workbooks.Open(Path.Combine(Application.StartupPath, "code.xlsx"));

                var row = 1;

                while ((codesEx.Cells[row, 2].Value != null) && (codesEx.Cells[row, 2].Value != ""))
                {
                    detailCode = codesEx.Cells[row, 2].Value;
                    dataBase.AddRange(browser.detailParse(detailCode));
                    row++;
                }

                codesEx.ActiveWorkbook.Close();
                codesEx.Quit();

                //browser.Close();
                var tmp = dataCollectionBindingSource.ToString();

                dataCollectionBindingSource.ResetBindings(false);
                textBox1.AppendText(dataBase.ToString());
            }
        }
예제 #2
0
파일: Form1.cs 프로젝트: vmax44/parser
 public void gotest()
 {
     using (var browser = new ParserWatinAutodoc())
     {
         try
         {
             browser.GetSelectedManufacturer = SelectFromStringList;
             var result = browser.detailParse("5000A046");
             MessageBox.Show("Напарсено позиций -" + result.Count + "\r\n" + result.ToString());
         }
         catch (NotImplementedException ex)
         {
             MessageBox.Show("Функция не доделана -" + ex.Message);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
     }
 }