public void StopAllTasks() { foreach (object o in tasks) { SenderTask task = o as SenderTask; task.Stop(); } }
private SenderTask generateTask(Contact contact, string file) { SenderTask task = new SenderTask(file, getFreePortWith, contact, Name); task.Delete += task_Delete; task.Completed += task_Completed; task.SuccessfullyCompleted += task_SuccessfullyCompleted; tasks.Dispatcher.Invoke(() => tasks.Add(task)); return(task); }
private void task_SuccessfullyCompleted(SenderTask task) { tasks.Dispatcher.Invoke(() => FileSent(task)); usedPorts.Remove(task.Port); }
private void task_Delete(SenderTask task) { usedPorts.Remove(task.Port); tasks.Dispatcher.Invoke(() => tasks.Remove(task)); }
private void task_Completed(SenderTask task) { usedPorts.Remove(task.Port); }
/// <summary> /// File sent handler /// </summary> /// <param name="task">Sent file task</param> private void sender_FileSent(SenderTask task) { // Show balloon tip trayIcon.ShowBalloonTip(3000, "Octo Sender", task.SourceFile.Name + " sent to " + task.TargetContact.ContactName, ToolTipIcon.Info); }