private void button2_Click(object sender, EventArgs e) { try { if (dateTimePicker1.Value.Date <= dateTimePicker2.Value.Date) { nFiles = 0; //количество обработанных файлов nDirs = 0;//количество обработанных папок nDirsAll = 0; count = 0; BASE = new BaseNE(); BASE.AddingNE +=AddItemToListbox; listBox1.Items.Clear(); RemoveLabels(); readFtpThread1 = new ParameterizedThreadStart(ReadLocal); readThread1 = new Thread(readFtpThread1); readThread1.Start(Properties.Settings.Default.PM_Path_Local); } else MessageBox.Show("Выбран неверный временной интервал!", "oops"); } catch (Exception) { throw; } }
//read from server private void button1_Click(object sender, EventArgs e) { try { #region EndProcesses if (readThread1 != null && readThread1.IsAlive) { readThread1.Abort(); button1.Text = oldBut; button2.Enabled = true; listBox1.Enabled = true; return; } if(readThread2 != null && readThread2.IsAlive) { readThread2.Abort(); button1.Text = oldBut; button2.Enabled = true; listBox1.Enabled = true; return; } #endregion if (dateTimePicker1.Value.Date <= dateTimePicker2.Value.Date) { nFiles = 0; //количество обработанных файлов nDirs = 0; nDirsAll = 0; indexOfFile=0; count = 0; c_pm15=0; c_pm24=0; BASE=new BaseNE(); //Base of NE BASE.AddingNE += AddItemToListbox; RemoveLabels(); listBox1.Items.Clear(); readFtpThread1 = new ParameterizedThreadStart(ReadAndCopyFiles); readThread1 = new Thread(readFtpThread1); readThread1.Start(Properties.Settings.Default.PM_Path_Server100); readFtpThread2 = new ParameterizedThreadStart(ReadAndCopyFiles); readThread2 = new Thread(readFtpThread2); readThread2.Start(Properties.Settings.Default.PM_Path_Server101); } else MessageBox.Show("Выбран неверный временной интервал!", "ой"); } catch (Exception) { throw; } }
//load stat for selected NE private void contextmenuLoad_Click(object sender, EventArgs e) { if (listBox1.SelectedItems.Count == 0) return; string NE_Name = listBox1.SelectedItem.ToString(); if (dateTimePicker1.Value.Date <= dateTimePicker2.Value.Date) { nFiles = 0; //количество обработанных файлов nDirs = 0;//количество обработанных папок nDirsAll = 0; count = 0; string[] files = FindFileName(NE_Name); BASE = new BaseNE(); BASE.AddingNE += AddItemToListbox; listBox1.Items.Clear();//??? RemoveLabels(); readThread1 = new Thread(delegate() { ReadLocalOne(Properties.Settings.Default.PM_Path_Local, files); }); readThread1.Start(); } else MessageBox.Show("Выбран неверный временной интервал!", "oops"); }