Beispiel #1
0
        private void SoTAddedHandler(SoT sot_)
        {
            SoTImpl sot = (SoTImpl)sot_;

            Trace.TraceInformation("SoT added.");
            lock (this)
            {
                if (SoTWorkerThread == null)
                {
                    SoTWorkerThread = new System.Threading.Thread(
                        delegate()
                    {
                        while (true)
                        {
                            Action action = SoTTodo.Take();
                            if (action == null)
                            {
                                return;
                            }
                            else
                            {
                                action.Invoke();
                            }
                        }
                    }
                        );
                    SoTWorkerThread.SetApartmentState(System.Threading.ApartmentState.STA);
                    SoTWorkerThread.Start();
                    SoTWorkerThread.Name = "STA thread for SoT.Run";
                }
                sot.SoTTodo = SoTTodo;
                SoTs.Add(sot);
                JobsToBeStarted.Add(delegate()
                {
                    SoTTodo.Add(delegate { sot.Run(); });
                });

                if (SotAdded != null)
                {
                    SotAdded(this, new SotAddedEventArgs
                    {
                        Sot = sot
                    });
                }
            }
        }
Beispiel #2
0
        public override SoT CreateSoT()
        {
            SoT sot = new SoTImpl(this);

            return(sot);
        }