Exemple #1
0
        /// <summary>
        /// Creates <see cref="HudElementViewModel"/> based on the specific <see cref="HudElementViewModelCreationInfo"/>
        /// </summary>
        /// <param name="creationInfo">Creation Info</param>
        /// <returns><see cref="HudElementViewModel"/></returns>
        public HudElementViewModel Create(HudElementViewModelCreationInfo creationInfo)
        {
            Check.ArgumentNotNull(() => creationInfo);
            Check.Require(creationInfo.HudLayoutInfo != null, "HudLayoutInfo must be set.");

            var layoutTools = GetHudLayoutTools(creationInfo);

            var hudElementViewModel = new HudElementViewModel(layoutTools)
            {
                Seat    = creationInfo.SeatNumber,
                Opacity = creationInfo.HudLayoutInfo.Opacity
            };

            try
            {
                hudElementViewModel.Tools.ForEach(x =>
                {
                    x.InitializePositions(creationInfo.PokerSite, creationInfo.HudLayoutInfo.TableType, creationInfo.GameType);
                    ApplyRestrictions(x, creationInfo);
                });
            }
            catch (Exception e)
            {
                LogProvider.Log.Error(this, $"Could not configure positions for seat #{creationInfo.SeatNumber} using {creationInfo.HudLayoutInfo.Name}, {(int)creationInfo.HudLayoutInfo.TableType}-max", e);
            }

            return(hudElementViewModel);
        }
Exemple #2
0
        /// <summary>
        /// Gets the array of <see cref="HudLayoutTool"/> for the specified layout
        /// </summary>
        /// <param name="creationInfo"><see cref="HudElementViewModelCreationInfo"/> to get the array of <see cref="HudLayoutTool"/></param>
        private IEnumerable <HudLayoutTool> GetHudLayoutTools(HudElementViewModelCreationInfo creationInfo)
        {
            var layoutTools = creationInfo.HudLayoutInfo.LayoutTools.Select(x => x.Clone()).ToArray();

            if (creationInfo.PokerSite == EnumPokerSites.PokerStars)
            {
                layoutTools = layoutTools.Where(x => !PSDeniedTools.Contains(x.ToolType)).ToArray();
            }

            return(layoutTools);
        }
Exemple #3
0
        /// <summary>
        /// Applies restrictions to the specified <see cref="HudBaseToolViewModel"/> for the specified <see cref="HudElementViewModelCreationInfo"/>
        /// </summary>
        /// <param name="toolViewModel"></param>
        /// <param name="creationInfo"></param>
        private void ApplyRestrictions(HudBaseToolViewModel toolViewModel, HudElementViewModelCreationInfo creationInfo)
        {
            if (creationInfo == null || creationInfo.PokerSite != EnumPokerSites.PokerStars)
            {
                return;
            }

            if (toolViewModel is HudGaugeIndicatorViewModel)
            {
                (toolViewModel as HudGaugeIndicatorViewModel).IsGraphIndicatorsDisabled = true;
            }
        }