protected override void Execute(NativeActivityContext context) { UiElement element = null; try { var selStr = Selector.Get(context); element = Common.GetValueOrDefault(context, this.Element, null); if (element == null && selStr != null) { element = UiElement.FromSelector(selStr); } if (Body != null) { context.ScheduleAction(Body, element, OnCompleted, OnFaulted); } } catch (Exception e) { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "元素范围流程失败", e.Message); if (ContinueOnError.Get(context)) { context.ScheduleAction(Body, element, OnCompleted, OnFaulted); } else { throw e; } } }
protected override void Execute(CodeActivityContext context) { try { string srcPath = Path.Get(context); if (File.Exists(srcPath)) { File.Delete(srcPath); } else { Directory.Delete(srcPath, true); } } catch { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "有一个错误产生", "删除文件或文件夹失败!"); if (ContinueOnError.Get(context)) { } else { throw; } } }
protected override void Execute(CodeActivityContext context) { try { string sPath = Path.Get(context); if (!Directory.Exists(sPath)) { Directory.CreateDirectory(sPath); } else { SharedObject.Instance.Output(SharedObject.enOutputType.Warning, "有一个警告产生", "文件夹已存在!"); } } catch { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "有一个错误产生", "创建文件夹失败!"); if (ContinueOnError.Get(context)) { } else { throw; } } }
protected override void EndExecute(AsyncCodeActivityContext context, System.IAsyncResult result) { DatabaseConnection existingConnection = DBConnection.Get(context); try { Func <DBExecuteCommandResult> action = (Func <DBExecuteCommandResult>)context.UserState; DBExecuteCommandResult commandResult = action.EndInvoke(result); this.AffectedRecords.Set(context, commandResult.Result); foreach (var param in commandResult.ParametersBind) { var currentParam = Parameters[param.Key]; if (currentParam.Direction == ArgumentDirection.Out || currentParam.Direction == ArgumentDirection.InOut) { currentParam.Set(context, param.Value.Item1); } } } catch (Exception ex) { HandleException(ex, ContinueOnError.Get(context)); } finally { if (existingConnection == null) { DBConn.Dispose(); } } }
protected async override Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken) { DataTable dataTable = null; string connString = null; SecureString connSecureString = null; string provName = null; string tableName = null; string[] columnNames = null; DatabaseConnection existingConnection = null; long affectedRecords = 0; IExecutorRuntime executorRuntime = null; var continueOnError = ContinueOnError.Get(context); try { existingConnection = DbConnection = ExistingDbConnection.Get(context); connString = ConnectionString.Get(context); provName = ProviderName.Get(context); tableName = TableName.Get(context); dataTable = DataTable.Get(context); columnNames = ColumnNames.Get(context); executorRuntime = context.GetExtension <IExecutorRuntime>(); connSecureString = ConnectionSecureString.Get(context); ConnectionHelper.ConnectionValidation(existingConnection, connSecureString, connString, provName); affectedRecords = await Task.Run(() => { DbConnection = DbConnection ?? new DatabaseConnection().Initialize(connString != null ? connString : new NetworkCredential("", connSecureString).Password, provName); if (DbConnection == null) { return(0); } if (executorRuntime != null && executorRuntime.HasFeature(ExecutorFeatureKeys.LogMessage)) { return(DbConnection.BulkUpdateDataTable(BulkUpdateFlag, tableName, dataTable, columnNames, executorRuntime)); } else { return(DbConnection.BulkUpdateDataTable(BulkUpdateFlag, tableName, dataTable, columnNames)); } }); } catch (Exception ex) { HandleException(ex, continueOnError); } finally { if (existingConnection == null) { DbConnection?.Dispose(); } } return(asyncCodeActivityContext => { AffectedRecords.Set(asyncCodeActivityContext, affectedRecords); }); }
protected override void Execute(CodeActivityContext context) { Int32 _delayAfter = GetValueOrDefault(context, this.DelayAfter, 3000); Int32 _delayBefore = GetValueOrDefault(context, this.DelayBefore, 3000); try { Thread.Sleep(_delayBefore); var selStr = Selector.Get(context); UiElement element = GetValueOrDefault(context, this.Element, null); if (element == null && selStr != null) { element = UiElement.FromSelector(selStr); } if (element != null) { if (element.IsNativeObjectAutomationElement) { var nativieObject = element.NativeObject as AutomationElement; var checkBox = nativieObject.AsCheckBox(); checkBox.Click(); } else { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "有一个错误产生", "非Window元素"); if (ContinueOnError.Get(context)) { } else { throw new NotImplementedException("非Window元素"); } } } else { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "有一个错误产生", "查找不到元素"); if (ContinueOnError.Get(context)) { } else { throw new NotImplementedException("查找不到元素"); } } Thread.Sleep(_delayAfter); } catch (Exception e) { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "校验单选按钮或复选框失败", e.Message); if (ContinueOnError.Get(context)) { } else { throw; } } }
protected override void Execute(CodeActivityContext context) { string buff = ""; try { var selStr = Selector.Get(context); UiElement element = GetValueOrDefault(context, this.Element, null); if (element == null && selStr != null) { element = UiElement.FromSelector(selStr); } if (element != null) { if (element.IsNativeObjectAutomationElement) { var nativieObject = element.NativeObject as AutomationElement; var comboBox = nativieObject.AsTextBox(); buff = comboBox.Text; if (Value != null) { Value.Set(context, buff); } } } else { UIAutomationCommon.HandleContinueOnError(context, ContinueOnError, Localize.LocalizedResources.GetString("msgNoElementFound")); } } //catch(Exception) //{ // SharedObject.Instance.Output(SharedObject.enOutputType.Error, "PatternNotSupportedException"); //} //catch (FlaUI.Core.Exceptions.MethodNotSupportedException) //{ // DataGridView gridView = element.AsDataGridView(); // AutomationElement[] child = gridView.FindAllChildren(); // for (int i = 0; i < child.Length; i++) // { // string nameStr = child[i].Name; // buff += nameStr; // } // if (Value != null) // Value.Set(context, buff); //} catch (Exception e) { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "获取UI元素文本失败", e.Message); if (ContinueOnError.Get(context)) { } else { throw; } } }
protected override void Execute(CodeActivityContext context) { Int32 _delayAfter = Common.GetValueOrDefault(context, this.DelayAfter, 300); Int32 _delayBefore = Common.GetValueOrDefault(context, this.DelayBefore, 300); try { Thread.Sleep(_delayBefore); var selStr = Selector.Get(context); UiElement element = Common.GetValueOrDefault(context, this.Element, null); if (element == null && selStr != null) { element = UiElement.FromSelector(selStr); } Int32 pointX = 0; Int32 pointY = 0; if (usePoint) { pointX = offsetX.Get(context); pointY = offsetY.Get(context); } else { if (element != null) { pointX = element.GetClickablePoint().X; pointY = element.GetClickablePoint().Y; element.SetForeground(); } else { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "有一个错误产生", "查找不到元素"); if (ContinueOnError.Get(context)) { return; } else { throw new NotImplementedException("查找不到元素"); } } } UiElement.MouseMoveTo(pointX, pointY); Thread.Sleep(_delayAfter); } catch (Exception e) { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "有一个错误产生", e.Message); if (ContinueOnError.Get(context)) { } else { throw new NotImplementedException("查找不到元素"); } } }
protected override void Execute(CodeActivityContext context) { Int32 _delayAfter = Common.GetValueOrDefault(context, this.DelayAfter, 300); Int32 _delayBefore = Common.GetValueOrDefault(context, this.DelayBefore, 300); try { Thread.Sleep(_delayBefore); var selStr = Selector.Get(context); UiElement element = Common.GetValueOrDefault(context, this.Element, null); if (element == null && selStr != null) { element = UiElement.FromSelector(selStr); } Int32 pointX = 0; Int32 pointY = 0; if (usePoint) { pointX = offsetX.Get(context); pointY = offsetY.Get(context); } else { if (element != null) { pointX = element.GetClickablePoint().X; pointY = element.GetClickablePoint().Y; element.SetForeground(); } } if (isRunClick) { UiElement.MouseMoveTo(pointX, pointY); UiElement.MouseAction((Plugins.Shared.Library.UiAutomation.ClickType)ClickType, (Plugins.Shared.Library.UiAutomation.MouseButton)MouseButton); } DealBaseKeyBordPress(); if (Common.DealVirtualKeyPress(SelectedKey.ToUpper())) { Common.DealVirtualKeyRelease(SelectedKey.ToUpper()); } DealBaseKeyBordRelease(); Thread.Sleep(_delayAfter); } catch (Exception e) { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "有一个错误产生", e.Message); if (ContinueOnError.Get(context)) { return; } else { throw new NotImplementedException(e.Message); } } }
protected override async void Execute(NativeActivityContext context) { bool in_continueonerror = ContinueOnError.Get(context); try { CancellationToken cancellationToken = default; var timeout = Timeout.Get(context); int tableNumber = TableNumber.Get(context); var task = GetHtmlMailBody(context); string htmlstring = task.Result; var out_NumberOfTables = NumberOfMailTables(htmlstring); int NumberOfTables = out_NumberOfTables.Result; if (NumberOfTables == 0) { throw new NullReferenceException("No table in mail Body"); } ; if (tableNumber - 1 > NumberOfTables) { throw new Exception("Total Number of tables in mail body is " + NumberOfTables.ToString() + " please enter the TableNumber equal or less then " + NumberOfTables.ToString()); } else { var result_datatables = GetDatatable(htmlstring); DataTable[] out_dataTables = result_datatables.Result; if (await Task.WhenAny(task, Task.Delay(timeout, cancellationToken)) != task) { throw new TimeoutException(); } ; if (tableNumber == 0) { Datatable.Set(context, out_dataTables[tableNumber]); } else { Datatable.Set(context, out_dataTables[tableNumber - 1]); } } } catch { if (in_continueonerror == false) { } } }
protected override void Execute(CodeActivityContext context) { string text = Text.Get(context); Int32 _delayAfter = GetValueOrDefault(context, this.DelayAfter, 300); Int32 _delayBefore = GetValueOrDefault(context, this.DelayBefore, 300); try { Thread.Sleep(_delayBefore); var selStr = Selector.Get(context); UiElement element = GetValueOrDefault(context, this.Element, null); if (element == null && selStr != null) { element = UiElement.FromSelector(selStr); } if (element != null) { if (element.IsNativeObjectAutomationElement) { if (element.IsNativeObjectAutomationElement) { var nativieObject = element.NativeObject as AutomationElement; var textbox = nativieObject.AsTextBox(); if (!textbox.IsReadOnly) { textbox.Text = text; } else { SharedObject.Instance.Output(SharedObject.enOutputType.Error, Localize.LocalizedResources.GetString("msgErrorOccurred"), "该编辑框无法设置值"); } } } else { UIAutomationCommon.HandleContinueOnError(context, ContinueOnError, "非Window元素"); } } else { UIAutomationCommon.HandleContinueOnError(context, ContinueOnError, Localize.LocalizedResources.GetString("msgNoElementFound")); } Thread.Sleep(_delayAfter); } catch (Exception e) { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "设置UI元素文本失败", e.Message); if (ContinueOnError.Get(context)) { } else { throw; } } }
protected override void Execute(CodeActivityContext context) { string itemName = Item.Get(context); Int32 _delayAfter = GetValueOrDefault(context, this.DelayAfter, 300); Int32 _delayBefore = GetValueOrDefault(context, this.DelayBefore, 300); try { Thread.Sleep(_delayBefore); var selStr = Selector.Get(context); UiElement element = GetValueOrDefault(context, this.Element, null); if (element == null && selStr != null) { element = UiElement.FromSelector(selStr); } if (element != null) { if (element.IsNativeObjectAutomationElement) { var nativieObject = element.NativeObject as AutomationElement; var comboBox = nativieObject.AsComboBox(); var comboItem = comboBox.Select(itemName); if (comboItem.Text != itemName) { var lbox = nativieObject.AsListBox(); var listItem = lbox.Select(itemName); if (listItem.Text != itemName) { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "SelectItem失败,请检查UI元素!"); } } } else { UIAutomationCommon.HandleContinueOnError(context, ContinueOnError, "非Window元素"); } } else { UIAutomationCommon.HandleContinueOnError(context, ContinueOnError, Localize.LocalizedResources.GetString("msgNoElementFound")); } Thread.Sleep(_delayAfter); } catch (Exception e) { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "选取组合框或列表框项目失败", e.Message); if (ContinueOnError.Get(context)) { } else { throw; } } }
protected override System.IAsyncResult BeginExecute(AsyncCodeActivityContext context, System.AsyncCallback callback, object state) { string connString = null; string provName = null; string sql = string.Empty; int commandTimeout = OverTime.Get(context); if (commandTimeout < 0) { throw new ArgumentException("TimeoutMS"); } Dictionary <string, Tuple <object, ArgumentDirection> > parameters = null; try { sql = SQLString.Get(context); DBConn = DBConnection.Get(context); connString = ConnectionString.Get(context); provName = ProviderName.Get(context); if (Parameters != null) { parameters = new Dictionary <string, Tuple <object, ArgumentDirection> >(); foreach (var param in Parameters) { parameters.Add(param.Key, new Tuple <object, ArgumentDirection>(param.Value.Get(context), param.Value.Direction)); } } } catch (Exception ex) { HandleException(ex, ContinueOnError.Get(context)); } // create the action for doing the actual work Func <DBExecuteCommandResult> action = () => { DBExecuteCommandResult executeResult = new DBExecuteCommandResult(); if (DBConn == null) { DBConn = new DatabaseConnection().Initialize(connString, provName); } if (DBConn == null) { return(executeResult); } executeResult = new DBExecuteCommandResult(DBConn.Execute(sql, parameters, commandTimeout, CommandType), parameters); return(executeResult); }; context.UserState = action; return(action.BeginInvoke(callback, state)); }
protected override void Execute(CodeActivityContext context) { string attribute_str = Attribute.Get(context); string attribute_value = Value.Get(context); try { Int32 _timeout = TimeoutMS.Get(context); Thread.Sleep(_timeout); latch = new CountdownEvent(1); Thread td = new Thread(() => { if (Selector.Expression == null) { //ActiveElement处理 } else { var selStr = Selector.Get(context); UiElement element = GetValueOrDefault(context, this.Element, null); if (element == null && selStr != null) { element = UiElement.FromSelector(selStr); } if (element != null) { element.SetForeground(); mshtml.IHTMLDocument2 currDoc = null; SHDocVw.InternetExplorer ieBrowser = GetIEFromHWndClass.GetIEFromHWnd((int)element.WindowHandle, out currDoc); mshtml.IHTMLElement currEle = GetIEFromHWndClass.GetEleFromDoc( element.GetClickablePoint(), (int)element.WindowHandle, currDoc); currEle.setAttribute(attribute_str, attribute_value); } else { UIAutomationCommon.HandleContinueOnError(context, ContinueOnError, Localize.LocalizedResources.GetString("msgNoElementFound")); } } refreshData(latch); }); td.TrySetApartmentState(ApartmentState.STA); td.IsBackground = true; td.Start(); latch.Wait(); } catch (Exception e) { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "出现异常", e.Message); if (ContinueOnError.Get(context)) { } } }
protected override IAsyncResult BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, object state) { try { m_Delegate = new runDelegate(Run); string filterText = FilterText.Get(context); TreeScope treeScope; if (Scope == ScopeOption.Children) { treeScope = TreeScope.Children; } else if (Scope == ScopeOption.Descendants) { treeScope = TreeScope.Descendants; } else { treeScope = TreeScope.Subtree; } UiElement element = null; var selStr = Selector.Get(context); element = Common.GetValueOrDefault(context, this.Element, null); if (element == null && selStr != null) { element = UiElement.FromSelector(selStr); } else { PropertyDescriptor property = context.DataContext.GetProperties()[EleScope.GetEleScope]; element = property.GetValue(context.DataContext) as UiElement; } List <UiElement> uiList = new List <UiElement>(); uiList = element.FindAllByFilter(treeScope, TrueCondition.Default, filterText); UiList.Set(context, uiList); return(m_Delegate.BeginInvoke(callback, state)); } catch (Exception e) { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "获取子节点元素失败", e.Message); if (ContinueOnError.Get(context)) { return(m_Delegate.BeginInvoke(callback, state)); } else { throw e; } } }
protected override IAsyncResult BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, object state) { var dataTable = DataTable.Get(context); string connString = null; string provName = null; string sql = string.Empty; int commandTimeout = TimeoutMS.Get(context); if (commandTimeout < 0) { throw new ArgumentException(UiPath.Database.Activities.Properties.Resources.TimeoutMSException, "TimeoutMS"); } Dictionary <string, Tuple <object, ArgumentDirection> > parameters = null; try { DbConnection = ExistingDbConnection.Get(context); connString = ConnectionString.Get(context); provName = ProviderName.Get(context); sql = Sql.Get(context); if (Parameters != null) { parameters = new Dictionary <string, Tuple <object, ArgumentDirection> >(); foreach (var param in Parameters) { parameters.Add(param.Key, new Tuple <object, ArgumentDirection>(param.Value.Get(context), param.Value.Direction)); } } } catch (Exception ex) { HandleException(ex, ContinueOnError.Get(context)); } // create the action for doing the actual work Func <DataTable> action = () => { if (DbConnection == null) { DbConnection = new DatabaseConnection().Initialize(connString, provName); } if (DbConnection == null) { return(null); } return(DbConnection.ExecuteQuery(sql, parameters, commandTimeout, CommandType)); }; context.UserState = action; return(action.BeginInvoke(callback, state)); }
protected override IAsyncResult BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, object state) { Window currWindow = ActiveWindow.Get(context); try { if (currWindow == null) { PropertyDescriptor property = context.DataContext.GetProperties()[WindowActive.OpenBrowsersPropertyTag]; if (property == null) { property = context.DataContext.GetProperties()[WindowAttach.OpenBrowsersPropertyTag]; } if (property != null) { currWindow = property.GetValue(context.DataContext) as Window; } } Win32Api.Rect rect = new Win32Api.Rect(); Win32Api.GetWindowRect((IntPtr)currWindow.getWindowHwnd(), out rect); int oldWidth = rect.Right - rect.Left; int oldHeight = rect.Bottom - rect.Top; int oldPosX = rect.Left; int oldPosY = rect.Top; int newPosX = PosX.Get(context); int newPosY = PosY.Get(context); int newWidth = Width.Get(context); int newHeight = Height.Get(context); int defPosX = newPosX == 0 ? oldPosX : newPosX; int defPosY = newPosY == 0 ? oldPosY : newPosY; int defWidth = newWidth == 0 ? oldWidth : newWidth; int defHeight = newHeight == 0 ? oldHeight : newHeight; Win32Api.MoveWindow(currWindow.getWindowHwnd(), defPosX, defPosY, defWidth, defHeight, true); } catch (Exception e) { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "关闭窗口错误产生", e.Message); if (ContinueOnError.Get(context)) { } else { throw; } } m_Delegate = new runDelegate(Run); return(m_Delegate.BeginInvoke(callback, state)); }
protected override IAsyncResult BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, object state) { Window currWindow = ActiveWindow.Get(context); IntPtr _handle = handle.Get(context); if (currWindow == null) { currWindow = new Window(); currWindow.setWindowHwnd((int)_handle); } try { var selStr = Selector.Get(context); UiElement element = UiElement.FromSelector(selStr); if (currWindow != null) { Win32Api.SendMessage((IntPtr)currWindow.getWindowHwnd(), Win32Api.WM_CLOSE, IntPtr.Zero, IntPtr.Zero); } else if (element != null) { Win32Api.SendMessage(element.WindowHandle, Win32Api.WM_CLOSE, IntPtr.Zero, IntPtr.Zero); } else { PropertyDescriptor property = context.DataContext.GetProperties()[WindowActive.OpenBrowsersPropertyTag]; if (property == null) { property = context.DataContext.GetProperties()[WindowAttach.OpenBrowsersPropertyTag]; } if (property != null) { Window getBrowser = property.GetValue(context.DataContext) as Window; Win32Api.SendMessage((IntPtr)getBrowser.getWindowHwnd(), Win32Api.WM_CLOSE, IntPtr.Zero, IntPtr.Zero); } } } catch (Exception e) { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "关闭窗口错误产生", e.Message); if (ContinueOnError.Get(context)) { } else { throw; } } m_Delegate = new runDelegate(Run); return(m_Delegate.BeginInvoke(callback, state)); }
protected override void Execute(CodeActivityContext context) { try { string attrName = AttrName.Get(context); object attrValue = AttrValue.Get(context); Int32 timeOut = TimeOut.Get(context); bool isFoundFlag = false; UiElement element = Common.GetValueOrDefault(context, this.Element, null); AutomationElement autoEle = element.NativeObject as AutomationElement; FrameworkAutomationElementBase baseFrame = autoEle.FrameworkAutomationElement; PropertyId[] ids = autoEle.GetSupportedPropertiesDirect(); PropertyId currentId = null; for (int i = 0; i < ids.Length; i++) { if (String.Equals(ids[i].Name, attrName, StringComparison.CurrentCultureIgnoreCase)) { currentId = ids[i]; break; } } for (int i = 0; i < timeOut / 1000; i++) { if (attrValue == baseFrame.GetPropertyValue(currentId)) { isFoundFlag = true; break; } Thread.Sleep(1000); } if (!isFoundFlag && !ContinueOnError.Get(context)) { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "相应元素的属性值未匹配,获取属性失败"); throw new Exception("获取属性失败,过程中断"); } } catch (Exception e) { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "等待获取元素属性过程出错", e.Message); if (ContinueOnError.Get(context)) { return; } else { throw e; } } }
protected async override Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken) { DataTable dataTable = null; string connString = null; SecureString connSecureString = null; string provName = null; string tableName = null; DatabaseConnection existingConnection = null; int affectedRecords = 0; var continueOnError = ContinueOnError.Get(context); try { existingConnection = DbConnection = ExistingDbConnection.Get(context); connString = ConnectionString.Get(context); provName = ProviderName.Get(context); tableName = TableName.Get(context); dataTable = DataTable.Get(context); connSecureString = ConnectionSecureString.Get(context); ConnectionHelper.ConnectionValidation(existingConnection, connSecureString, connString, provName); // create the action for doing the actual work affectedRecords = await Task.Run(() => { DbConnection = DbConnection ?? new DatabaseConnection().Initialize(connString != null ? connString : new NetworkCredential("", connSecureString).Password, provName); if (DbConnection == null) { return(0); } return(DbConnection.InsertDataTable(tableName, dataTable)); }); } catch (Exception ex) { HandleException(ex, continueOnError); } finally { if (existingConnection == null) { DbConnection?.Dispose(); } } return(asyncCodeActivityContext => { AffectedRecords.Set(asyncCodeActivityContext, affectedRecords); }); }
protected override void Execute(CodeActivityContext context) { try { var selStr = Selector.Get(context); object attrValue = null; string attrName = AttrName.Get(context); UiElement element = Common.GetValueOrDefault(context, this.Element, null); if (element == null && selStr != null) { element = UiElement.FromSelector(selStr); } AutomationElement autoEle = element.NativeObject as AutomationElement; FrameworkAutomationElementBase baseFrame = autoEle.FrameworkAutomationElement; PropertyId[] ids = autoEle.GetSupportedPropertiesDirect(); for (int i = 0; i < ids.Length; i++) { if (String.Equals(ids[i].Name, attrName, StringComparison.CurrentCultureIgnoreCase)) { attrValue = baseFrame.GetPropertyValue(ids[i]); break; } } if (attrValue == null) { Result.Set(context, ""); } else { Result.Set(context, attrValue); } } catch (Exception e) { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "获取元素属性失败", e.Message); if (ContinueOnError.Get(context)) { return; } else { throw e; } } }
protected override string ExecuteWithScope(ActivityContext context) { try { return(Execute(context, WorkbookScope.GetWorkbookInstance(context))); } catch (Exception e) { System.Diagnostics.Trace.WriteLine(e.Message); if (ContinueOnError.Get(context)) { return(null); } throw; } }
protected override void Execute(CodeActivityContext context) { // Dispatcher.CurrentDispatcher.Invoke(new Action(() => System.Windows.Application.Current.MainWindow.WindowState = System.Windows.WindowState.Minimized)); //Dispatcher.CurrentDispatcher.Invoke(new Action(delegate //{ // UiElement.StartElementHighlight(); // //System.Windows.Application.Current.MainWindow.WindowState = System.Windows.WindowState.Minimized; //})); try { System.Windows.Application.Current.Dispatcher.InvokeAsync(() => { UiElement.OnSelected = UiElement_OnSelected; UiElement.OnCanceled = UiElement_OnCanceled; UiElement.StartElementHighlight(); }); while (true) { if (isSelectedFlag) { context.SetValue(SelectedElement, uiElement); break; } if (isCanceledFlag) { break; } Thread.Sleep(200); } isSelectedFlag = false; isCanceledFlag = false; } catch (Exception e) { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "屏幕截图失败", e.Message); if (ContinueOnError.Get(context)) { return; } else { throw e; } } }
protected override void Execute(CodeActivityContext context) { try { string filePath = Path.Get(context); FileInfo file = new FileInfo(filePath); string desFilePath = Destination.Get(context); string DestinationPath = desFilePath; FileInfo desFile = new FileInfo(desFilePath); if (desFile.Name == "") { DestinationPath = desFilePath + file.Name; } if (file.Exists) { if (File.Exists(DestinationPath)) { if (Overwrite) { File.Delete(DestinationPath); } else { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "有一个错误产生", "有重复文件!"); return; } } file.MoveTo(DestinationPath); } else { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "有一个错误产生", "文件复制失败"); } } catch { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "有一个错误产生", "文件复制失败"); if (ContinueOnError.Get(context)) { } else { throw; } } }
private void BodyFaulted(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom) { if (ContinueOnError.Get(faultContext)) { // Cancel all remaining actions for the current event. faultContext.CancelChildren(); // ... but continue monitoring and triggering new events. faultContext.HandleFault(); Trace.TraceError(propagatedException.ToString()); } else { CleanUp(faultContext); throw propagatedException; } }
protected override void Execute(CodeActivityContext context) { FileStream fileStream = null; try { string filePath = Path.Get(context); string fileName = Name.Get(context); if (string.IsNullOrEmpty(filePath)) { fileStream = File.Create(fileName); } else { if (string.IsNullOrEmpty(fileName)) { fileStream = File.Create(filePath); } else { fileStream = File.Create(System.IO.Path.Combine(filePath, fileName)); } } } catch { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "有一个错误产生", "创建文件失败!"); if (ContinueOnError.Get(context)) { } else { throw; } } finally { if (fileStream != null) { fileStream.Close(); } } }
protected override IAsyncResult BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, object state) { try { m_Delegate = new runDelegate(Run); var selStr = Selector.Get(context); UiElement element = null; element = Common.GetValueOrDefault(context, this.Element, null); if (element == null && selStr != null) { element = UiElement.FromSelector(selStr); } else { PropertyDescriptor property = context.DataContext.GetProperties()[EleScope.GetEleScope]; element = property.GetValue(context.DataContext) as UiElement; } if (WaitActive) { //等待元素活动逻辑 } if (WaitVisible) { //等待元素可见逻辑 } if (element != null) { FoundElement.Set(context, element); } } catch (Exception e) { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "获取子节点元素失败", e.Message); if (ContinueOnError.Get(context)) { return(m_Delegate.BeginInvoke(callback, state)); } else { throw e; } } return(m_Delegate.BeginInvoke(callback, state)); }
protected override void Execute(CodeActivityContext context) { Int32 _delayAfter = GetValueOrDefault(context, this.DelayAfter, 300); Int32 _delayBefore = GetValueOrDefault(context, this.DelayBefore, 300); try { Thread.Sleep(_delayBefore); var selStr = Selector.Get(context); UiElement element = GetValueOrDefault(context, this.Element, null); if (element == null && selStr != null) { element = UiElement.FromSelector(selStr); } if (element != null) { element.SetForeground(); } else { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "有一个错误产生", "查找不到元素"); if (ContinueOnError.Get(context)) { } else { throw new NotImplementedException("查找不到元素"); } } Thread.Sleep(_delayAfter); } catch (Exception e) { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "激活UI元素失败", e.Message); if (ContinueOnError.Get(context)) { } else { throw; } } }
protected override void Execute(CodeActivityContext context) { IList <string> imports = GetImports(GetRootActivity(context)); string code = Code; bool flag = ContinueOnError.Get(context); List <Tuple <string, Type, ArgumentDirection> > list = new List <Tuple <string, Type, ArgumentDirection> >(Arguments.Count); object[] array = new object[Arguments.Count]; int num = 0; foreach (KeyValuePair <string, Argument> argument2 in Arguments) { list.Add(new Tuple <string, Type, ArgumentDirection>(argument2.Key, argument2.Value.ArgumentType, argument2.Value.Direction)); array[num++] = argument2.Value.Get(context); } try { string imports2 = GetImports(imports); GetCompilerRunner(code, list, imports2).Run(array); int num3 = 0; foreach (Tuple <string, Type, ArgumentDirection> item in list) { Argument argument = Arguments[item.Item1]; if (argument.Direction != 0) { argument.Set(context, array[num3]); } num3++; } } catch (ArgumentException) { throw; } catch (Exception) { if (!flag) { throw; } } }
protected override void Execute(CodeActivityContext context) { try { Int32 _HighlightTime = GetValueOrDefault(context, HighlightTime, 1); Color _Value = GetValueOrDefault(context, Value, Color.Red); var selStr = Selector.Get(context); UiElement element = GetValueOrDefault(context, this.Element, null); if (element == null && selStr != null) { element = UiElement.FromSelector(selStr); } if (element != null) { element.DrawHighlight(_Value, TimeSpan.FromSeconds(_HighlightTime), true); Thread.Sleep(_HighlightTime * 1); } else { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "有一个错误产生", "查找不到元素"); if (ContinueOnError.Get(context)) { return; } else { throw new NotImplementedException("查找不到元素"); } } } catch (Exception e) { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "UI元素设置高亮失败", e.Message); if (ContinueOnError.Get(context)) { } else { throw; } } }
/// <summary> /// Execute a task object for a given bucket. /// </summary> /// <param name="taskExecutionHost">The host used to execute the task.</param> /// <param name="taskLoggingContext">The logging context.</param> /// <param name="taskHost">The task host for the task.</param> /// <param name="bucket">The batching bucket</param> /// <param name="howToExecuteTask">The task execution mode</param> /// <returns>The result of running the task.</returns> private async Task<WorkUnitResult> ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) { UpdateContinueOnError(bucket, taskHost); bool taskResult = false; WorkUnitResultCode resultCode = WorkUnitResultCode.Success; WorkUnitActionCode actionCode = WorkUnitActionCode.Continue; if (!taskExecutionHost.SetTaskParameters(_taskNode.ParametersForBuild)) { // The task cannot be initialized. ProjectErrorUtilities.VerifyThrowInvalidProject(false, _targetChildInstance.Location, "TaskParametersError", _taskNode.Name, String.Empty); } else { bool taskReturned = false; Exception taskException = null; // If this is the MSBuild task, we need to execute it's special internal method. TaskExecutionHost host = taskExecutionHost as TaskExecutionHost; Type taskType = host.TaskInstance.GetType(); try { if (taskType == typeof(MSBuild)) { MSBuild msbuildTask = host.TaskInstance as MSBuild; ErrorUtilities.VerifyThrow(msbuildTask != null, "Unexpected MSBuild internal task."); _targetBuilderCallback.EnterMSBuildCallbackState(); try { taskResult = await msbuildTask.ExecuteInternal(); } finally { _targetBuilderCallback.ExitMSBuildCallbackState(); } } else if (taskType == typeof(CallTarget)) { CallTarget callTargetTask = host.TaskInstance as CallTarget; taskResult = await callTargetTask.ExecuteInternal(); } else { using (FullTracking.Track(taskLoggingContext.TargetLoggingContext.Target.Name, _taskNode.Name, _buildRequestEntry.ProjectRootDirectory, _buildRequestEntry.RequestConfiguration.Project.PropertiesToBuildWith)) { taskResult = taskExecutionHost.Execute(); } } } catch (Exception ex) { if (ExceptionHandling.IsCriticalException(ex) || (Environment.GetEnvironmentVariable("MSBUILDDONOTCATCHTASKEXCEPTIONS") == "1")) { throw; } taskException = ex; } if (taskException == null) { taskReturned = true; // Set the property "MSBuildLastTaskResult" to reflect whether the task succeeded or not. // The main use of this is if ContinueOnError is true -- so that the next task can consult the result. // So we want it to be "false" even if ContinueOnError is true. // The constants "true" and "false" should NOT be localized. They become property values. bucket.Lookup.SetProperty(ProjectPropertyInstance.Create(ReservedPropertyNames.lastTaskResult, taskResult ? "true" : "false", true/* may be reserved */, _buildRequestEntry.RequestConfiguration.Project.IsImmutable)); } else { Type type = taskException.GetType(); if (type == typeof(LoggerException)) { // if a logger has failed, abort immediately // Polite logger failure _continueOnError = ContinueOnError.ErrorAndStop; // Rethrow wrapped in order to avoid losing the callstack throw new LoggerException(taskException.Message, taskException); } else if (type == typeof(InternalLoggerException)) { // Logger threw arbitrary exception _continueOnError = ContinueOnError.ErrorAndStop; InternalLoggerException ex = taskException as InternalLoggerException; // Rethrow wrapped in order to avoid losing the callstack throw new InternalLoggerException(taskException.Message, taskException, ex.BuildEventArgs, ex.ErrorCode, ex.HelpKeyword, ex.InitializationException); } else if (type == typeof(ThreadAbortException)) { Thread.ResetAbort(); _continueOnError = ContinueOnError.ErrorAndStop; // Cannot rethrow wrapped as ThreadAbortException is sealed and has no appropriate constructor // Stack will be lost throw taskException; } else if (type == typeof(BuildAbortedException)) { _continueOnError = ContinueOnError.ErrorAndStop; // Rethrow wrapped in order to avoid losing the callstack throw new BuildAbortedException(taskException.Message, ((BuildAbortedException)taskException)); } else if (type == typeof(CircularDependencyException)) { _continueOnError = ContinueOnError.ErrorAndStop; ProjectErrorUtilities.ThrowInvalidProject(taskLoggingContext.Task.Location, "CircularDependency", taskLoggingContext.TargetLoggingContext.Target.Name); } else if (type == typeof(InvalidProjectFileException)) { // Just in case this came out of a task, make sure it's not // marked as having been logged. InvalidProjectFileException ipex = (InvalidProjectFileException)taskException; ipex.HasBeenLogged = false; if (_continueOnError != ContinueOnError.ErrorAndStop) { taskLoggingContext.LogInvalidProjectFileError(ipex); taskLoggingContext.LogComment(MessageImportance.Normal, "ErrorConvertedIntoWarning"); } else { // Rethrow wrapped in order to avoid losing the callstack throw new InvalidProjectFileException(ipex.Message, ipex); } } else if (type == typeof(Exception) || type.IsSubclassOf(typeof(Exception))) { // Occasionally, when debugging a very uncommon task exception, it is useful to loop the build with // a debugger attached to break on 2nd chance exceptions. // That requires that there needs to be a way to not catch here, by setting an environment variable. if (ExceptionHandling.IsCriticalException(taskException) || (Environment.GetEnvironmentVariable("MSBUILDDONOTCATCHTASKEXCEPTIONS") == "1")) { // Wrapping in an Exception will unfortunately mean that this exception would fly through any IsCriticalException above. // However, we should not have any, also we should not have stashed such an exception anyway. throw new Exception(taskException.Message, taskException); } Exception exceptionToLog = taskException; if (exceptionToLog is TargetInvocationException) { exceptionToLog = exceptionToLog.InnerException; } // handle any exception thrown by the task during execution // NOTE: We catch ALL exceptions here, to attempt to completely isolate the Engine // from failures in the task. if (_continueOnError == ContinueOnError.WarnAndContinue) { taskLoggingContext.LogTaskWarningFromException ( new BuildEventFileInfo(_targetChildInstance.Location), exceptionToLog, _taskNode.Name ); // Log a message explaining why we converted the previous error into a warning. taskLoggingContext.LogComment(MessageImportance.Normal, "ErrorConvertedIntoWarning"); } else { taskLoggingContext.LogFatalTaskError ( new BuildEventFileInfo(_targetChildInstance.Location), exceptionToLog, _taskNode.Name ); } } else { ErrorUtilities.ThrowInternalErrorUnreachable(); } } // If the task returned attempt to gather its outputs. If gathering outputs fails set the taskResults // to false if (taskReturned) { taskResult = GatherTaskOutputs(taskExecutionHost, howToExecuteTask, bucket) && taskResult; } // If the taskResults are false look at ContinueOnError. If ContinueOnError=false (default) // mark the taskExecutedSuccessfully=false. Otherwise let the task succeed but log a normal // pri message that says this task is continuing because ContinueOnError=true resultCode = taskResult ? WorkUnitResultCode.Success : WorkUnitResultCode.Failed; actionCode = WorkUnitActionCode.Continue; if (resultCode == WorkUnitResultCode.Failed) { if (_continueOnError == ContinueOnError.ErrorAndStop) { actionCode = WorkUnitActionCode.Stop; } else { // This is the ErrorAndContinue or WarnAndContinue case... string settingString = "true"; if (_taskNode.ContinueOnErrorLocation != null) { settingString = bucket.Expander.ExpandIntoStringAndUnescape(_taskNode.ContinueOnError, ExpanderOptions.ExpandAll, _taskNode.ContinueOnErrorLocation); // expand embedded item vectors after expanding properties and item metadata } taskLoggingContext.LogComment ( MessageImportance.Normal, "TaskContinuedDueToContinueOnError", "ContinueOnError", _taskNode.Name, settingString ); actionCode = WorkUnitActionCode.Continue; } } } WorkUnitResult result = new WorkUnitResult(resultCode, actionCode, null); return result; }
/// <summary> /// Recomputes the task's "ContinueOnError" setting. /// </summary> /// <param name="bucket">The bucket being executed.</param> /// <param name="taskHost">The task host to use.</param> /// <remarks> /// There are four possible values: /// false - Error and stop if the task fails. /// true - Warn and continue if the task fails. /// ErrorAndContinue - Error and continue if the task fails. /// WarnAndContinue - Same as true. /// </remarks> private void UpdateContinueOnError(ItemBucket bucket, TaskHost taskHost) { string continueOnErrorAttribute = _taskNode.ContinueOnError; _continueOnError = ContinueOnError.ErrorAndStop; if (_taskNode.ContinueOnErrorLocation != null) { string expandedValue = bucket.Expander.ExpandIntoStringAndUnescape(continueOnErrorAttribute, ExpanderOptions.ExpandAll, _taskNode.ContinueOnErrorLocation); // expand embedded item vectors after expanding properties and item metadata try { if (String.Equals(XMakeAttributes.ContinueOnErrorValues.errorAndContinue, expandedValue, StringComparison.OrdinalIgnoreCase)) { _continueOnError = ContinueOnError.ErrorAndContinue; } else if (String.Equals(XMakeAttributes.ContinueOnErrorValues.warnAndContinue, expandedValue, StringComparison.OrdinalIgnoreCase)) { _continueOnError = ContinueOnError.WarnAndContinue; } else if (String.Equals(XMakeAttributes.ContinueOnErrorValues.errorAndStop, expandedValue, StringComparison.OrdinalIgnoreCase)) { _continueOnError = ContinueOnError.ErrorAndStop; } else { // if attribute doesn't exist, default to "false" // otherwise, convert its value to a boolean bool value = ConversionUtilities.ConvertStringToBool(expandedValue); _continueOnError = value ? ContinueOnError.WarnAndContinue : ContinueOnError.ErrorAndStop; } } catch (ArgumentException e) { // handle errors in string-->bool conversion ProjectErrorUtilities.VerifyThrowInvalidProject(false, _taskNode.ContinueOnErrorLocation, "InvalidContinueOnErrorAttribute", _taskNode.Name, e.Message); } } // We need to access an internal method of the EngineProxy in order to update the value // of continueOnError that will be returned to the task when the task queries IBuildEngine for it taskHost.ContinueOnError = (_continueOnError != ContinueOnError.ErrorAndStop); taskHost.ConvertErrorsToWarnings = (_continueOnError == ContinueOnError.WarnAndContinue); }
/// <summary> /// Execute a single bucket /// </summary> /// <returns>true if execution succeeded</returns> private async Task<WorkUnitResult> ExecuteBucket(TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Dictionary<string, string> lookupHash) { // On Intrinsic tasks, we do not allow batchable params, therefore metadata is excluded. ParserOptions parserOptions = (_taskNode == null) ? ParserOptions.AllowPropertiesAndItemLists : ParserOptions.AllowAll; WorkUnitResult taskResult = new WorkUnitResult(WorkUnitResultCode.Failed, WorkUnitActionCode.Stop, null); bool condition = ConditionEvaluator.EvaluateCondition ( _targetChildInstance.Condition, parserOptions, bucket.Expander, ExpanderOptions.ExpandAll, _buildRequestEntry.ProjectRootDirectory, _targetChildInstance.ConditionLocation, _targetLoggingContext.LoggingService, _targetLoggingContext.BuildEventContext ); if (!condition) { LogSkippedTask(bucket, howToExecuteTask); taskResult = new WorkUnitResult(WorkUnitResultCode.Skipped, WorkUnitActionCode.Continue, null); return taskResult; } // If this is an Intrinsic task, it gets handled in a special fashion. if (_taskNode == null) { ExecuteIntrinsicTask(bucket); taskResult = new WorkUnitResult(WorkUnitResultCode.Success, WorkUnitActionCode.Continue, null); } else { if (_componentHost.BuildParameters.SaveOperatingEnvironment) { // Change to the project root directory. // If that directory does not exist, do nothing. (Do not check first as it is almost always there and it is slow) // This is because if the project has not been saved, this directory may not exist, yet it is often useful to still be able to build the project. // No errors are masked by doing this: errors loading the project from disk are reported at load time, if necessary. NativeMethodsShared.SetCurrentDirectory(_buildRequestEntry.ProjectRootDirectory); } if (howToExecuteTask == TaskExecutionMode.ExecuteTaskAndGatherOutputs) { // We need to find the task before logging the task started event so that the using task statement comes before the task started event IDictionary<string, string> taskIdentityParameters = GatherTaskIdentityParameters(bucket.Expander); TaskRequirements? requirements = _taskExecutionHost.FindTask(taskIdentityParameters); if (requirements != null) { TaskLoggingContext taskLoggingContext = _targetLoggingContext.LogTaskBatchStarted(_projectFullPath, _targetChildInstance); try { if ( ((requirements.Value & TaskRequirements.RequireSTAThread) == TaskRequirements.RequireSTAThread) && (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA) ) { taskResult = ExecuteTaskInSTAThread(bucket, taskLoggingContext, taskIdentityParameters, taskHost, howToExecuteTask); } else { taskResult = await InitializeAndExecuteTask(taskLoggingContext, bucket, taskIdentityParameters, taskHost, howToExecuteTask); } if (lookupHash != null) { List<string> overrideMessages = bucket.Lookup.GetPropertyOverrideMessages(lookupHash); if (overrideMessages != null) { foreach (string s in overrideMessages) { taskLoggingContext.LogCommentFromText(MessageImportance.Low, s); } } } } catch (InvalidProjectFileException e) { // Make sure the Invalid Project error gets logged *before* TaskFinished. Otherwise, // the log is confusing. taskLoggingContext.LogInvalidProjectFileError(e); _continueOnError = ContinueOnError.ErrorAndStop; } finally { // Flag the completion of the task. taskLoggingContext.LogTaskBatchFinished(_projectFullPath, taskResult.ResultCode == WorkUnitResultCode.Success || taskResult.ResultCode == WorkUnitResultCode.Skipped); if (taskResult.ResultCode == WorkUnitResultCode.Failed && _continueOnError == ContinueOnError.WarnAndContinue) { // We coerce the failing result to a successful result. taskResult = new WorkUnitResult(WorkUnitResultCode.Success, taskResult.ActionCode, taskResult.Exception); } } } } else { ErrorUtilities.VerifyThrow(howToExecuteTask == TaskExecutionMode.InferOutputsOnly, "should be inferring"); ErrorUtilities.VerifyThrow ( GatherTaskOutputs(null, howToExecuteTask, bucket), "The method GatherTaskOutputs() should never fail when inferring task outputs." ); if (lookupHash != null) { List<string> overrideMessages = bucket.Lookup.GetPropertyOverrideMessages(lookupHash); if (overrideMessages != null) { foreach (string s in overrideMessages) { _targetLoggingContext.LogCommentFromText(MessageImportance.Low, s); } } } taskResult = new WorkUnitResult(WorkUnitResultCode.Success, WorkUnitActionCode.Continue, null); } } return taskResult; }
/// <summary> /// Builds the task specified by the XML. /// </summary> /// <param name="loggingContext">The logging context of the target</param> /// <param name="requestEntry">The build request entry being built</param> /// <param name="targetBuilderCallback">The target builder callback.</param> /// <param name="taskInstance">The task instance.</param> /// <param name="mode">The mode in which to execute tasks.</param> /// <param name="inferLookup">The lookup to be used for inference.</param> /// <param name="executeLookup">The lookup to be used during execution.</param> /// <returns>The result of running the task batch.</returns> /// <remarks> /// The ExecuteTask method takes a task as specified by XML and executes it. This procedure is comprised /// of the following steps: /// 1. Loading the Task from its containing assembly by looking it up in the task registry /// 2. Determining if the task is batched. If it is, create the batches and execute each as if it were a non-batched task /// 3. If the task is not batched, execute it. /// 4. If the task was batched, hold on to its Lookup until all of the natches are done, then merge them. /// </remarks> public async Task<WorkUnitResult> ExecuteTask(TargetLoggingContext loggingContext, BuildRequestEntry requestEntry, ITargetBuilderCallback targetBuilderCallback, ProjectTargetInstanceChild taskInstance, TaskExecutionMode mode, Lookup inferLookup, Lookup executeLookup, CancellationToken cancellationToken) { ErrorUtilities.VerifyThrow(taskInstance != null, "Need to specify the task instance."); _buildRequestEntry = requestEntry; _targetBuilderCallback = targetBuilderCallback; _cancellationToken = cancellationToken; _targetChildInstance = taskInstance; // In the case of Intrinsic tasks, taskNode will end up null. Currently this is how we distinguish // intrinsic from extrinsic tasks. _taskNode = taskInstance as ProjectTaskInstance; if (_taskNode != null && requestEntry.Request.HostServices != null) { _taskHostObject = requestEntry.Request.HostServices.GetHostObject(requestEntry.RequestConfiguration.Project.FullPath, loggingContext.Target.Name, _taskNode.Name); } _projectFullPath = requestEntry.RequestConfiguration.Project.FullPath; // this.handleId = handleId; No handles // this.parentModule = parentModule; No task execution module _continueOnError = ContinueOnError.ErrorAndStop; _targetLoggingContext = loggingContext; WorkUnitResult taskResult = new WorkUnitResult(WorkUnitResultCode.Failed, WorkUnitActionCode.Stop, null); if ((mode & TaskExecutionMode.InferOutputsOnly) == TaskExecutionMode.InferOutputsOnly) { taskResult = await ExecuteTask(TaskExecutionMode.InferOutputsOnly, inferLookup); } if ((mode & TaskExecutionMode.ExecuteTaskAndGatherOutputs) == TaskExecutionMode.ExecuteTaskAndGatherOutputs) { taskResult = await ExecuteTask(TaskExecutionMode.ExecuteTaskAndGatherOutputs, executeLookup); } return taskResult; }