예제 #1
0
        /// <summary>
        /// Starts the borderTimer
        /// </summary>
        /// <param name="color"></param>
        public void ShowBorder(Color color)
        {
            BorderForm bf;

            if (borderForm == null || borderForm.Width != Width)
            {
                Bitmap b = TableFactory.GetBorderBitmap(color, site, Width, Height);
                bf         = TableFactory.MakeBorderForm(Width, Height, b, color);
                bf.TopMost = true;
                borderForm = bf;
            }
            else
            {
                bf = borderForm;
            }

            Rectangle rect = new Rectangle();

            Win32.GetWindowRect(handle, ref rect);
            Win32.SetWindowPos((int)bf.Handle, 0, rect.Left, rect.Top, 0, 0, 0x201);
            bf.Show();

            if (Settings.FlashTable)
            {
                bf.Flash();
            }
            else
            {
                bf.NoFlash();
            }
        }
예제 #2
0
        /// <summary>
        /// Retrieves the found windows and saves them in pokerWindows arraylist
        /// </summary>
        /// <param name="hwnd"></param>
        /// <param name="lParam"></param>
        /// <returns></returns>
        private bool EnumWindowCallBack(int hwnd, int lParam)
        {
            int windowHandle = hwnd;

            StringBuilder sbc = new StringBuilder(256);

            Win32.GetClassName(hwnd, sbc, sbc.Capacity);

            string wndClass = sbc.ToString();

            // Ugly Party & Stars check
            if (wndClass != "#32770" && !wndClass.StartsWith("Afx:400000:b:") && wndClass != "FTC_TableViewFull")
            {
                return(true);
            }

            StringBuilder sb = new StringBuilder(512);

            Win32.GetWindowText(windowHandle, sb, sb.Capacity);

            string wndTitle = sb.ToString();

            // Is this a poker table?
            if (!pokerTables.ContainsKey(hwnd))
            {
                if (TableFactory.IsPokerTable(wndClass, wndTitle, hwnd))
                {
                    // Create the table object
                    PokerTable table = TableFactory.MakePokerTable(hwnd);

                    // Set the identification color
                    table.IdentificationColor = getVacantTableIDColor();

                    // Set event handlers
                    table.Closed                 += new TableFactory.ClosedEventHandler(tableClosed);
                    table.RequiresAction         += new TableFactory.RequiresActionEventHandler(tableRequiresAction);
                    table.NoLongerRequiresAction += new TableFactory.NoLongerRequiresActionEventHandler(tableNoLongerRequiresAction);
                    table.SittingOut             += new TableFactory.SittingOutEventHandler(tableSittingOut);

                    // Add the table to the pokerTables table
                    pokerTables.Add(hwnd, table);

                    // Update table list
                    updateTables();
                }
                else
                {
                    // Look for lobby
                    if (wndTitle.StartsWith("PartyPoker.com: Poker Lobby") && !pokerLobbies.ContainsKey(hwnd))
                    {
                        pokerLobbies.Add(hwnd, new PartyLobby(hwnd));
                    }
                }
            }

            return(true);
        }
예제 #3
0
        /// <summary>
        /// Returns the aspect ratio based upon
        /// </summary>
        /// <param name="width"></param>
        /// <param name="currentPokerSite"></param>
        /// <returns></returns>
        public static double GetAspectRatio(int width, TableFactory.Site currentPokerSite)
        {
            switch (currentPokerSite)
            {
                case TableFactory.Site.Party:
                    return (double)PartyTable.SpecialMaxTableSize.Height / (double)PartyTable.SpecialMaxTableSize.Width;
                case TableFactory.Site.Stars:
                    // Calculate the ratio difference
                    double minRatio = (double)StarsTable.SpecialMaxTableSize.Height / (double)StarsTable.SpecialMaxTableSize.Width;
                    double maxRatio = (double)StarsTable.SpecialMinTableSize.Height / (double)StarsTable.SpecialMinTableSize.Width;
                    double ratioDiff = maxRatio - minRatio;

                    // Calculate the
                    double sizeDiff = (double)StarsTable.SpecialMaxTableSize.Width - (double)StarsTable.SpecialMinTableSize.Width;
                    double curSizeDiff = (double)StarsTable.SpecialMaxTableSize.Width - (double)width;
                    double diffRatio = curSizeDiff / sizeDiff;

                    return minRatio + diffRatio * ratioDiff;
            }

            return 0;
        }