/// <summary>
        /// This event is fired when Amount Selected Text Box _ Leave
        /// </summary>
        private void AmountSelectedTextBox_Leave(object sender, EventArgs e)
        {
            // local
            bool showMessage = false;

            // parse the amount amountBet
            double amountBet = NumericHelper.ParseDouble(this.AmountSelectedTextBox.Text.Replace(",", "").Replace("$", ""), 0, -1);

            // set the value
            if (amountBet < 1)
            {
                // Set the value for the showMessage to true
                showMessage = true;

                // if we could not parse the number the amount goes to zero
                amountBet = 0;
            }

            // set the value
            this.AmountBet = amountBet;

            // if the value for showMessage is true
            if (showMessage)
            {
                // Show the user a message
                MessageBoxHelper.ShowMessage("You must enter only numbers.", "Invalid Input");
            }
        }
Пример #2
0
        /// <summary>
        /// This method returns the Dictionary Info
        /// </summary>
        public static DictionaryInfo GetDictionaryInfo()
        {
            // initial value
            DictionaryInfo dictionaryInfo = null;

            // open the key for Regionizer
            RegistryKey regionizerKey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Data Juggler\Regionizer");

            // if the regionizerKey exists
            if (regionizerKey != null)
            {
                // Create the dictionaryInfo object
                dictionaryInfo = new DictionaryInfo();

                // get the path to the dictionairy
                dictionaryInfo.DictionaryPath   = (string)regionizerKey.GetValue("DictionaryPath");
                dictionaryInfo.InstalledVersion = NumericHelper.ParseDouble((string)regionizerKey.GetValue("InstalledVersion"), 0, -1);

                // if UseCustomDictionary is set in the registry
                if (regionizerKey.GetValue("UseCustomDictionary") != null)
                {
                    // Set the value
                    dictionaryInfo.UseCustomDictionary = Boolean.Parse(regionizerKey.GetValue("UseCustomDictionary").ToString());
                }
                else
                {
                    // Set the value to false
                    dictionaryInfo.UseCustomDictionary = false;
                }

                // Set the value for CustomDictionaryPath
                dictionaryInfo.CustomDictionaryPath = (string)regionizerKey.GetValue("CustomDictionaryPath");

                // if TryCustomDictionaryFirst is set in the registry
                if (regionizerKey.GetValue("TryCustomDictionaryFirst") != null)
                {
                    // Set the value
                    dictionaryInfo.TryCustomDictionaryFirst = Boolean.Parse(regionizerKey.GetValue("TryCustomDictionaryFirst").ToString());
                }
                else
                {
                    // Set the value to false
                    dictionaryInfo.TryCustomDictionaryFirst = false;
                }
            }

            // return value
            return(dictionaryInfo);
        }
        /// <summary>
        /// This method returns the Dictionary Info
        /// </summary>
        private DictionaryInfo CaptureDictionaryInfo()
        {
            // initial value
            DictionaryInfo dictionaryInfo = new DictionaryInfo();

            // Set the value for DictionaryPath
            dictionaryInfo.DictionaryPath           = this.DictionaryPathControl.Text;
            dictionaryInfo.InstalledVersion         = NumericHelper.ParseDouble(this.InstalledVersionTextBox.Text, 0, -1);
            dictionaryInfo.UseCustomDictionary      = (bool)this.UseCustomDictionaryCheckBox.IsChecked;
            dictionaryInfo.CustomDictionaryPath     = this.CustomDictionaryPathControl.Text;
            dictionaryInfo.TryCustomDictionaryFirst = (bool)this.TryCustomFirstCheckBox.IsChecked;

            // return value
            return(dictionaryInfo);
        }
Пример #4
0
        /// <summary>
        /// This method returns the Player
        /// </summary>
        internal Player CapturePlayer()
        {
            // initial value
            Player player = null;

            // If the Player object exists
            if (this.HasPlayer)
            {
                // use the existing player
                player = this.Player;
            }
            else
            {
                // Create a new instance of a 'Player' object.
                player = new Player();
            }

            // is this player seated
            player.SeatNumber = (SeatNumberEnum)this.SeatNumber;

            // if there is a selected card counting system
            if (this.CountingSystemControl.HasSelectedObject)
            {
                // Set the CardCountingSystem
                player.CardCountingSystem = CardCountingSystemFactory.FindCardCountingSystem(this.CountingSystemControl.SelectedObject.ToString());
            }

            // Set the players name
            player.Name = this.NameControl.Text;

            // Get the current chips
            player.Chips = NumericHelper.ParseDouble(this.ChipsControl.Text.Replace(",", "").Replace("$", ""), 0, -1);

            // Is this a computer player
            player.IsComputerPlayer = this.IsComputerPlayerCheckBox.Checked;

            // return value
            return(player);
        }
        /// <summary>
        /// This method Check For Updated Version
        /// </summary>
        private void CheckForUpdatedVersion()
        {
            // locals
            double latestVersion = 0;
            string url           = "";

            try
            {
                // get the url for the Xml info
                url = "http://www.datajuggler.com/Regionizer/CommentDictionaryInfo.xml";

                // create an xml reader
                XmlTextReader reader = new XmlTextReader(url);

                // read the xml line per line
                while (reader.Read())
                {
                    // determine what to do by the text
                    string nodeName = reader.Name;

                    // determine the action by the nodeName
                    switch (nodeName)
                    {
                    case "LatestVersion":

                        // set the latestVersion
                        latestVersion = NumericHelper.ParseDouble(reader.ReadInnerXml(), 0, -1);

                        // required
                        break;

                    case "Url":

                        // set the latestVersion
                        url = reader.ReadInnerXml();

                        // required
                        break;
                    }
                }

                // close the reader
                reader.Close();

                // if the latestVersion is set
                if ((latestVersion > 0) && (TextHelper.Exists(url)))
                {
                    // set the content
                    this.AvailableVersionValueLabel.Content    = latestVersion.ToString();
                    this.AvailableVersionValueLabel.Visibility = System.Windows.Visibility.Visible;
                    this.CheckForUpdateButton.Visibility       = System.Windows.Visibility.Hidden;
                    this.DownloadUrl = url;

                    // enable the Download button if a newer version is available
                    UIEnable();
                }
            }
            catch (Exception error)
            {
                // for debugging only
                string err = error.ToString();
            }
        }