private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e) { //progressBarDownload.IsIndeterminate = true; HelpWorker hw = (HelpWorker)e.Argument; FTPSinchronisation.DownloadDb(backgroundWorker, hw.Size); }
private void BackgroundWorker_DoWork_2(object sender, DoWorkEventArgs e) { try { FTPSinchronisation.WriteBD(FTPSinchronisation.PatnLocalTempBDCopy); } catch (Exception ex) { IsErorConetctionFTP = false; MessageBox.Show(ex.Message + MethodBase.GetCurrentMethod().DeclaringType.FullName, "Внимание!", MessageBoxButton.OK, MessageBoxImage.Error); return; } }
private void buttonFromCloudAudio_Click(object sender, RoutedEventArgs e) { IsErorConetctionFTPAudio = true; try { //progressBarDownload.IsIndeterminate = true; IEnumerable <string> listSound = FTPSinchronisation.GetListSound(true); int max = listSound.Count(); if (max > 0) { progressBarDownload.Maximum = max; } backgroundWorkerLoadAudio.RunWorkerAsync(listSound); } catch (Exception ex) { MessageBox.Show(ex.Message + MethodBase.GetCurrentMethod().DeclaringType.FullName, "Внимание!", MessageBoxButton.OK, MessageBoxImage.Error); return; } }
private void MenuItemтExcessAudio_Click(object sender, RoutedEventArgs e) { IEnumerable <string> soundFilesDirect = FTPSinchronisation.GetListDirectoryLocal(false); IEnumerable <string> soundFilesDB = BdTools.GetAudio(); IEnumerable <string> except = soundFilesDirect.Except(soundFilesDB); if (except.Count() > 0) { string message = ""; foreach (string item in except) { message += item + "\n"; } MessageBox.Show("В приложении есть аудиофайлу которых нет в БД:\n" + message, "Информация!", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show("В приложении аудиофайлы соответствуют БД", "Информация", MessageBoxButton.OK, MessageBoxImage.Information); } }
private void MenuItemтDeletAudio_Click(object sender, RoutedEventArgs e) { IEnumerable <string> soundFilesDirect = FTPSinchronisation.GetListDirectoryLocal(false); IEnumerable <string> soundFilesDB = BdTools.GetAudio(); IEnumerable <string> except = soundFilesDirect.Except(soundFilesDB); if (except.Count() > 0) { string message = ""; foreach (string item in except) { FileInfo info = FIleTools.DeletFile(FIleTools.NameDirectoryAudio, item); message += info.Name + "\n"; } MessageBox.Show("Удалены лишнии файлы из папки:'SoundFiles':\n" + message, "Информация", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show("В приложении нет аудиофайлов для удаления", "Информация", MessageBoxButton.OK, MessageBoxImage.Information); } }
private void MenuItemControlAudio_Click(object sender, RoutedEventArgs e) { IEnumerable <string> soundFilesDirect = FTPSinchronisation.GetListDirectoryLocal(false); IEnumerable <string> soundFilesDB = BdTools.GetAudio(); IEnumerable <string> intersect = soundFilesDB.Intersect(soundFilesDirect); IEnumerable <string> except = soundFilesDB.Except(intersect); if (except.Count() > 0) { string message = ""; foreach (string item in except) { message += item + "\n"; } MessageBox.Show("В приложении нет аудиофайлов:\n" + message, "Внимание!", MessageBoxButton.OK, MessageBoxImage.Error); } else { MessageBox.Show("В приложении аудиофайлы соответствуют БД", "Информация", MessageBoxButton.OK, MessageBoxImage.Information); } }
private void BackgroundWorker_DoWork_3(object sender, DoWorkEventArgs e) { try { IEnumerable <string> listSound = (IEnumerable <string>)e.Argument; BackgroundWorker worker = sender as BackgroundWorker; int valueProgresBar = 0; foreach (string item in listSound) { string s = item.Remove(0, FTPSinchronisation.PatnDirectorySoundFilesServer.Length + 1); s = s.Insert(0, FTPSinchronisation.PathDirectoryTempAudio); valueProgresBar += FTPSinchronisation.WriteFile(item, s); worker.ReportProgress(valueProgresBar); } } catch (Exception) { IsErorConetctionFTPAudioServer = false; //MessageBox.Show(ex.Message + MethodBase.GetCurrentMethod().DeclaringType.FullName, "Внимание!", MessageBoxButton.OK, MessageBoxImage.Error); throw; } }
private void BackgroundWorker_DoWork_1(object sender, DoWorkEventArgs e) { try { IEnumerable <string> listSound = (IEnumerable <string>)e.Argument; BackgroundWorker worker = sender as BackgroundWorker; int valueProgresBar = 0; foreach (string item in listSound) { valueProgresBar += FTPSinchronisation.DownLoadAudio(item); worker.ReportProgress(valueProgresBar); } //FTPSinchronisation.LoaderAudio(); } catch (Exception ex) { IsErorConetctionFTPAudio = false; MessageBox.Show(ex.Message + MethodBase.GetCurrentMethod().DeclaringType.FullName, "Внимание!", MessageBoxButton.OK, MessageBoxImage.Error); throw; } }
private void buttonToAudioCloud_Click(object sender, RoutedEventArgs e) { IsErorConetctionFTPAudioServer = true; try { listSounds = FTPSinchronisation.GetListSound(false); //MessageBox.Show(listSound.GetType().ToString()); //return; int max = listSounds.Count(); if (max > 0) { progressBarDownload.Maximum = max; } CopyAudio(listSounds); backgroundWorkerWriteSeverAudio.RunWorkerAsync(listSounds); } catch (Exception ex) { MessageBox.Show(ex.Message + MethodBase.GetCurrentMethod().DeclaringType.FullName, "Внимание!", MessageBoxButton.OK, MessageBoxImage.Error); return; } }