Exemple #1
0
        private void Workroom_RequestDone(object sender, OnServiceEventArgs e)
        {
            var request = WorkRequestList
                          .Where(x => x.Code.Equals(e.Code)).Single();

            request.IsDone();
            //
            Console.WriteLine($"СТО: {e.WorkType}, заявка {e.Code} обработана!");
            //
            RequestDone?.Invoke(this, new OnServiceEventArgs(e.WorkType, e.Code));

            //Проверка на выполнение всех работ
            if (!WorkRequestList
                .Any(x => x.RequestStatus == RequestStatus.IsActive && x.Vehicle.Equals(request.Vehicle)))
            {
                WorkDone?.Invoke(request.Vehicle);
            }
        }
        public void WorkLoop()
        {
            do
            {
                _waitHandler.WaitOne();
                if (_needToTerminate)
                {
                    _state = WorkThreadState.Terminated;
                    break;
                }


                _action.Invoke();

                _waitHandler.Reset();
                _state = WorkThreadState.Idle;
                WorkDone?.Invoke(this);
            }while(!_needToTerminate);
        }
Exemple #3
0
        public void DoSomeWork(int hours)
        {
            //before calling events make sure the delegate list isn't empty

            for (int i = 0; i < hours; i++)
            {
                //raise workevent
                WorkEvent?.Invoke(this, new CoolEventArgs()
                {
                    IsCool = true,
                    Number = i + 1
                });
            }

            var args = new CoolEventArgs()
            {
                IsCool = true,
                Number = hours
            };

            //raise workdone
            WorkDone?.Invoke(this, args);
        }
 protected virtual void InvokeWorkDone(string e = "") => WorkDone?.Invoke(this, e);
Exemple #5
0
 /// <summary>
 ///     Invokes the <see cref="WorkDone" />-Event
 /// </summary>
 protected virtual void OnWorkDone()
 {
     WorkDone?.Invoke(this, new EventArgs());
 }