Example #1
0
        public fBase(IJobStore store)
        {
            StoreMessages = new QueueThreadSafe <Message>();
            JobStore      = store;
            store.f_form_Add(this);
            this.FormClosing += (se, ev) => { store.f_form_Remove(this); };

            timer_api = new System.Threading.Timer(new System.Threading.TimerCallback((obj) =>
            {
                IFORM form = (IFORM)obj;
                if (StoreMessages.Count > 0)
                {
                    Message m = StoreMessages.Dequeue(null);
                    if (m != null)
                    {
                        OnReceiveMessage?.Invoke(form, m);
                    }
                }
            }), this, 100, 100);
        }