Example #1
0
        public NextActivityKey SetRoleToSlave(
            WorkflowExecutionContext context, ActivityParameterDictionary parameters)
        {
            _syncManager.ScannerRole = ScannerRole.Slave;
            if (!_syncManager.IsRemoteScannerConnected)
            {
                return(BpcNextActivityKeys.No);
            }
            _scannerManager.SetIndicator(CommonActivity.SYNCHRONIZATION_INDICATOR_TEXT);
            _logger.LogVerbose(Message.WorkflowSlaveWaitForRemoteScannerRoleDefined);
            context.Sleep(300);
            while (true)
            {
                context.WaitOne(_remoteScannerRoleDefined);
                switch (_remoteScannerRole)
                {
                case ScannerRole.Slave:
                    return(BpcNextActivityKeys.No);

                case ScannerRole.Master:
                    return(BpcNextActivityKeys.Yes);

                case ScannerRole.RemoteScannerMasterToo:
                    break;

                case ScannerRole.Failed:
                    return(BpcNextActivityKeys.No);
                }
                _logger.LogVerbose(Message.WorkflowSlaveWaitForRemoteScannerRoleDefined);
                context.Sleep(1000);
            }
        }
Example #2
0
 public NextActivityKey Mock(
     WorkflowExecutionContext context, ActivityParameterDictionary parameters)
 {
     _logger.LogInfo(Message.Common_Information, parameters.GetParamValue("Text", "-"));
     context.Sleep(TimeSpan.FromMilliseconds(500));
     return(context.DefaultNextActivityKey);
 }
Example #3
0
 public NextActivityKey Mock( 
     WorkflowExecutionContext context, ActivityParameterDictionary parameters)
 {
     _logger.LogInfo(Message.Common_Information, parameters.GetParamValue("Text", "-"));
     context.Sleep(TimeSpan.FromMilliseconds(500));
     return context.DefaultNextActivityKey;
 }
Example #4
0
 public NextActivityKey SyncWorkflowWithMasterScanner(
     WorkflowExecutionContext context, ActivityParameterDictionary parameters)
 {
     _scannerManager.SetIndicator(CommonActivity.SYNCHRONIZATION_INDICATOR_TEXT);
     _logger.LogVerbose(Message.WorkflowWaitForSynchronizationWithMaster);
     context.Sleep(Timeout.Infinite);
     return(context.DefaultNextActivityKey);
 }
Example #5
0
        private NextActivityKey SayPhraseAndExit(
            WorkflowExecutionContext context,
            ActivityParameterDictionary parameters,
            string exitTypeParamName)
        {
            SayPhrase(context, parameters);
            var exitType = parameters.GetParamValue(exitTypeParamName, ApplicationExitType.RestartApplication);

            CoreApplication.Instance.Exit(exitType);
            context.Sleep(Timeout.Infinite);
            return(context.DefaultNextActivityKey);
        }
Example #6
0
        public NextActivityKey Synchronize(
            WorkflowExecutionContext context, ActivityParameterDictionary parameters)
        {
            _logger.LogInfo(Message.WorkflowStartSynchronization);
            _scannerManager.SetIndicator(CommonActivity.SYNCHRONIZATION_INDICATOR_TEXT);
            _syncManager.StartStateSynchronization(true);
            var synchronizationSucceeded = _syncManager.WaitForSynchronizationFinished(context);

            if (!synchronizationSucceeded)
            {
                return(BpcNextActivityKeys.No);
            }
            var res = _workflowManager.GoToStateActivity();

            if (res)
            {
                context.Sleep(Timeout.Infinite);
            }


            return(BpcNextActivityKeys.Yes);
        }
Example #7
0
 public NextActivityKey SyncWorkflowWithMasterScanner( 
     WorkflowExecutionContext context, ActivityParameterDictionary parameters)
 {
     _scannerManager.SetIndicator(CommonActivity.SYNCHRONIZATION_INDICATOR_TEXT);
     _logger.LogVerbose(Message.WorkflowWaitForSynchronizationWithMaster);
     context.Sleep(Timeout.Infinite);
     return context.DefaultNextActivityKey;
 }
Example #8
0
 private NextActivityKey SayPhraseAndExit( 
     WorkflowExecutionContext context,  
     ActivityParameterDictionary parameters,  
     string exitTypeParamName)
 {
     SayPhrase(context, parameters);
     var exitType = parameters.GetParamValue(exitTypeParamName, ApplicationExitType.RestartApplication);
     CoreApplication.Instance.Exit(exitType);
     context.Sleep(Timeout.Infinite);
     return context.DefaultNextActivityKey;
 }