Example #1
0
        public IntPtr GetWindowHandle(Vip72Handle.Vip72Window window)
        {
            List <Vip72Handle.ChildWindowItem> childWindowItems = this.GetAllChildWindowItems();

            if (childWindowItems.Count == 50)
            {
                switch (window)
                {
                case Vip72Handle.Vip72Window.Exit:
                    return(childWindowItems[25].handle);

                case Vip72Handle.Vip72Window.Login:
                    return(childWindowItems[17].handle);

                case Vip72Handle.Vip72Window.Hide:
                    return(childWindowItems[24].handle);

                case Vip72Handle.Vip72Window.GetRandomList:
                    return(childWindowItems[23].handle);

                case Vip72Handle.Vip72Window.GetProxyByGEO:
                    return(childWindowItems[40].handle);

                case Vip72Handle.Vip72Window.Username:
                    return(childWindowItems[12].handle);

                case Vip72Handle.Vip72Window.Password:
                    return(childWindowItems[13].handle);

                case Vip72Handle.Vip72Window.SelectCountry:
                    return(childWindowItems[25].handle);

                case Vip72Handle.Vip72Window.SelectCountryListView:
                    if (Vip72Handle.IsWindowVisible(childWindowItems[15].handle))
                    {
                        return(childWindowItems[15].handle);
                    }
                    break;

                case Vip72Handle.Vip72Window.SelectRegion:
                    return(childWindowItems[27].handle);

                case Vip72Handle.Vip72Window.Info:
                    return(childWindowItems[2].handle);

                case Vip72Handle.Vip72Window.Status:
                    return(childWindowItems[49].handle);

                case Vip72Handle.Vip72Window.Socks5:
                    return(childWindowItems[1].handle);

                case Vip72Handle.Vip72Window.HTTPProxy:
                    return(childWindowItems[1].handle);

                case Vip72Handle.Vip72Window.MyProxies:
                    return(childWindowItems[5].handle);

                case Vip72Handle.Vip72Window.AllProxies:
                    return(childWindowItems[4].handle);

                case Vip72Handle.Vip72Window.MyProxiesListView:
                    if (Vip72Handle.IsButtonChecked(this.GetWindowHandle(Vip72Handle.Vip72Window.MyProxies)))
                    {
                        if (Vip72Handle.IsWindowVisible(childWindowItems[7].handle))
                        {
                            return(childWindowItems[7].handle);
                        }
                        if (Vip72Handle.IsWindowVisible(childWindowItems[8].handle))
                        {
                            return(childWindowItems[8].handle);
                        }
                    }
                    else
                    {
                        if (!Vip72Handle.IsWindowVisible(childWindowItems[7].handle))
                        {
                            return(childWindowItems[7].handle);
                        }
                        if (!Vip72Handle.IsWindowVisible(childWindowItems[8].handle))
                        {
                            return(childWindowItems[8].handle);
                        }
                    }
                    break;

                case Vip72Handle.Vip72Window.AllProxiesListView:
                    if (Vip72Handle.IsButtonChecked(this.GetWindowHandle(Vip72Handle.Vip72Window.AllProxies)))
                    {
                        if (Vip72Handle.IsWindowVisible(childWindowItems[7].handle))
                        {
                            return(childWindowItems[7].handle);
                        }
                        if (Vip72Handle.IsWindowVisible(childWindowItems[8].handle))
                        {
                            return(childWindowItems[8].handle);
                        }
                        break;
                    }
                    if (!Vip72Handle.IsWindowVisible(childWindowItems[7].handle))
                    {
                        return(childWindowItems[7].handle);
                    }
                    if (!Vip72Handle.IsWindowVisible(childWindowItems[8].handle))
                    {
                        return(childWindowItems[8].handle);
                    }
                    break;

                case Vip72Handle.Vip72Window.CurrentSock:
                    return(childWindowItems[41].handle);
                }
            }
            return(new IntPtr(-1));
        }