Пример #1
0
        /// <summary>
        /// 填充主窗体信息
        /// </summary>
        /// <param name="handle">主窗体句柄</param>
        /// <param name="serverName">当前服务器名称</param>
        /// <param name="loginType">当前登陆类型</param>
        protected virtual void OnPaddingProcess(IntPtr handle, string serverName, LoginType loginType)
        {
            ControlHandle controlHandle = GetControlHandle(handle);

            _activeControlHandle = controlHandle;

            if (!Global.SystemConfig.ServerList.ContainsKey(serverName))
            {
                return;
            }

            ServerInfo serverInfo = Global.SystemConfig.ServerList[serverName];

            if (serverInfo.LoginType != loginType)
            {
                return;
            }

            WindowsApi.SendMessage(controlHandle.UsernameHandle, WindowsApi.WM_SETTEXT, 1024, serverInfo.UserName);
            WindowsApi.SendMessage(controlHandle.PasswordHandle, WindowsApi.WM_SETTEXT, 1024, serverInfo.Password);

            if (controlHandle.LoginType == LoginType.Windows)
            {
                WindowsApi.SendMessage(controlHandle.DomainHandle, WindowsApi.WM_SETTEXT, 1024, serverInfo.Domain);
            }

            if (Global.SystemConfig.IsAutoEnter)
            {
                WindowsApi.PostMessage(controlHandle.OkButtonHandle, WindowsApi.WM_KEYDOWN, 0X0D, 0);
            }
        }
Пример #2
0
 void CBTHook_DestroyWindow(IntPtr handle)
 {
     if (IsLoginWindows(handle))
     {
         _activeControlHandle = null;
     }
 }
Пример #3
0
        internal void OnUpdate(out AtsHandles vehicleOperations, AtsVehicleState vehicleState, IntPtr panelArray, IntPtr soundArray)
        {
            PanelOperations.SetSource(panelArray);
            SoundOperations.SetSource(soundArray);

            LastStates.CopyFrom(CurrentStates);
            if (WasJustInitialized)
            {
                LastStates.SetVehicleState(vehicleState);
            }

            CurrentStates.SetVehicleState(vehicleState);

            this.UpdateVelocityFromDeltaLocation();


            ControlHandle.Update();


            foreach (var behaviour in BehaviourArray)
            {
                behaviour.Update();
            }

            LastKeyStates.CopyFrom(CurrentKeyStates);

            vehicleOperations = ControlHandle.Operation;

            WasJustInitialized = false;
        }
Пример #4
0
 internal void CloseOverlayOnInteraction(bool scrolling)
 {
     if (ControlHandle.IsVisible && ControlHandle.IsActive &&
         (scrolling || (!ControlHandle.IsInside(Game.CursorPos2D) && !Overlay.IsInside(Game.CursorPos2D))))
     {
         ControlHandle.IsActive = false;
     }
 }
Пример #5
0
        public static Control Generate(object value)
        {
            ControlHandle handler = new ControlHandle();

            handler.SearchTypes(value);
            handler.SearchFields(value);
            handler.SearchProperties(value);
            handler.AddFlowTable();
            return(handler.GetControl());
        }
        ControlHandle GetControl()
        {
            var ret = new ControlHandle(Interop.View.DownCast(SwigCPtr));

            if (NDalicPINVOKE.SWIGPendingException.Pending)
            {
                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #7
0
        internal void OnControlHandleMoved(int position, ControlHandleType controlHandleType)
        {
            foreach (var behaviour in BehaviourArray)
            {
                behaviour.OnControlHandleMoved(position, controlHandleType);
            }


            ControlHandle.SetOrderedHandlePosition(position, controlHandleType);
        }
Пример #8
0
        /// <summary>
        /// 提取界面服务器信息
        /// </summary>
        /// <param name="controlHandle">窗体控件句柄数据</param>
        /// <returns></returns>
        protected virtual ServerInfo PickUpServerInfo(ControlHandle controlHandle)
        {
            int defaultCheckValue = (int)WindowsApi.SendMessage(controlHandle.DefaultCheckHandle, WindowsApi.BM_GETCHECK, 0, 0);

            if (defaultCheckValue != WindowsApi.BST_CHECKED)
            {
                return(null);
            }

            ServerInfo serverInfo = new ServerInfo();

            serverInfo.Name      = controlHandle.Title;
            serverInfo.LoginType = controlHandle.LoginType;

            StringBuilder stringBuilder = new StringBuilder(1024);

            WindowsApi.SendMessage(controlHandle.UsernameHandle, WindowsApi.WM_GETTEXT, 1024, stringBuilder);
            serverInfo.UserName = stringBuilder.ToString();


            long dwStyle = WindowsApi.GetWindowLong(controlHandle.PasswordHandle, WindowsApi.GWL_STYLE); //获取密码框原来样式

            WindowsApi.SetWindowWord(controlHandle.PasswordHandle, WindowsApi.GWL_STYLE, 0);             //取消所有样式
            WindowsApi.SetWindowLong(controlHandle.PasswordHandle, WindowsApi.GWL_STYLE,
                                     dwStyle & ~WindowsApi.ES_PASSWORD);                                 //去掉密码属性

            stringBuilder.Remove(0, stringBuilder.Length);
            WindowsApi.SendMessage(controlHandle.PasswordHandle, WindowsApi.WM_GETTEXT, 1024, stringBuilder);
            //没有了ES_PASSWORD属性WM_GETTEXT可以成功

            WindowsApi.SetWindowLong(controlHandle.PasswordHandle, WindowsApi.GWL_STYLE, dwStyle); //还原密码框原来样式

            serverInfo.Password = stringBuilder.ToString();
            if (serverInfo.LoginType == LoginType.Windows)
            {
                stringBuilder.Remove(0, stringBuilder.Length);
                WindowsApi.SendMessage(controlHandle.DomainHandle, WindowsApi.WM_GETTEXT, 1024, stringBuilder);
                serverInfo.Domain = stringBuilder.ToString();
            }

            if (string.IsNullOrEmpty(serverInfo.Password))
            {
                return(null);
            }

            return(serverInfo);
        }
Пример #9
0
        public void AccessibilityDoGestureSignalGetConnectionCount()
        {
            tlog.Debug(tag, $"AccessibilityDoGestureSignal_GetConnectionCount START");

            var handle        = new ControlHandle(Interop.View.DownCast(new View().SwigCPtr));
            var testingTarget = new AccessibilityDoGestureSignal(Interop.ControlDevel.DaliToolkitDevelControlAccessibilityDoGestureSignal(handle), false);

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <AccessibilityDoGestureSignal>(testingTarget, "should be an instance of testing target class!");

            var result = testingTarget.GetConnectionCount();

            Assert.IsTrue(result == 0, "result should be 0");

            testingTarget.Dispose();
            tlog.Debug(tag, $"AccessibilityDoGestureSignalGetConnectionCount END (OK)");
        }
Пример #10
0
        public void AccessibilityDoGestureSignalDisconnection()
        {
            tlog.Debug(tag, $"AccessibilityDoGestureSignalDisconnection START");

            var handle        = new ControlHandle(Interop.View.DownCast(new View().SwigCPtr));
            var testingTarget = new AccessibilityDoGestureSignal(Interop.ControlDevel.DaliToolkitDevelControlAccessibilityDoGestureSignal(handle), false);

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <AccessibilityDoGestureSignal>(testingTarget, "should be an instance of testing target class!");

            dummyCallback callback = OnDummyCallback;

            testingTarget.Connect(callback);
            testingTarget.Disconnect(callback);
            testingTarget.Dispose();

            tlog.Debug(tag, $"AccessibilityDoGestureSignalDisconnection END (OK)");
        }
Пример #11
0
        /// <summary>
        /// 获取主窗体中子控件句柄
        /// </summary>
        /// <param name="handle">主窗体句柄</param>
        /// <returns></returns>
        protected ControlHandle GetControlHandle(IntPtr handle)
        {
            ControlHandle controlHandle = new ControlHandle();

            controlHandle.ParentHandle = handle;

            string title = GetHandleText(handle);

            controlHandle.LoginType = GetLoginType(title);
            controlHandle.Title     = RemoveStringPreFlag(title);

            bool existHostName = false;
            int  tabIndex      = 0;

            WindowsApi.EnumChildWindows(handle, (hwnd, lParam) =>
            {
                #region 旧逻辑(已注释)

                //WindowsApi.Rect rect = new WindowsApi.Rect();
                //WindowsApi.GetWindowRect(hwnd, out rect);
                //WindowsApi.Point point = new WindowsApi.Point();
                //point.X = rect.Left;
                //point.Y = rect.Top;
                //WindowsApi.ScreenToClient(handle, ref point);
                //if (controlHandle.LoginType == LoginType.Radmin)
                //{
                //    if (point.X == 83 && point.Y == 20) //用户名
                //        controlHandle.UsernameHandle = hwnd;
                //    else if (point.X == 83 && point.Y == 55) //密码框
                //        controlHandle.PasswordHandle = hwnd;
                //    else if (point.X == 18 && point.Y == 88) //缺省值CheckBox
                //        controlHandle.DefaultCheckHandle = hwnd;

                //    //3.4版Radmin方式登陆的确认按钮Y坐标为111,3.5的为112
                //    else if (point.X == 83 && (point.Y == 111 || point.Y == 112)) //确定按钮
                //        controlHandle.OkButtonHandle = hwnd;
                //    else if (point.X == 180 && (point.Y == 111 || point.Y == 112)) //取消按钮
                //        controlHandle.CancelButtonHandle = hwnd;
                //}
                //else if (controlHandle.LoginType == LoginType.Windows)
                //{
                //    if (point.X == 83 && point.Y == 20) //用户名
                //        controlHandle.UsernameHandle = hwnd;
                //    else if (point.X == 83 && point.Y == 55) //密码框
                //        controlHandle.PasswordHandle = hwnd;
                //    else if (point.X == 83 && point.Y == 89) //域名
                //        controlHandle.DomainHandle = hwnd;

                //    //界面存在“主机名称”标签
                //    else if (point.X == 18 && point.Y == 91)
                //        existHostName = true;

                //    if (existHostName)
                //    {
                //        if (point.X == 18 && point.Y == 153)
                //            controlHandle.DefaultCheckHandle = hwnd;
                //        else if (point.X == 83 && point.Y == 176) //确定按钮
                //            controlHandle.OkButtonHandle = hwnd;
                //        else if (point.X == 180 && point.Y == 176) //取消按钮
                //            controlHandle.CancelButtonHandle = hwnd;
                //    }
                //    else
                //    {
                //        if (point.X == 18 && point.Y == 122)
                //            controlHandle.DefaultCheckHandle = hwnd;
                //        else if (point.X == 83 && point.Y == 145) //确定按钮
                //            controlHandle.OkButtonHandle = hwnd;
                //        else if (point.X == 180 && point.Y == 145) //取消按钮
                //            controlHandle.CancelButtonHandle = hwnd;
                //    }
                //}
                //else
                //    throw new NotImplementedException("unknow ProgramFlag");

                #endregion

                if (controlHandle.LoginType == LoginType.Radmin)
                {
                    if (tabIndex == 0) //用户名
                    {
                        controlHandle.UsernameHandle = hwnd;
                    }
                    else if (tabIndex == 2) //密码框
                    {
                        controlHandle.PasswordHandle = hwnd;
                    }
                    else if (tabIndex == 4) //缺省值CheckBox
                    {
                        controlHandle.DefaultCheckHandle = hwnd;
                    }

                    //3.4版Radmin方式登陆的确认按钮Y坐标为111,3.5的为112
                    else if (tabIndex == 5) //确定按钮
                    {
                        controlHandle.OkButtonHandle = hwnd;
                    }
                    else if (tabIndex == 6) //取消按钮
                    {
                        controlHandle.CancelButtonHandle = hwnd;
                    }
                }
                else if (controlHandle.LoginType == LoginType.Windows)
                {
                    if (tabIndex == 0) //用户名
                    {
                        controlHandle.UsernameHandle = hwnd;
                    }
                    else if (tabIndex == 2) //密码框
                    {
                        controlHandle.PasswordHandle = hwnd;
                    }
                    else if (tabIndex == 4) //域名
                    {
                        controlHandle.DomainHandle = hwnd;
                    }

                    // TODO:暂时没找到如何有此连接的主机
                    ////界面存在“主机名称”标签
                    //else if (point.X == 18 && point.Y == 91)
                    //    existHostName = true;

                    //if (existHostName)
                    //{
                    //    if (point.X == 18 && point.Y == 153)
                    //        controlHandle.DefaultCheckHandle = hwnd;
                    //    else if (point.X == 83 && point.Y == 176) //确定按钮
                    //        controlHandle.OkButtonHandle = hwnd;
                    //    else if (point.X == 180 && point.Y == 176) //取消按钮
                    //        controlHandle.CancelButtonHandle = hwnd;
                    //}
                    //else
                    {
                        if (tabIndex == 6)
                        {
                            controlHandle.DefaultCheckHandle = hwnd;
                        }
                        else if (tabIndex == 7) //确定按钮
                        {
                            controlHandle.OkButtonHandle = hwnd;
                        }
                        else if (tabIndex == 8) //取消按钮
                        {
                            controlHandle.CancelButtonHandle = hwnd;
                        }
                    }
                }
                else
                {
                    throw new NotImplementedException("unknow ProgramFlag");
                }

                tabIndex++;

                return(true);
            }, IntPtr.Zero);

            return(controlHandle);
        }
Пример #12
0
 internal override bool CallMouseLeave()
 {
     return(base.CallMouseLeave() && ControlHandle.CallMouseLeave());
 }
Пример #13
0
 internal override bool CallLeftMouseUp()
 {
     return(base.CallLeftMouseUp() && ControlHandle.CallLeftMouseUp());
 }
Пример #14
0
        /// <summary>
        /// 获取主窗体中子控件句柄
        /// </summary>
        /// <param name="handle">主窗体句柄</param>
        /// <returns></returns>
        protected ControlHandle GetControlHandle(IntPtr handle)
        {
            ControlHandle controlHandle = new ControlHandle();

            controlHandle.ParentHandle = handle;

            string title = GetHandleText(handle);

            controlHandle.LoginType = GetLoginType(title);
            controlHandle.Title     = RemoveStringPreFlag(title);

            bool existHostName = false;

            WindowsApi.EnumChildWindows(handle, (hwnd, lParam) =>
            {
                WindowsApi.Rect rect = new WindowsApi.Rect();
                WindowsApi.GetWindowRect(hwnd, out rect);
                WindowsApi.Point point = new WindowsApi.Point();
                point.X = rect.Left;
                point.Y = rect.Top;
                WindowsApi.ScreenToClient(handle, ref point);
                if (controlHandle.LoginType == LoginType.Radmin)
                {
                    if (point.X == 83 && point.Y == 20) //用户名
                    {
                        controlHandle.UsernameHandle = hwnd;
                    }
                    else if (point.X == 83 && point.Y == 55) //密码框
                    {
                        controlHandle.PasswordHandle = hwnd;
                    }
                    else if (point.X == 18 && point.Y == 88) //缺省值CheckBox
                    {
                        controlHandle.DefaultCheckHandle = hwnd;
                    }

                    //3.4版Radmin方式登陆的确认按钮Y坐标为111,3.5的为112
                    else if (point.X == 83 && (point.Y == 111 || point.Y == 112)) //确定按钮
                    {
                        controlHandle.OkButtonHandle = hwnd;
                    }
                    else if (point.X == 180 && (point.Y == 111 || point.Y == 112)) //取消按钮
                    {
                        controlHandle.CancelButtonHandle = hwnd;
                    }
                }
                else if (controlHandle.LoginType == LoginType.Windows)
                {
                    if (point.X == 83 && point.Y == 20) //用户名
                    {
                        controlHandle.UsernameHandle = hwnd;
                    }
                    else if (point.X == 83 && point.Y == 55) //密码框
                    {
                        controlHandle.PasswordHandle = hwnd;
                    }
                    else if (point.X == 83 && point.Y == 89) //域名
                    {
                        controlHandle.DomainHandle = hwnd;
                    }

                    //界面存在“主机名称”标签
                    else if (point.X == 18 && point.Y == 91)
                    {
                        existHostName = true;
                    }

                    if (existHostName)
                    {
                        if (point.X == 18 && point.Y == 153)
                        {
                            controlHandle.DefaultCheckHandle = hwnd;
                        }
                        else if (point.X == 83 && point.Y == 176) //确定按钮
                        {
                            controlHandle.OkButtonHandle = hwnd;
                        }
                        else if (point.X == 180 && point.Y == 176) //取消按钮
                        {
                            controlHandle.CancelButtonHandle = hwnd;
                        }
                    }
                    else
                    {
                        if (point.X == 18 && point.Y == 122)
                        {
                            controlHandle.DefaultCheckHandle = hwnd;
                        }
                        else if (point.X == 83 && point.Y == 145) //确定按钮
                        {
                            controlHandle.OkButtonHandle = hwnd;
                        }
                        else if (point.X == 180 && point.Y == 145) //取消按钮
                        {
                            controlHandle.CancelButtonHandle = hwnd;
                        }
                    }
                }
                else
                {
                    throw new NotImplementedException("unknow ProgramFlag");
                }

                return(true);
            }, IntPtr.Zero);

            return(controlHandle);
        }