public static bool Compare (AutomationElement el1, AutomationElement el2) { if (el1 == null) throw new ArgumentNullException ("el1"); if (el2 == null) throw new ArgumentNullException ("el2"); return Compare (el1.GetRuntimeId (), el2.GetRuntimeId ()); }
internal override bool AppliesTo(AutomationElement element) { // TODO: Test caching behavior object currentVal = element.GetCurrentPropertyValue(property); object conditionVal = val; if (currentVal == null || conditionVal == null) { return(currentVal == conditionVal); } // Compare AutomationElements against Condition's // stored runtime ID array if (property == AEIds.LabeledByProperty || property == GridItemPatternIdentifiers.ContainingGridProperty || property == SelectionItemPatternIdentifiers.SelectionContainerProperty) { AutomationElement elementVal = currentVal as AutomationElement; int [] conditionId = conditionVal as int []; return(currentVal != null && conditionId != null && Automation.Compare(conditionId, elementVal.GetRuntimeId())); } // For some other properties, need to reconstruct proper // object for comparison if (property == AEIds.BoundingRectangleProperty) { double [] rectArray = (double [])val; conditionVal = new Rect(rectArray [0], rectArray [1], rectArray [2], rectArray [3]); } else if (property == AEIds.ClickablePointProperty) { double [] pointArray = (double [])val; conditionVal = new Point(pointArray [0], pointArray [1]); } else if (property == AEIds.ControlTypeProperty) { conditionVal = ControlType.LookupById((int)val); } else if (property == AEIds.CultureProperty) { conditionVal = new CultureInfo((int)val); } return(ArePropertyValuesEqual(conditionVal, currentVal)); }
public static bool Compare(AutomationElement el1, AutomationElement el2) { if (el1 == null) { throw new ArgumentNullException("el1"); } if (el2 == null) { throw new ArgumentNullException("el2"); } return(Compare(el1.GetRuntimeId(), el2.GetRuntimeId())); }
//------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructors internal EventListenerClientSide(AutomationElement elRoot, Delegate clientCallback, EventListener l) { _eventListener = l; _refElement = elRoot; // Ensure that RuntimeId is cached on elRoot so that later compares can be done w/o accessing the native element _refRid = elRoot.GetRuntimeId(); _clientCallback = clientCallback; _callbackDelegate = new UiaCoreApi.UiaEventCallback(OnEvent); _gch = GCHandle.Alloc(_callbackDelegate); // }
public static EventListener Remove(AutomationEvent eventId, AutomationElement element, Delegate handler) { // Create a prototype to seek int[] runtimeId = (element == null) ? null : element.GetRuntimeId(); EventListener prototype = new EventListener(eventId.Id, runtimeId, handler); lock (_events) { LinkedListNode<EventListener> node = _events.Find(prototype); if (node == null) { throw new ArgumentException("event handler not found"); } EventListener result = node.Value; _events.Remove(node); return result; } }
// IsListeningFor - called by UIAccess client during removal of listeners. Returns // true if rid, eventId and clientCallback represent this listener instance. internal bool IsListeningFor(AutomationEvent eventId, AutomationElement el, Delegate clientCallback) { // Removing the event handler using the element RuntimeId prevents problems with dead elements int[] rid = null; try { rid = el.GetRuntimeId(); } catch( ElementNotAvailableException ) { // This can't be the element this instance is holding because when // creating this instance we caused the RuntimeId to be cached. return false; } if( !Misc.Compare( _refRid, rid ) ) return false; if( _eventListener.EventId != eventId ) return false; if (_clientCallback != clientCallback) return false; return true; }
public static void AutomationElementGetRuntimeId(AutomationElement element) { Dump("GetRuntimeId()", true, element); try { object obj = element.GetRuntimeId(); } catch (Exception exception) { VerifyException(element, exception, typeof(ElementNotAvailableException)); } }
// OnWindowShowOrOpen - Called by the WindowShowOrOpenTracker class when UI is shown or created private static void OnWindowShowOrOpen( IntPtr hwnd, AutomationElement rawEl ) { bool doWindowOpenedEvent = false; bool doStructureChangedEvent = false; lock ( _classLock ) { if (_listeners != null) { // if rawEl is w/in the scope of any listeners then register for events in the new UI for (int i = 0; i < _listeners.Count; i++) { EventListenerClientSide ec = (EventListenerClientSide)_listeners[i]; EventListener l = ec.EventListener; if ( l.EventId == WindowPattern.WindowOpenedEvent ) doWindowOpenedEvent = true; if ( l.EventId == AutomationElement.StructureChangedEvent ) doStructureChangedEvent = true; // Only advise UI contexts if the provider might raise that event. if (!ShouldAdviseProviders( l.EventId )) continue; // Only advise UI contexts if the element is w/in scope of the reference element if (!ec.WithinScope( rawEl )) continue; // Notify the server side UiaCoreApi.UiaEventAddWindow(ec.EventHandle, hwnd); } } } // Piggy-back on the listener for Windows hiding or closing to raise WindowClosed and StructureChanged events. if ( doWindowOpenedEvent ) { if ( HwndProxyElementProvider.IsWindowPatternWindow( NativeMethods.HWND.Cast( hwnd ) ) ) { // Go ahead and raise a client-side only WindowOpenedEvent (if anyone is listening) AutomationEventArgs e = new AutomationEventArgs( WindowPattern.WindowOpenedEvent ); RaiseEventInThisClientOnly( WindowPattern.WindowOpenedEvent, rawEl, e); } } if ( doStructureChangedEvent ) { // Filter on the control elements. Otherwise, this is extremely noisy. Consider not filtering if there is feedback. //ControlType ct = (ControlType)rawEl.GetPropertyValue( AutomationElement.ControlTypeProperty ); //if ( ct != null ) { // Last,raise an event for structure changed StructureChangedEventArgs e = new StructureChangedEventArgs( StructureChangeType.ChildAdded, rawEl.GetRuntimeId() ); RaiseEventInThisClientOnly(AutomationElement.StructureChangedEvent, rawEl, e); } } }
/// <summary> /// Compares the two automation elements and returns if /// they are identical or not /// </summary> /// <param name="ele1">first element</param> /// <param name="ele2">second element</param> /// <returns></returns> public static bool IsDifferent(AutomationElement ele1, AutomationElement ele2) { bool retVal; if (ele1 == null || ele2 == null) { return true; } try { retVal = !Automation.Compare(ele1.GetRuntimeId(), ele2.GetRuntimeId()); } catch { retVal = true; } Log.Debug(retVal ? "YES" : "NO"); return retVal; }
public BasicEventListener(AutomationEvent eventKind, AutomationElement element, AutomationEventHandler handler) : base(eventKind.Id, element.GetRuntimeId(), handler) { Debug.Assert(handler != null); this._basicHandler = handler; }
public StructureEventListener(AutomationEvent eventKind, AutomationElement element, StructureChangedEventHandler handler) : base(AutomationElement.StructureChangedEvent.Id, element.GetRuntimeId(), handler) { Debug.Assert(handler != null); this._structureChangeHandler = handler; }
public PropertyEventListener(AutomationEvent eventKind, AutomationElement element, AutomationPropertyChangedEventHandler handler) : base(AutomationElement.AutomationPropertyChangedEvent.Id, element.GetRuntimeId(), handler) { Debug.Assert(handler != null); this._propChangeHandler = handler; }
public PropertyCondition(AutomationProperty property, object value, PropertyConditionFlags flags) : base() { if (property == null) { throw new ArgumentNullException("property"); } this.property = property; // NotSupported is handled the same way for all properties if (value == AutomationElement.NotSupported) { if ((flags & PropertyConditionFlags.IgnoreCase) == PropertyConditionFlags.IgnoreCase) { throw new ArgumentException("flags"); } this.val = value; this.flags = flags; return; } if (property == AEIds.AcceleratorKeyProperty || property == AEIds.AccessKeyProperty || property == AEIds.AutomationIdProperty || property == AEIds.ClassNameProperty || property == AEIds.HelpTextProperty || property == AEIds.ItemStatusProperty || property == AEIds.ItemTypeProperty || property == AEIds.LocalizedControlTypeProperty || property == AEIds.NameProperty || property == AEIds.FrameworkIdProperty || property == ValuePatternIdentifiers.ValueProperty) { if (value != null && !(value is string)) { throw new ArgumentException("value"); } if (value == null && (flags & PropertyConditionFlags.IgnoreCase) == PropertyConditionFlags.IgnoreCase) { throw new ArgumentException("flags"); } val = value; } else if (property == AEIds.BoundingRectangleProperty) { Rect?rect = null; if (value == null || !(rect = value as Rect?).HasValue) { throw new ArgumentException("value"); } if ((flags & PropertyConditionFlags.IgnoreCase) == PropertyConditionFlags.IgnoreCase) { throw new ArgumentException("flags"); } val = new double [] { rect.Value.X, rect.Value.Y, rect.Value.Width, rect.Value.Height }; } else if (property == AEIds.ClickablePointProperty) { Point?point = null; if (value == null || !(point = value as Point?).HasValue) { throw new ArgumentException("value"); } if ((flags & PropertyConditionFlags.IgnoreCase) == PropertyConditionFlags.IgnoreCase) { throw new ArgumentException("flags"); } val = new double [] { point.Value.X, point.Value.Y }; } else if (property == AEIds.ControlTypeProperty) { ControlType controlType = null; if (value != null && (controlType = value as ControlType) == null) { throw new ArgumentException("value"); } if ((flags & PropertyConditionFlags.IgnoreCase) == PropertyConditionFlags.IgnoreCase) { throw new ArgumentException("flags"); } if (controlType != null) { val = controlType.Id; } } else if (property == AEIds.CultureProperty) { CultureInfo culture = null; if (value != null && (culture = value as CultureInfo) == null) { throw new ArgumentException("value"); } if ((flags & PropertyConditionFlags.IgnoreCase) == PropertyConditionFlags.IgnoreCase) { throw new ArgumentException("flags"); } if (culture != null) { val = culture.LCID; } } else if (property == AEIds.HasKeyboardFocusProperty || property == AEIds.IsContentElementProperty || property == AEIds.IsControlElementProperty || property == AEIds.IsDockPatternAvailableProperty || property == AEIds.IsEnabledProperty || property == AEIds.IsExpandCollapsePatternAvailableProperty || property == AEIds.IsGridItemPatternAvailableProperty || property == AEIds.IsGridPatternAvailableProperty || property == AEIds.IsInvokePatternAvailableProperty || property == AEIds.IsKeyboardFocusableProperty || property == AEIds.IsMultipleViewPatternAvailableProperty || property == AEIds.IsOffscreenProperty || property == AEIds.IsPasswordProperty || property == AEIds.IsRangeValuePatternAvailableProperty || property == AEIds.IsRequiredForFormProperty || property == AEIds.IsScrollItemPatternAvailableProperty || property == AEIds.IsScrollPatternAvailableProperty || property == AEIds.IsSelectionItemPatternAvailableProperty || property == AEIds.IsSelectionPatternAvailableProperty || property == AEIds.IsTableItemPatternAvailableProperty || property == AEIds.IsTablePatternAvailableProperty || property == AEIds.IsTextPatternAvailableProperty || property == AEIds.IsTogglePatternAvailableProperty || property == AEIds.IsTransformPatternAvailableProperty || property == AEIds.IsValuePatternAvailableProperty || property == AEIds.IsWindowPatternAvailableProperty || property == RangeValuePatternIdentifiers.IsReadOnlyProperty || property == ScrollPatternIdentifiers.HorizontallyScrollableProperty || property == ScrollPatternIdentifiers.VerticallyScrollableProperty || property == SelectionItemPatternIdentifiers.IsSelectedProperty || property == SelectionPatternIdentifiers.CanSelectMultipleProperty || property == SelectionPatternIdentifiers.IsSelectionRequiredProperty || property == TransformPatternIdentifiers.CanMoveProperty || property == TransformPatternIdentifiers.CanResizeProperty || property == TransformPatternIdentifiers.CanRotateProperty || property == ValuePatternIdentifiers.IsReadOnlyProperty || property == WindowPatternIdentifiers.CanMaximizeProperty || property == WindowPatternIdentifiers.CanMinimizeProperty || property == WindowPatternIdentifiers.IsModalProperty || property == WindowPatternIdentifiers.IsTopmostProperty) { bool?boolVal = null; if (value == null || !(boolVal = value as bool?).HasValue) { throw new ArgumentException("value"); } if ((flags & PropertyConditionFlags.IgnoreCase) == PropertyConditionFlags.IgnoreCase) { throw new ArgumentException("flags"); } val = boolVal.Value; } else if (property == AEIds.LabeledByProperty || property == GridItemPatternIdentifiers.ContainingGridProperty || property == SelectionItemPatternIdentifiers.SelectionContainerProperty) { AutomationElement element = null; if (value != null && (element = value as AutomationElement) == null) { throw new ArgumentException("value"); } if ((flags & PropertyConditionFlags.IgnoreCase) == PropertyConditionFlags.IgnoreCase) { throw new ArgumentException("flags"); } if (element != null) { val = element.GetRuntimeId(); } } else if (property == AEIds.NativeWindowHandleProperty || property == AEIds.ProcessIdProperty || property == GridItemPatternIdentifiers.ColumnProperty || property == GridItemPatternIdentifiers.ColumnSpanProperty || property == GridItemPatternIdentifiers.RowProperty || property == GridItemPatternIdentifiers.RowSpanProperty || property == GridPatternIdentifiers.ColumnCountProperty || property == GridPatternIdentifiers.RowCountProperty || property == MultipleViewPatternIdentifiers.CurrentViewProperty) { int?intVal = null; if (value == null || !(intVal = value as int?).HasValue) { throw new ArgumentException("value"); } if ((flags & PropertyConditionFlags.IgnoreCase) == PropertyConditionFlags.IgnoreCase) { throw new ArgumentException("flags"); } val = intVal.Value; } else if (property == AEIds.OrientationProperty) { OrientationType?orientation = null; if (value == null || !(orientation = value as OrientationType?).HasValue) { throw new ArgumentException("value"); } if ((flags & PropertyConditionFlags.IgnoreCase) == PropertyConditionFlags.IgnoreCase) { throw new ArgumentException("flags"); } val = orientation.Value; } else if (property == AEIds.RuntimeIdProperty || property == MultipleViewPatternIdentifiers.SupportedViewsProperty) { int [] runtimeId = null; if (value != null && (runtimeId = value as int []) == null) { throw new ArgumentException("value"); } if ((flags & PropertyConditionFlags.IgnoreCase) == PropertyConditionFlags.IgnoreCase) { throw new ArgumentException("flags"); } if (runtimeId != null) { val = runtimeId; } } else if (property == DockPatternIdentifiers.DockPositionProperty) { DockPosition?position = null; if (value == null || !(position = value as DockPosition?).HasValue) { throw new ArgumentException("value"); } if ((flags & PropertyConditionFlags.IgnoreCase) == PropertyConditionFlags.IgnoreCase) { throw new ArgumentException("flags"); } val = position.Value; } else if (property == ExpandCollapsePatternIdentifiers.ExpandCollapseStateProperty) { ExpandCollapseState?state = null; if (value == null || !(state = value as ExpandCollapseState?).HasValue) { throw new ArgumentException("value"); } if ((flags & PropertyConditionFlags.IgnoreCase) == PropertyConditionFlags.IgnoreCase) { throw new ArgumentException("flags"); } val = state.Value; } else if (property == RangeValuePatternIdentifiers.LargeChangeProperty || property == RangeValuePatternIdentifiers.SmallChangeProperty || property == RangeValuePatternIdentifiers.ValueProperty || property == ScrollPatternIdentifiers.HorizontalScrollPercentProperty || property == ScrollPatternIdentifiers.HorizontalViewSizeProperty || property == ScrollPatternIdentifiers.VerticalScrollPercentProperty || property == ScrollPatternIdentifiers.VerticalViewSizeProperty) { double?doubleVal = null; if (value == null || !(doubleVal = value as double?).HasValue) { throw new ArgumentException("value"); } if ((flags & PropertyConditionFlags.IgnoreCase) == PropertyConditionFlags.IgnoreCase) { throw new ArgumentException("flags"); } val = doubleVal.Value; } else if (property == RangeValuePatternIdentifiers.MaximumProperty || property == RangeValuePatternIdentifiers.MinimumProperty) { if ((flags & PropertyConditionFlags.IgnoreCase) == PropertyConditionFlags.IgnoreCase && !(value is string)) { throw new ArgumentException("flags"); } val = value; } else if (property == SelectionPatternIdentifiers.SelectionProperty || property == TableItemPatternIdentifiers.ColumnHeaderItemsProperty || property == TableItemPatternIdentifiers.RowHeaderItemsProperty || property == TablePatternIdentifiers.ColumnHeadersProperty || property == TablePatternIdentifiers.RowHeadersProperty) { AutomationElement [] elements = null; if (value != null && (elements = value as AutomationElement []) == null) { throw new ArgumentException("value"); } if ((flags & PropertyConditionFlags.IgnoreCase) == PropertyConditionFlags.IgnoreCase) { throw new ArgumentException("flags"); } if (elements != null) { val = elements; } } else if (property == TablePatternIdentifiers.RowOrColumnMajorProperty) { RowOrColumnMajor?state = null; if (value == null || !(state = value as RowOrColumnMajor?).HasValue) { throw new ArgumentException("value"); } if ((flags & PropertyConditionFlags.IgnoreCase) == PropertyConditionFlags.IgnoreCase) { throw new ArgumentException("flags"); } val = state.Value; } else if (property == TogglePatternIdentifiers.ToggleStateProperty) { ToggleState?state = null; if (value == null || !(state = value as ToggleState?).HasValue) { throw new ArgumentException("value"); } if ((flags & PropertyConditionFlags.IgnoreCase) == PropertyConditionFlags.IgnoreCase) { throw new ArgumentException("flags"); } val = state.Value; } else if (property == WindowPatternIdentifiers.WindowInteractionStateProperty) { WindowInteractionState?state = null; if (value == null || !(state = value as WindowInteractionState?).HasValue) { throw new ArgumentException("value"); } if ((flags & PropertyConditionFlags.IgnoreCase) == PropertyConditionFlags.IgnoreCase) { throw new ArgumentException("flags"); } val = state.Value; } else if (property == WindowPatternIdentifiers.WindowVisualStateProperty) { WindowVisualState?state = null; if (value == null || !(state = value as WindowVisualState?).HasValue) { throw new ArgumentException("value"); } if ((flags & PropertyConditionFlags.IgnoreCase) == PropertyConditionFlags.IgnoreCase) { throw new ArgumentException("flags"); } val = state.Value; } this.flags = flags; }
// compare two AutomationElements internal static bool Compare(AutomationElement el1, AutomationElement el2) { CheckNonNull(el1, el2); return Compare(el1.GetRuntimeId(), el2.GetRuntimeId()); }
static void Main_2() { bool isOpened = false; try { //Initializing mandatory parameters for application ConfigLibrary.Initialize(); SystemLog.LogAuditMessage(MethodBase.GetCurrentMethod().Name, DiagnosticLevel.level1, EntityGlobal.ROBO_START, typeof(MainframeAutomation).Name); Initialize(); //isOpened = MainFrameAdapter.OpenPcomSessionAndConnect(); //Process p = Process.GetProcesses().SingleOrDefault(item => item.ProcessName == "pcsws"); // Process.GetProcessById("") Process p = Process.GetProcesses().SingleOrDefault(item => item.ProcessName == "filezilla"); System.Windows.Automation.AutomationElement t = WinFormAdapter.GetAEFromHandle(p.MainWindowHandle); //System.Windows.Automation.ControlType System.Windows.Automation.AutomationElement fdsfasdf = WinFormAdapter.GetAEOnChildByName(t, "ID_QUICKCONNECTBAR"); //System.Windows.Automation.AutomationElement fdsfasdf = WinFormAdapter.GetAEOnChildByName(t, "Servidor:"); WinFormAdapter.SetTextInTextArea(t, "fdsafsafasfdasfdsafdasfasfasdfasdfdsafsdafdasfdasfasd " + "\r\n" + "gfsdfdafs" + "\t" + "gadsfdad"); WinFormAdapter.SetTextInTextArea(t, "servidor" + "\t" + "usuario" + "\t" + "contraseña"); /*System.Windows.Automation.AutomationElement Servidor = WinFormAdapter.GetAEOnChildById(fdsfasdf, "-31800"); * System.Windows.Automation.AutomationElement Servidor1 = WinFormAdapter.GetAEOnChildById(fdsfasdf, "31801");*/ System.Windows.Automation.AutomationElement Servidor = WinFormAdapter.GetAEOnChildByName(fdsfasdf, ControlType.Edit, "Servidor:"); System.Windows.Automation.AutomationElement conexionRapida = WinFormAdapter.GetAEOnChildById(fdsfasdf, "-31925"); //System.Windows.Automation.AutomationElement conexionRapida = WinFormAdapter.GetAEOnChildByName(fdsfasdf, "Conexión rápida"); WinFormAdapter.SetText(Servidor, "hola"); //Point conexionRapida.GetClickablePoint(); WinFormAdapter.ClickElement(conexionRapida); //WinFormAdapter.SetText(WinFormAdapter.GetAEOnChildByName(fdsfasdf, "Conexión rápida"), "rrorro"); //System.Windows.Automation.AutomationElement t2 = WinFormAdapter.GetDialogBox(""); t.SetFocus(); //WinFormAdapter.SetText(t, "eeee"); WinFormAdapter.SetTextInTextArea(t, "fdsafsafasfdasfdsafdasfasfasdfasdfdsafsdafdasfdasfasd " + "\r\n" + "gfsdfdafs" + "\t" + "gadsfdad"); string texto = WinFormAdapter.GetText(t); //>> devuelve: //Microsoft Excel - Libro1 t.GetRuntimeId(); t.SetFocus(); System.Windows.Point punto = new System.Windows.Point(40, 40); System.Windows.Automation.AutomationElement xx = WinFormAdapter.GetAEFromBoundingRectangle(punto); string www = WinFormAdapter.GetText(xx); //WinFormAdapter.SetTextInTextArea(xx, "EFDSFSDAFSFDSAFASFA"); IntPtr e = WinFormAdapter.GetHandleForAE(t); const uint WM_KEYDOWN = 0x100; const uint KEYEVENTF_KEYUP = 0x0002; /*IntPtr result3 = SendMessage(WindowToFind, WM_KEYDOWN, ((IntPtr)k), (IntPtr)0);*/ SendMessage(e, WM_KEYDOWN, (IntPtr)Keys.Enter, (IntPtr)0); WinFormAdapter.SetWindowForeground(e); bool eeee = SetForegroundWindow(e); keybd_event((byte)((char)Keys.Enter), 0, KEYEVENTF_KEYUP, IntPtr.Zero); keybd_event((byte)((char)Keys.Enter), 0, KEYEVENTF_KEYUP, IntPtr.Zero); keybd_event((byte)((char)Keys.Enter), 0, KEYEVENTF_KEYUP, IntPtr.Zero); keybd_event((byte)((char)Keys.A), 0, KEYEVENTF_KEYUP, IntPtr.Zero); keybd_event((byte)((char)Keys.A), 0, KEYEVENTF_KEYUP, IntPtr.Zero); keybd_event((byte)((char)Keys.A), 0, KEYEVENTF_KEYUP, IntPtr.Zero); keybd_event((byte)((char)Keys.A), 0, KEYEVENTF_KEYUP, IntPtr.Zero); keybd_event((byte)((char)Keys.A), 0, KEYEVENTF_KEYUP, IntPtr.Zero); keybd_event((byte)((char)Keys.Enter), 0, KEYEVENTF_KEYUP, IntPtr.Zero); keybd_event((byte)((char)Keys.Enter), 0, KEYEVENTF_KEYUP, IntPtr.Zero); //SendKeys.SendWait("EE"); //SendKeys.SendWait(Keys.Enter.ToString()); /*SendKeys.Send("K"); * SendKeys.Send(Keys.Enter.ToString()); * SendKeys.Send(Keys.Enter.ToString()); * SendKeys.Send(Keys.Enter.ToString()); * SendKeys.Send(Keys.Enter.ToString()); * SendKeys.Send(Keys.Enter.ToString()); * SendKeys.Send(Keys.Enter.ToString());*/ Console.Write(www); MessageBox.Show(www); //System.Windows.Automation.AutomationElement t3 = WinFormAdapter.GetAEOnChildByName(t, ""); //WinFormAdapter.ClickElement(t2); /*System.Windows.Automation.AutomationElement t3 = WinFormAdapter.GetAE() * * WinFormAdapter.SetText(t2, "BFPJUARUI");*/ //Thread.Sleep(1000000); /*if (isOpened) * { * new BusinessLogic.BLIspfValidator().DoActivities(); * }**/ Thread.Sleep(10000900); } catch (TcsRpaException e) { SystemLog.LogErrorMessage(e, typeof(MainframeAutomation).Name, MethodBase.GetCurrentMethod().Name); } catch (Exception e) { SystemLog.LogErrorMessage(e, typeof(MainframeAutomation).Name, MethodBase.GetCurrentMethod().Name); } finally { if (isOpened) { MainFrameAdapter.ClosePCOM(); } } SystemLog.LogAuditMessage(MethodBase.GetCurrentMethod().Name, DiagnosticLevel.level1, EntityGlobal.ROBO_END, typeof(MainframeAutomation).Name); Thread.Sleep(2000); }