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; */ }