Beispiel #1
0
        private void FileWatcherOnFileCreated(object sender, FileSystemEventArgs e)
        {
            if (e.FullPath.Contains(".temp")) return;
                
            string temp = e.FullPath + ".temp";

            try
            {
                if(File.Exists(temp)) File.Delete(temp);
                File.Copy(e.FullPath, temp);
            }catch{}

            try
            {
                FileDbEngine<ExchangeDataContainer> exContainerEngine = new FileDbEngine<ExchangeDataContainer>(temp);
                this.container = exContainerEngine.LoadFileDB();
            }
            catch { MessageBox.Show("load failed."); }

            this.Invoke((MethodInvoker)(() => 
            {
                if (this.cbIgnoreRefresh.Checked) return;
                
                try
                {
                    this.dataGridView1.DataSource = container.FisrtList;
                    this.dataGridView2.DataSource = container.SecondList;

                    this.tbProductId.Text = container.FisrtList.First().ProductionID;
                    this.webBrowser1.Navigate("https://zhaocaibao.alipay.com/pf/purchase.htm?productId=" + this.tbProductId.Text);

                    
                    File.Delete(e.FullPath);
                    File.Delete(temp);
                }
                catch { }

            }));

           
        }
Beispiel #2
0
        private void btnLoad_Click(object sender, EventArgs e)
        {
            try
            {
                string filePath = DirectoryHelper.CombineWithCurrentExeDir("ZcbListExchange\\list.xml");
                FileDbEngine<ExchangeDataContainer> exContainerEngine = new FileDbEngine<ExchangeDataContainer>(filePath);
                this.container = exContainerEngine.LoadFileDB();

                this.dataGridView1.DataSource = container.FisrtList;
                this.dataGridView2.DataSource = container.SecondList;

                var first = container.FisrtList.FirstOrDefault();

                if (first != null)
                {
                    this.tbProductId.Text = container.FisrtList.First().ProductionID;
                    this.webBrowser1.Navigate("https://zhaocaibao.alipay.com/pf/purchase.htm?productId=" + this.tbProductId.Text);
                }
            }
            catch { }
        }