Exemplo n.º 1
0
        private void RunWorkflowById(string workflowId)
        {
            _workflowInstance = new WorkflowInstance(Guid.NewGuid().ToString(), workflowId, _config.GetList())
            {
                ClientId = _config.Get(Constants._ID, Guid.NewGuid().ToString())
            };
            //Mapping between the Object and Line No.

            Log.Debug(_workflowInstance.ToXElement().ToString());
            //do we need to register client at controller debugging? Yes, we need it to maintain the status of this only client
            ClientInstancesManager.GetInstance().Register(_config.SetRegisterBody(XElement.Parse("<Register />")));
            //TODO add visual trace here
            //if workflow is loaded, we can track it.
            //workflowInstance.Tracker.Tracking = this;

            _workflowInstance.Start();

            var debugMode = _config.Get("ModeDebug", "True").Equals("True", StringComparison.CurrentCultureIgnoreCase);

            while (true)
            {
                var xCommand = _workflowInstance.GetCommand();
                if (xCommand == null)
                {
                    break;
                }
                if (debugMode)
                {
                    MessageBox.Show(xCommand.ToString());
                }
                Log.Info(xCommand.ToString());

                var xResult = _autoClient.Execute(xCommand);
                if (debugMode)
                {
                    MessageBox.Show(xResult.ToString());
                }
                Log.Info(xResult.ToString());
                _workflowInstance.SetResult(xResult);
                Thread.Sleep(1000);

                if (_workflowInstance.IsFinished())
                {
                    break;
                }
            }

/*
 *          workflowInstance = null;
 */
        }
Exemplo n.º 2
0
 public XElement Do(XElement action)
 {
     return(ClientInstancesManager.GetInstance().Register(action));
 }
Exemplo n.º 3
0
        public XElement Do(XElement action)
        {
            var clientInstanceId = action.Attribute(Constants._ID).Value;

            return(ClientInstancesManager.GetInstance().GetComputer(clientInstanceId).GetCommand());
        }
Exemplo n.º 4
0
 public XElement Do(XElement action)
 {
     //This one always can return something, even an empty list
     return(ClientInstancesManager.GetInstance().ToXElement());
 }