コード例 #1
0
 void HandleDeleteTeamClicked(object sender, EventArgs e)
 {
     if (loadedTeam != null)
     {
         if (loadedTeam.Static)
         {
             string msg = Catalog.GetString("System teams can't be deleted");
             MessagesHelpers.WarningMessage(this, msg);
             return;
         }
         else
         {
             string msg = Catalog.GetString("Do you really want to delete the template: ") + loadedTeam.Name;
             if (MessagesHelpers.QuestionMessage(this, msg, null))
             {
                 provider.Delete(loadedTeam.Name);
                 teams.Remove(ref selectedIter);
                 templatesNames.Remove(loadedTeam.Name);
                 selectedIter = TreeIter.Zero;
                 teamseditortreeview.Selection.SelectPath(new TreePath("0"));
                 HandleSelectionChanged(null, null);
             }
         }
     }
 }
コード例 #2
0
        public void TestCopyOverwrite()
        {
            TemplatesService ts = new TemplatesService(storage);

            ts.Start();
            ITeamTemplatesProvider teamtemplateprovider = ts.TeamTemplateProvider;
            LMTeam teamB = LMTeam.DefaultTemplate(5);

            teamB.Name          = "B";
            teamB.TeamName      = "Template B";
            teamB.FormationStr  = "1-4";
            teamB.List [0].Name = "Paco";
            teamtemplateprovider.Save(teamB);
            LMTeam teamA = new LMTeam();

            teamA.Name         = "A";
            teamA.TeamName     = "Template A";
            teamA.FormationStr = "1-4-3-3";
            teamtemplateprovider.Save(teamA);

            LMTeam auxdelete = teamA;

            teamtemplateprovider.Copy(teamB, "A");
            teamtemplateprovider.Delete(auxdelete);
            teamA = teamtemplateprovider.Templates [0] as LMTeam;

            Assert.AreEqual(4, teamtemplateprovider.Templates.Count);
            Assert.AreEqual("A", teamA.Name);
            Assert.AreEqual("Template B", teamA.TeamName);
            Assert.AreEqual(teamB.List.Count, teamA.List.Count);
            Assert.AreEqual("1-4", teamA.FormationStr);
            Assert.AreEqual("Paco", teamA.List [0].Name);
        }