예제 #1
0
        // Helper function to raise IJobServer.JobEvent
        private void NotifyClients(JobEventArgs args)
        {
            //
            // Manually invoke each event handler to
            // catch disconnected clients.
            System.Delegate[] invkList = JobEvent.GetInvocationList();
            IEnumerator       ie       = invkList.GetEnumerator();

            while (ie.MoveNext())
            {
                JobEventHandler handler = (JobEventHandler)ie.Current;
                try
                {
                    //handler.Invoke(this, args); //help to debug
                    handler.BeginInvoke(this, args, null, null);
                }
                catch (System.Exception e)
                {
                    JobEvent -= handler;
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine(e.Message);
                    Console.ResetColor();
                }
            }
        }
예제 #2
0
        private static void OnJobUnscheduled(IJob job)
        {
            JobEventHandler handler = JobUnscheduled;

            if (handler != null)
            {
                handler(job);
            }
        }
예제 #3
0
        private static void OnJobStarted(IJob job)
        {
            JobEventHandler handler = JobStarted;

            if (handler != null)
            {
                handler(job);
            }
        }