Exemple #1
0
        protected internal virtual ResultSignal Accept(IProcessHost host, Signal signal)
        {
            if (signal is FinalizeSignal)
            {
                host.Finalize(this);
                return(OkSignal.Make(this));
            }
            if (signal is TerminateSignal)
            {
                var finish = signal as TerminateSignal;
                UpdateStatus(host, ProcessStatus.Terminated, "Terminated!!!!", App.TimeSource.UTCNow, finish.SysAbout);
                host.Update(this, true);
                return(OkSignal.Make(this));
            }
            // a pochemy net try/cath i ERROR signal???? ili eto v drugom meste
            var result = DoAccept(host, signal);  //Do Accept razve ne doljen byt POSLE systemnix signalov??

            if (result != null)
            {
                return(result);
            }

            // a gde ostalnie signali? Terminate etc...?

            if (signal is FinishSignal)
            {
                var finish = signal as FinishSignal;
                UpdateStatus(host, ProcessStatus.Finished, finish.Description, App.TimeSource.UTCNow, finish.SysAbout);
                host.Update(this, true);
                return(OkSignal.Make(this));
            }

            if (signal is CancelSignal)
            {
                var finish = signal as CancelSignal;
                UpdateStatus(host, ProcessStatus.Canceled, "Canceled!!!", App.TimeSource.UTCNow, finish.SysAbout);
                host.Update(this, true);
                return(OkSignal.Make(this));
            }

            return(UnknownSignal.Make(this, signal));
        }
Exemple #2
0
        protected override ResultSignal DoAccept(IProcessHost host, Signal signal)
        {
            if (signal is WorkPartDoneSignal)
            {
                var workPartDone = signal as WorkPartDoneSignal;
                Messages[workPartDone.Part] = "{0} - '{1}' - {2}".Args(workPartDone.Part, workPartDone.Message, App.TimeSource.UTCNow);
                host.Update(this);
                return(OkSignal.Make(this));
            }

            return(null);
        }