public frm3DVideo() { InitializeComponent(); ChangeForm = ChangeFormMethod; ChangeStatus = ChangeStatusMethod; CheckFFMpeg(); _youTube = new YouTube(YouTubeProcessFinished,YouTubeImageReady); cmbOrientation.SelectedIndex = 0; _webClient = new WebClient { Proxy = null }; //Make connection smooth _webClient.DownloadProgressChanged += WebClientDownloadProgressChanged; _webClient.DownloadFileCompleted += WebClientDownloadFileCompleted; cmbSampleRate.SelectedIndex = 4; }
public frm3DVideo() { InitializeComponent(); ChangeForm = ChangeFormMethod; ChangeStatus = ChangeStatusMethod; CheckFFMpeg(); _youTube = new YouTube(YouTubeProcessFinished, YouTubeImageReady); cmbOrientation.SelectedIndex = 0; _webClient = new WebClient { Proxy = null }; //Make connection smooth _webClient.DownloadProgressChanged += WebClientDownloadProgressChanged; _webClient.DownloadFileCompleted += WebClientDownloadFileCompleted; cmbSampleRate.SelectedIndex = 4; }
public void ChangeStatus(string oldMessage, string newMessage, int number) { if (listBox.InvokeRequired) { ChangeStatusDelegate d = ChangeStatus; listBox.Invoke(d, oldMessage, newMessage, number); } else { int i = listBox.FindString(oldMessage); if (i != -1) { string[] items = new string[listBox.Items.Count]; listBox.Items.CopyTo(items, 0); items[i] = oldMessage + " " + newMessage + " 接受字节数: " + Math.Ceiling(number / 1024.0f) + "KB,用时: " + stopWatch.ElapsedMilliseconds / 1000.0f; listBox.Items.Clear(); listBox.Items.AddRange(items); listBox.SelectedIndex = i; } } }
public RecalculationService(ChangeStatusDelegate ChangeStatus, SharedDataLoader DataLoader, string ConnectionString, string LogFileName, int PeriodMSec) { this.ChangeStatus = ChangeStatus; this.DataLoader = DataLoader; this.ConnectionString = ConnectionString; this.Log = new FileLogger(LogFileName); this.PeriodMSec = PeriodMSec; MainThread = new Thread(Execute); MainThread.Start(); Log.Message("Сервис пересчёта запущен. ThreadID: {0}", MainThread.ManagedThreadId); }
public SharedDataLoader(ChangeStatusDelegate ChangeStatus, string ConnectionString, string LogFileName, int CheckChangeNotifierIntervalMin, int CheckChangeNotifierTimeoutSec, string UpdatePath, UInt32 UpdateBlockSize/*, CardScriptPlugins CardScripts*/) { this.CurrentGeneration = 0; this.ChangeStatus = ChangeStatus; this.ConnectionString = ConnectionString; this.Log = new FileLogger(LogFileName); this.UpdatePath = UpdatePath; this.UpdateBlockSize = UpdateBlockSize; this.CheckChangeNotifierInterval = TimeSpan.FromMinutes(CheckChangeNotifierIntervalMin); this.CheckChangeNotifierTimeout = TimeSpan.FromSeconds(CheckChangeNotifierTimeoutSec); /*this.CardScripts = CardScripts;*/ Log.Message("Сервис запускается"); try { // первоначальная загрузка if (Notifier == null) { ChangeStatus("Init notifications..."); Log.Message("Инициализация отслеживания изменений в БД..."); InitNotifier(); } ChangeStatus("Initial loading..."); if (!Load()) throw new Exception("Ошибка начальной загрузки общих разделяемых данных"); if (!CurrentSharedData.DBVersion.IsBuildSupported) throw new Exception(string.Format("Установленная версия базы данных '{0}' не поддерживается программым обеспечением", CurrentSharedData.DBVersion.Build)); if (!CurrentSharedData.DBVersion.IsSignatureValid) throw new Exception("Неверная подпись безопасности базы данных"); // запускаем поток обновления данных LoadThread = new Thread(LoadThreadExecute); LoadThread.IsBackground = true; LoadThreadTerminated = false; LoadThread.Start(); Log.Message("Сервис запущен. ThreadID: {0}", LoadThread.ManagedThreadId); } catch { try { Dispose(); } catch { } throw; } }