Exemplo n.º 1
0
 private void task_Delete(ReceiverTask task)
 {
     // Remove task
     Tasks.Dispatcher.Invoke(() => Tasks.Remove(task));
     // Remove blocked port
     usedPorts.Remove(task.Port);
 }
Exemplo n.º 2
0
 public void StopAllTasks()
 {
     foreach (object o in Tasks)
     {
         ReceiverTask task = o as ReceiverTask;
         task.Stop();
     }
 }
Exemplo n.º 3
0
        private void StartNewTask(IPAddress endPoint, int receivedPort)
        {
            ReceiverTask task = new ReceiverTask(endPoint, receivedPort, Path);

            usedPorts.Add(receivedPort);
            Tasks.Dispatcher.Invoke(() => Tasks.Add(task));
            task.AskBeforeReceiving     = Properties.Settings.Default.AskBeforeReceivingFile;
            task.VerifyMD5              = Properties.Settings.Default.VerifyMD5;
            task.Delete                += task_Delete;
            task.Completed             += task_Completed;
            task.IsInContacts           = IsInContacts;
            task.SuccessfullyCompleted += task_SuccessfullyCompleted;
            task.Start();
        }
Exemplo n.º 4
0
 /// <summary>
 /// File received handler
 /// </summary>
 /// <param name="task">Received file task</param>
 private void receiver_FileReceived(ReceiverTask task)
 {
     trayIcon.ShowBalloonTip(3000, "Octo Sender", task.ReceivedFileName + " received from " + task.SenderName, ToolTipIcon.Info);
 }
Exemplo n.º 5
0
 private void task_Completed(ReceiverTask task)
 {
     // Remove blocked port
     usedPorts.Remove(task.Port);
 }
Exemplo n.º 6
0
 private void task_SuccessfullyCompleted(ReceiverTask task)
 {
     // Call Main thread event
     Tasks.Dispatcher.Invoke(() => FileReceived(task));
 }