Ejemplo n.º 1
0
        public ReplayPage()
        {
            appCapabilities = new DesiredCapabilities();
            appCapabilities.SetCapability("app", "Root");
            appCapabilities.SetCapability("deviceName", "WindowsPC");
            appCapabilities.SetCapability("newCommandTimeout", TIMEOUT);

            imageComparer        = new ImageComparer();
            jsonSimpleWrapper    = new JsonSimpleWrapper();
            eventFilesList       = new List <String>();
            installDirectory     = AppDomain.CurrentDomain.BaseDirectory.ToString();
            currentEventTapCount = 0;
            InitializeComponent();
        }
Ejemplo n.º 2
0
        //[DllImport("user32.dll")]
        //static extern bool SetLayeredWindowAttributes(IntPtr hwnd, uint crKey, byte bAlpha, uint dwFlags);

        //[DllImport("user32.dll")]
        //static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
        //public static IntPtr SetWindowLong(IntPtr hWnd, int nIndex, IntPtr dwNewLong)
        //{
        //    int error = 0;
        //    IntPtr result = IntPtr.Zero;
        //    // Win32 SetWindowLong doesn't clear error on success
        //    SetLastError(0);

        //    if (IntPtr.Size == 4)
        //    {
        //        // use SetWindowLong
        //        Int32 tempResult = IntSetWindowLong(hWnd, nIndex, IntPtrToInt32(dwNewLong));
        //        error = Marshal.GetLastWin32Error();
        //        result = new IntPtr(tempResult);
        //    }
        //    else
        //    {
        //        // use SetWindowLongPtr
        //        result = IntSetWindowLongPtr(hWnd, nIndex, dwNewLong);
        //        error = Marshal.GetLastWin32Error();
        //    }

        //    if ((result == IntPtr.Zero) && (error != 0))
        //    {
        //        throw new System.ComponentModel.Win32Exception(error);
        //    }

        //    return result;
        //}

        //[DllImport("user32.dll", EntryPoint = "SetWindowLongPtr", SetLastError = true)]
        //private static extern IntPtr IntSetWindowLongPtr(IntPtr hWnd, int nIndex, IntPtr dwNewLong);

        //[DllImport("user32.dll", EntryPoint = "SetWindowLong", SetLastError = true)]
        //private static extern Int32 IntSetWindowLong(IntPtr hWnd, int nIndex, Int32 dwNewLong);

        //private static int IntPtrToInt32(IntPtr intPtr)
        //{
        //    return unchecked((int)intPtr.ToInt64());
        //}

        //[DllImport("user32.dll", SetLastError = true)]
        //static extern bool GetLayeredWindowAttributes(IntPtr hwnd, out uint crKey, out byte bAlpha, out uint dwFlags);

        //[DllImport("kernel32.dll", EntryPoint = "SetLastError")]
        //public static extern void SetLastError(int dwErrorCode);


        ////[DllImport("user32.dll")]
        ////static extern int GetWindowLong(IntPtr hWnd, int nIndex);
        //[DllImport("user32.dll")]
        //public static extern IntPtr GetWindowLong(IntPtr hWnd, int nIndex);

        //[DllImport("User32.dll")]
        //internal static extern IntPtr SetForegroundWindow(IntPtr hWnd);

        //[DllImport("user32.dll")]
        //internal static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

        //internal static readonly IntPtr InvalidHandleValue = IntPtr.Zero;
        //internal const int SW_MAXIMIZE = 3;

        //public const int GWL_EXSTYLE = -20;
        //public const int WS_EX_LAYERED = 0x80000;
        //public const int WS_EX_TRANSPARENT = 32;
        //public const int LWA_ALPHA = 0x2;
        //public const int LWA_COLORKEY = 0x1;
        #endregion

        public RecordPage()
        {
            appCapabilities = new DesiredCapabilities();
            appCapabilities.SetCapability("app", "Root");
            appCapabilities.SetCapability("deviceName", "WindowsPC");
            appCapabilities.SetCapability("newCommandTimeout", TIMEOUT);
            //session.Manage().Window.Maximize();
            //Array.ForEach(Process.GetProcessesByName("WinAppDriver"), x => x.Kill());
            session = new WindowsDriver <WindowsElement>(new Uri(WindowsApplicationDriverUrl), appCapabilities);
            InitializeComponent();
            this.TouchDown      += new EventHandler <TouchEventArgs>(TouchableThing_TouchDown);
            touchEventList       = new List <TouchEventArgs>();
            eventList            = new List <Coordinate>();
            jsonSimpleWrapper    = new JsonSimpleWrapper();
            installDirectory     = AppDomain.CurrentDomain.BaseDirectory.ToString();
            imageComparer        = new ImageComparer();
            currentEventTapCount = 0;
            this.KeyDown        += new KeyEventHandler(OnButtonKeyDown);
        }