void HandleShowMenuEvent(List <LMPlayer> players)
        {
            Menu     menu = new Menu();
            MenuItem item;

            if (players.Count > 0)
            {
                item            = new MenuItem("Remove for this match");
                item.Activated += (sender, e) => {
                    //FIXME: this logic should be handled in a Controller (NewProjectController?)
                    // When this View is Ported fully to MVVM
                    hometemplate.RemovePlayers(players, false);
                    awaytemplate.RemovePlayers(players, false);
                    App.Current.EventsBroker.Publish(new UpdateLineup());
                };
            }
            else
            {
                item            = new MenuItem("Reset players");
                item.Activated += (sender, e) => {
                    //FIXME: this logic should be handled in a Controller (NewProjectController?)
                    // When this View is Ported fully to MVVM
                    hometemplate.ResetPlayers();
                    awaytemplate.ResetPlayers();
                    App.Current.EventsBroker.Publish(new UpdateLineup());
                };
            }
            menu.Add(item);
            menu.ShowAll();
            menu.Popup();
        }
Exemple #2
0
        public void TestResetPlayers()
        {
            LMTeam t = LMTeam.DefaultTemplate(10);

            for (int i = 0; i < 5; i++)
            {
                t.Players [0].Playing = false;
            }
            t.ResetPlayers();
            Assert.IsEmpty(t.Players.Where(p => !p.Playing));
        }