Esempio n. 1
0
        protected void PutWorkerThreadEvent(WorkerEvent workerEvent)
        {
            try
            {
                _lockWe.Wait();

                if (!workerEvent.IsCollapsible ||
                    _workerEventList.Find(we => we.CompareTo(workerEvent) == 0) == null)
                {
                    if (_workerEventList.Count > WorkerEventSize)
                    {
                        _workerEventList.RemoveAt(0);
                    }
                    _workerEventList.Add(workerEvent);
                }
            }
            finally
            {
                _lockWe.Release();
            }
            WakeupWorkerThread();
        }
Esempio n. 2
0
        protected override bool DispatchThreadEvents(WorkerEvent workerEvent)
        {
            var res = base.DispatchThreadEvents(workerEvent);

            if (!res && workerEvent is NetWorkerEvent)
            {
                switch (workerEvent.EventType)
                {
                    case WorkerEventType.ReloadData:
                        {
                            ReadDbData();
                            return true;
                        }
                }
            }

            return res;
        }
Esempio n. 3
0
 protected override bool DispatchThreadEvents(WorkerEvent workerEvent)
 {
     switch (workerEvent.EventType)
     {
         case WorkerEventType.RedrawLayer:
             {
                 DrawLayer(new Rectangle(0, 0, Width, Height));
                 return true;
             }
     }
     return base.DispatchThreadEvents(workerEvent);
 }
Esempio n. 4
0
 protected virtual bool DispatchThreadEvents(WorkerEvent workerEvent)
 {
     return(false);
 }
Esempio n. 5
0
        protected override bool DispatchThreadEvents(WorkerEvent workerEvent)
        {
            var res = base.DispatchThreadEvents(workerEvent);

            if (!res && workerEvent is MapWorkerEvent)
            {
                switch (workerEvent.EventType)
                {
                    case WorkerEventType.DownloadImage:
                        {
                            DownloadImage(((MapWorkerEvent)workerEvent).Block);
                            return true;
                        }
                    case WorkerEventType.DrawImage:
                        {
                            DrawImage(((MapWorkerEvent)workerEvent).Block);
                            return true;
                        }
                }
            }

            return res;
        }