Ejemplo n.º 1
0
        private int GetPositonId(string name)
        {
            string code = string.Join(string.Empty, name.Split(' ', '-').ToList().Select(s => s[0]));

            if (code == "K" && name == "Keeper")
            {
                code = "GK";
            }
            PlayerPositionEntity ent = _context.PlayerPositions.FirstOrDefault(p => p.Code == code);

            if (ent == null)
            {
                ent = new PlayerPositionEntity()
                {
                    Name = name,
                    Code = code
                };
                _context.PlayerPositions.Add(ent);
                _context.SaveChanges();
            }
            return(ent.PlayerPositionId);
        }
Ejemplo n.º 2
0
		public void RefreshPlayerPosition(PlayerPositionEntity entity)
        {
            // When setting .StringValue, use a autorelease pool to keep the warnings away
            // http://mono.1490590.n4.nabble.com/Memory-Leak-td3206211.html
            using (NSAutoreleasePool pool = new NSAutoreleasePool())
            {
                // TODO: Bug CPU hit when updating label...
                lblPosition.StringValue = entity.Position;
                sliderPosition.SetPosition(entity.PositionPercentage * 100);
            };
		}