コード例 #1
0
        protected object BeforeRunProcess(ILongRunningProcess process)
        {
            //sprawdzam czy zahibenowany proces ma jakieś dane do pocesu
            var    vmParams     = process.LongRunningProcessData.VirtualMachine.GetHibernateParams();
            var    type         = (ProcessHibernationType)vmParams[0];
            object externalData = null;

            if (type == ProcessHibernationType.WaitForExternalData ||
                type == ProcessHibernationType.WaitingForUserInterface)
            {
                var xmlExternalData = process.ProcessData.ProcessInstanceContainer
                                      .ProcessExternalData.ExternalInputDataFullSerialization;
                externalData = _fullSerializer.Deserialize <object>(xmlExternalData);
            }

            return(externalData);
        }
コード例 #2
0
        protected void AfterRunProcess(ILongRunningProcess process, VirtualMachineResult <object> result)
        {
            if (result.State == VirtualMachineState.Executed)
            {
                process.ProcessData.ThreadStatus = ThreadState.Executed;
            }
            else if (result.State == VirtualMachineState.Hibernated)
            {
                var    vmParams = process.LongRunningProcessData.VirtualMachine.GetHibernateParams();
                var    type     = (ProcessHibernationType)vmParams[0];
                string xml      = "";

                switch (type)
                {
                case ProcessHibernationType.DelayOfProcessExecution:
                    var nextExecutionDate = (DateTime)vmParams[1];
                    process.ProcessData.ProcessInstanceContainer.ThreadData.NextExecutionDate =
                        nextExecutionDate;
                    process.ProcessData.ThreadStatus = ThreadState.WaitingForExecution;
                    break;

                case ProcessHibernationType.WaitForExternalData:
                    process.ProcessData.ThreadStatus = ThreadState.WaitForExternalData;
                    var externalOutputData = vmParams[1];

                    xml = _fullSerializer.Serialize(externalOutputData);
                    process.ProcessData.ProcessInstanceContainer
                    .ProcessExternalData.ProcessOutputDataFullSerialization = xml;
                    break;

                case ProcessHibernationType.WaitingForUserInterface:
                    process.ProcessData.ThreadStatus = ThreadState.WaitingForUserInterface;
                    xml = _fullSerializer.Serialize(vmParams[1]);
                    process.ProcessData.ProcessInstanceContainer
                    .ProcessExternalData.ProcessOutputDataFullSerialization = xml;
                    break;
                }
            }
        }
コード例 #3
0
 public WorkshopController(ILongRunningProcess longRunningProcess)
 {
     _longRunningProcess = longRunningProcess ?? throw new ArgumentNullException(nameof(longRunningProcess));
 }