Exemple #1
0
        private void cmbSite_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (cmbSite.SelectedItem.ToString())
            {
            case "":
                FormBorderStyle  = FormBorderStyle.FixedDialog;
                currentPokerSite = TableFactory.Site.Invalid;
                break;

            case "Party Poker":
                FormBorderStyle  = FormBorderStyle.Sizable;
                MinimumSize      = PartyTable.SpecialMinTableSize;
                MaximumSize      = PartyTable.SpecialMaxTableSize;
                currentPokerSite = TableFactory.Site.Party;
                Settings.LastUsedPokerSiteEditQuadrant = "Party";
                break;

            case "PokerStars":
                FormBorderStyle  = FormBorderStyle.Sizable;
                MinimumSize      = StarsTable.SpecialMinTableSize;
                MaximumSize      = StarsTable.SpecialMaxTableSize;
                currentPokerSite = TableFactory.Site.Stars;
                Settings.LastUsedPokerSiteEditQuadrant = "Stars";
                break;

            case "FTP":
                FormBorderStyle  = FormBorderStyle.FixedDialog;
                currentPokerSite = TableFactory.Site.FTP;
                MinimumSize      = FTPTable.SpecialMinTableSize;
                MaximumSize      = FTPTable.SpecialMaxTableSize;
                Settings.LastUsedPokerSiteEditQuadrant = "FTP";
                break;
            }

            if (Width > MaximumSize.Width)
            {
                Width = MaximumSize.Width;
            }
            else if (Width < MinimumSize.Width)
            {
                Width = MinimumSize.Width;
            }

            Height = Convert.ToInt32((double)Width * PokerTable.GetAspectRatio(Width, currentPokerSite));

            EditQuadrant_ResizeEnd(sender, e);
        }
        /// <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);
        }
        private void cmbSite_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (cmbSite.SelectedItem.ToString())
            {
                case "":
                    FormBorderStyle = FormBorderStyle.FixedDialog;
                    currentPokerSite = TableFactory.Site.Invalid;
                    break;
                case "Party Poker":
                    FormBorderStyle = FormBorderStyle.Sizable;
                    MinimumSize = PartyTable.SpecialMinTableSize;
                    MaximumSize = PartyTable.SpecialMaxTableSize;
                    currentPokerSite = TableFactory.Site.Party;
                    Settings.LastUsedPokerSiteEditQuadrant = "Party";
                    break;
                case "PokerStars":
                    FormBorderStyle = FormBorderStyle.Sizable;
                    MinimumSize = StarsTable.SpecialMinTableSize;
                    MaximumSize = StarsTable.SpecialMaxTableSize;
                    currentPokerSite = TableFactory.Site.Stars;
                    Settings.LastUsedPokerSiteEditQuadrant = "Stars";
                    break;
                case "FTP":
                    FormBorderStyle = FormBorderStyle.FixedDialog;
                    currentPokerSite = TableFactory.Site.FTP;
                    MinimumSize = FTPTable.SpecialMinTableSize;
                    MaximumSize = FTPTable.SpecialMaxTableSize;
                    Settings.LastUsedPokerSiteEditQuadrant = "FTP";
                    break;
            }

            if (Width > MaximumSize.Width)
                Width = MaximumSize.Width;
            else if (Width < MinimumSize.Width)
                Width = MinimumSize.Width;

            Height = Convert.ToInt32((double)Width * PokerTable.GetAspectRatio(Width, currentPokerSite));

            EditQuadrant_ResizeEnd(sender, e);
        }