public AutomationElement GetPreviousSibling(AutomationElement element, ICacheRequest cacheRequest = null) { var child = cacheRequest == null? NativeTreeWalker.GetPreviousSibling(element.ToNative()) : NativeTreeWalker.GetPreviousSibling(element.ToNative(), cacheRequest.ToNative()); return(Automation.WrapNativeElement(child)); }
public AutomationElement GetParent(AutomationElement element, ICacheRequest cacheRequest = null) { var parent = cacheRequest == null? NativeTreeWalker.GetParent(element.ToNative()) : NativeTreeWalker.GetParent(element.ToNative(), cacheRequest.ToNative()); return(Automation.WrapNativeElement(parent)); }
public AutomationElement GetLastChild(AutomationElement element, ICacheRequest cacheRequest = null) { var child = cacheRequest == null? NativeTreeWalker.GetLastChildElement(element.ToNative()) : NativeTreeWalker.GetLastChildElementBuildCache(element.ToNative(), cacheRequest.ToNative()); return(Automation.WrapNativeElement(child)); }
public void HandleDeivce(Object obj) { TcpClient client = (TcpClient)obj; var stream = client.GetStream(); Byte[] bytes = new Byte[2048]; int i; try { while ((i = stream.Read(bytes, 0, bytes.Length)) != 0) { BinaryFormatter binaryFormatter = new BinaryFormatter(); ICacheResponse response; using (MemoryStream ms = new MemoryStream(bytes)) { ICacheRequest cacheRequest = (ICacheRequest)binaryFormatter.Deserialize(ms); if (cacheRequest is ISetCacheRequest setCacheRequest) { _cachingProvider.Set(setCacheRequest.Key, setCacheRequest.Value, new TimeSpan(0, 0, setCacheRequest.ExpiresIn)); response = new SetCacheResponse(true); } else if (cacheRequest is IGetCacheRequest getCacheRequest) { response = _cachingProvider.Get(getCacheRequest.Key); } else { throw new InvalidOperationException("Unknown action!"); } } using (MemoryStream responseMs = new MemoryStream()) { binaryFormatter.Serialize(responseMs, response); byte[] outputBytes = responseMs.ToArray(); stream.Write(outputBytes, 0, outputBytes.Length); } } } catch (Exception e) { Console.WriteLine("Exception: {0}", e.ToString()); client.Close(); } }
public static UIA.CacheRequest ToNative(this ICacheRequest cacheRequest) { return(((UIA2CacheRequest)cacheRequest)?.NativeCacheRequest); }
public static UIA.IUIAutomationCacheRequest ToNative(this ICacheRequest cacheRequest) { return(((UIA3CacheRequest)cacheRequest)?.NativeCacheRequest); }