Esempio n. 1
0
        private void AddEventsToPlayerFrame(PlayerFrame pf)
        {
            pf.pnlPlayer.Click += PnlPlayer_Click;
            pf.OnLoadOk        += Pf_OnLoadOk;

            if ((pf.Parent as FlowLayoutPanel) == flpPlayerFrameControl)
            {
                if ((pf.Parent as FlowLayoutPanel) == flpPlayerFrameControl)
                {
                    foreach (var item in pf.pnlPlayer.Controls)
                    {
                        if (item is Label)
                        {
                            (item as Label).Click     += PnlPlayer_Click;
                            (item as Label).MouseDown += PnlPlayer_MouseDown;
                        }
                    }
                }
                else
                {
                    foreach (var item in pf.pnlPlayer.Controls)
                    {
                        if (item is Label)
                        {
                            (item as Label).Click += PnlPlayer_Click;
                        }
                    }
                }
            }
        }
Esempio n. 2
0
 private void SetAsFavorite()
 {
     foreach (var playerframe in chosenPlayerFrames)
     {
         if (!CheckIfMax())
         {
             if (!CheckIfAlreadyFavorite(playerframe.Player))
             {
                 playerframe.box.Show();
                 PlayerFrame pf = new PlayerFrame((playerframe.Player as Player));
                 AddEventsToPlayerFrame(pf);
                 pf.ContextMenuStrip = contextMenuRemove;
                 flpPlayerFrameControl.Controls.Add(pf);
             }
             else
             {
                 MessageBox.Show(Resources.Resources.ALREADY_FAVORITE);
             }
         }
         else
         {
             MessageBox.Show(Resources.Resources.MAX_REACHED);
         }
     }
 }
Esempio n. 3
0
        private void HighlightSelectedItem(object sender)
        {
            if (sender is Label)
            {
                chosenPanel = ((sender as Label).Parent) as Panel;
            }
            else
            {
                chosenPanel = sender as Panel;
            }

            ChosenPlayer = (chosenPanel.Parent) as PlayerFrame;

            if (Control.ModifierKeys == Keys.Control)
            {
                chosenPlayerFrames.Add(ChosenPlayer);
            }
            else
            {
                if (chosenPlayerFrames.Count > 0)
                {
                    chosenPlayerFrames.RemoveRange(0, chosenPlayerFrames.Count);
                }
                chosenPlayerFrames.Add(ChosenPlayer);
            }



            if (chosenPlayerFrames.Count > 3)
            {
                chosenPlayerFrames.RemoveAt(0);
            }

            foreach (var item in flpAllPlayers.Controls)
            {
                if (chosenPlayerFrames.Contains(item as PlayerFrame))
                {
                    (item as PlayerFrame).BackColor = Color.LightBlue;
                }
                else
                {
                    (item as PlayerFrame).BackColor = Color.Transparent;
                }
            }

            foreach (var item in flpPlayerFrameControl.Controls)
            {
                if (chosenPlayerFrames.Contains(item as PlayerFrame))
                {
                    (item as PlayerFrame).BackColor = Color.LightBlue;
                }
                else
                {
                    (item as PlayerFrame).BackColor = Color.Transparent;
                }
            }
        }
Esempio n. 4
0
        private void LoadContents()
        {
            foreach (var player in playerList)
            {
                fileRepo.LoadPlayerImages(country, player);

                LoadGoalsAndCards(player, eventList);
                PlayerFrame pf = new PlayerFrame((player as Player));
                pf.pnlPlayer.MouseDown += PnlPlayer_MouseDown;
                pf.ContextMenuStrip     = contextMenuAdd;
                AddEventsToPlayerFrame(pf);
                flpAllPlayers.Controls.Add(pf);
            }

            SetAsFavorite(fileRepo.LoadFavoritePlayers(country, playerList));
        }
Esempio n. 5
0
        private void SetAsFavorite(IList <Player> favoritePlayers)
        {
            foreach (var player in favoritePlayers)
            {
                foreach (var allFrame in flpAllPlayers.Controls)
                {
                    PlayerFrame allPlayerFrame = (allFrame as PlayerFrame);
                    if (player.ShirtNumber == allPlayerFrame.Player.ShirtNumber)
                    {
                        chosenPlayerFrames.Add(allPlayerFrame);
                    }
                }
            }

            SetAsFavorite();
        }