protected override void Execute(CodeActivityContext context) { try { var selStr = Selector.Get(context); UiElement element = Common.GetValueOrDefault(context, this.Element, null); if (element == null && selStr != null) { element = UiElement.FromSelector(selStr); } Bitmap bit = element.CaptureInformativeScreenshot(); Image.Set(context, bit); } catch (Exception e) { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "屏幕截图失败", e.Message); if (ContinueOnError.Get(context)) { } else { throw e; } } }