public ShufflerControlPanel(SiteHelpers.ShuffleMode shuffleMode)
        //================================================================================================================
        // Alternate constructor
        //================================================================================================================
        {
            // Set properties based on the mode
            ShuffleMode = shuffleMode;
            if (shuffleMode == SiteHelpers.ShuffleMode.Comparison)
            {
                MinShuffles  = MIN_SHUFFLES_COMPARE;
                MaxShuffles  = MAX_SHUFFLES_COMPARE;
                ShuffleCount = MIN_SHUFFLES_COMPARE;
            }
            else
            {
                MinShuffles  = MIN_SHUFFLES_STANDARD;
                MaxShuffles  = MAX_SHUFFLES_STANDARD;
                ShuffleCount = MIN_SHUFFLES_STANDARD;
            }

            ShufflerWarning = string.Format(SiteHelpers.ShufflerWarning, MinShuffles, MaxShuffles);
            ShuffleType     = SiteHelpers.ShuffleTypes.FisherYates;
            SampleSize      = SiteHelpers.SampleSizes.FourCardSample;

            // Create the playing cards list
            CardPacks = new HashSet <CardPack>();
        }
        //================================================================================================================
        //================================================================================================================
        #endregion  // Properties

        #region Constructors
        //================================================================================================================
        //================================================================================================================

        public ShufflerControlPanel()
        //================================================================================================================
        // Default constructor
        //================================================================================================================
        {
            // Set defaults
            MinShuffles     = MIN_SHUFFLES_STANDARD;
            MaxShuffles     = MAX_SHUFFLES_STANDARD;
            ShuffleCount    = MIN_SHUFFLES_STANDARD;
            ShufflerWarning = string.Format(SiteHelpers.ShufflerWarning, MinShuffles, MaxShuffles);
            ShuffleMode     = SiteHelpers.ShuffleMode.Standard;
            ShuffleType     = SiteHelpers.ShuffleTypes.FisherYates;
            SampleSize      = SiteHelpers.SampleSizes.FourCardSample;

            // Create the playing cards list
            CardPacks = new HashSet <CardPack>();
        }
Ejemplo n.º 3
0
        //================================================================================================================
        //================================================================================================================
        #endregion  // Randomness

        #region Shuffler Control Panel
        //================================================================================================================
        //================================================================================================================

        public ActionResult ShufflerControlPanel_Reset()
        //================================================================================================================
        // This action is invoked when the shuffler control panel is being reset.
        //
        // Event Arguments
        //      arg_ShufflerMode: Operation mode for the shuffler
        //
        // Returns
        //      The shuffler control panel view
        //================================================================================================================
        {
            // Retrieve the operation mode for the shuffler
            SiteHelpers.ShuffleMode shuffleMode = (SiteHelpers.ShuffleMode)(!string.IsNullOrEmpty(Request.Params[ARG_SHUFFLE_MODE]) ? int.Parse(Request.Params[ARG_SHUFFLE_MODE]) : 1);

            // Create the model
            ShufflerControlPanel model = new ShufflerControlPanel(shuffleMode);

            // Load it with card packs
            SSCasino_DBContext dbCasino = null;

            try
            {
                // Connect the the database
                // Load it with all the card packs
                dbCasino = new SSCasino_DBContext();
                LoadShufflerCards(dbCasino, model, 0);
            }
            finally
            {
                if (dbCasino != null)
                {
                    dbCasino.Dispose();
                }
            }

            return(PartialView("_Shuffler_ControlPanelCBP", model));
        }