Exemple #1
0
        protected override DashboardButton CreateButton(string buttonType)
        {
            DashboardButton button = null;

            if (buttonType == "Card")
            {
                button = new PenaltyCardButton {
                    PenaltyCard = new PenaltyCard("Red", Color.Red, CardShape.Rectangle)
                };
            }
            else if (buttonType == "Score")
            {
                button = new ScoreButton {
                    Score = new Score("Score", 1)
                };
            }
            else if (buttonType == "Timer")
            {
                button = new TimerButton {
                    Timer = new LMTimer {
                        Name = "Timer"
                    }
                };
            }
            else
            {
                button = base.CreateButton(buttonType);
            }
            return(button);
        }
        public void ViewModelFactoryService_CreatePenaltyCardButtonVM()
        {
            var model = new PenaltyCardButton();
            var vm    = factoryService.CreateViewModel <DashboardButtonVM, DashboardButton> (model);

            Assert.IsTrue(vm is PenaltyCardButtonVM);
        }
        public void TestPenaltyCardButton()
        {
            PenaltyCardButton pb = new PenaltyCardButton();

            Assert.IsNull(pb.BackgroundColor);
            Assert.IsNull(pb.Name);
            pb.PenaltyCard = new PenaltyCard("test", Color.Red, CardShape.Circle);
            Assert.AreEqual(pb.Name, "test");
            Assert.AreEqual(pb.BackgroundColor, Color.Red);
            Assert.AreEqual(pb.PenaltyCardEventType, pb.EventType);
        }
Exemple #4
0
        public void TestSerialization()
        {
            DashboardButton db = new DashboardButton();

            Utils.CheckSerialization(db);
            db = new PenaltyCardButton();
            Utils.CheckSerialization(db);
            db = new PenaltyCardButton();
            Utils.CheckSerialization(db);
            db = new ScoreButton();
            Utils.CheckSerialization(db);
        }
Exemple #5
0
        public void AddButton(string buttontype)
        {
            DashboardButton button = null;

            if (buttontype == "Card")
            {
                button = new PenaltyCardButton {
                    PenaltyCard = new PenaltyCard("Red", Color.Red, CardShape.Rectangle)
                };
            }
            else if (buttontype == "Score")
            {
                button = new ScoreButton {
                    Score = new Score("Score", 1)
                };
            }
            else if (buttontype == "Timer")
            {
                button = new TimerButton {
                    Timer = new Timer {
                        Name = "Timer"
                    }
                };
            }
            else if (buttontype == "Tag")
            {
                button = new TagButton {
                    Tag = new Tag("Tag", "")
                };
            }
            else if (buttontype == "Category")
            {
                button = template.AddDefaultItem(template.List.Count);
            }
            else
            {
                return;
            }

            if (buttontype != "Category")
            {
                template.List.Add(button);
            }
            button.Position = new Point(template.CanvasWidth, 0);
            edited          = true;
            Refresh(button);
        }
        public void TestSerialization()
        {
            DashboardButton db = new DashboardButton();

            Utils.CheckSerialization(db);
            db = new TimedDashboardButton();
            Utils.CheckSerialization(db);
            db = new TagButton();
            Utils.CheckSerialization(db);
            db = new TimerButton();
            Utils.CheckSerialization(db);
            db = new EventButton();
            Utils.CheckSerialization(db);
            db = new AnalysisEventButton();
            Utils.CheckSerialization(db);
            db = new PenaltyCardButton();
            Utils.CheckSerialization(db);
            db = new PenaltyCardButton();
            Utils.CheckSerialization(db);
            db = new ScoreButton();
            Utils.CheckSerialization(db);
        }
Exemple #7
0
 public CardObject(PenaltyCardButton card) : base(card)
 {
     Button = card;
 }
Exemple #8
0
        /// <summary>
        /// Creates a new dashboard with a default set of buttons
        /// </summary>
        /// <returns>the new dashboadrd.</returns>
        /// <param name="count">Number of <see cref="AnalysisEventButton"/> to add.</param>
        public static LMDashboard DefaultTemplate(int count)
        {
            TagButton         tagbutton;
            TimerButton       timerButton;
            PenaltyCardButton cardButton;
            ScoreButton       scoreButton;
            LMDashboard       template = new LMDashboard();

            template.FillDefaultTemplate(count);
            template.GamePeriods = new ObservableCollection <string> {
                "1", "2"
            };
            template.FieldBackground     = App.Current.FieldBackground;
            template.HalfFieldBackground = App.Current.HalfFieldBackground;
            template.GoalBackground      = App.Current.GoalBackground;

            tagbutton = new TagButton {
                Tag      = new Tag(Catalog.GetString("Attack"), ""),
                Position = new Point(10, 10)
            };
            template.List.Add(tagbutton);

            tagbutton = new TagButton {
                Tag      = new Tag(Catalog.GetString("Defense"), ""),
                Position = new Point(10 + (10 + CAT_WIDTH) * 1, 10)
            };
            template.List.Add(tagbutton);

            cardButton = new PenaltyCardButton {
                PenaltyCard = new PenaltyCard(Catalog.GetString("Red card"),
                                              Color.Red, CardShape.Rectangle),
                Position = new Point(10 + (10 + CAT_WIDTH) * 2, 10)
            };
            template.List.Add(cardButton);

            cardButton = new PenaltyCardButton {
                PenaltyCard = new PenaltyCard(Catalog.GetString("Yellow card"),
                                              Color.Yellow, CardShape.Rectangle),
                Position = new Point(10 + (10 + CAT_WIDTH) * 3, 10)
            };
            template.List.Add(cardButton);

            scoreButton = new ScoreButton {
                Position        = new Point(10 + (10 + CAT_WIDTH) * 4, 10),
                BackgroundColor = Colors.ButtonScoreColor,
                Score           = new Score(Catalog.GetString("Free play goal"), 1),
            };
            template.List.Add(scoreButton);

            scoreButton = new ScoreButton {
                BackgroundColor = Colors.ButtonScoreColor,
                Position        = new Point(10 + (10 + CAT_WIDTH) * 5, 10),
                Score           = new Score(Catalog.GetString("Penalty goal"), 1),
            };
            template.List.Add(scoreButton);

            timerButton = new TimerButton {
                Timer = new LMTimer {
                    Name = Catalog.GetString("Ball playing")
                },
                Position = new Point(10 + (10 + CAT_WIDTH) * 6, 10)
            };
            template.List.Add(timerButton);
            template.Preview = App.Current.PreviewService.CreatePreview(template);
            return(template);
        }
Exemple #9
0
        /// <summary>
        /// Creates a new dashboard with a default set of buttons
        /// </summary>
        /// <returns>the new dashboadrd.</returns>
        /// <param name="count">Number of <see cref="AnalysisEventButton"/> to add.</param>
        public static Dashboard DefaultTemplate(int count)
        {
            TagButton         tagbutton;
            TimerButton       timerButton;
            PenaltyCardButton cardButton;
            ScoreButton       scoreButton;
            List <string>     periods  = new List <string> ();
            Dashboard         template = new Dashboard();

            template.FillDefaultTemplate(count);

            periods.Add("1");
            periods.Add("2");
            template.GamePeriods = periods;

            tagbutton = new TagButton {
                Tag      = new Tag(Catalog.GetString("Attack"), ""),
                Position = new Point(10, 10)
            };
            template.List.Add(tagbutton);

            tagbutton = new TagButton {
                Tag      = new Tag(Catalog.GetString("Defense"), ""),
                Position = new Point(10 + (10 + CAT_WIDTH) * 1, 10)
            };
            template.List.Add(tagbutton);

            cardButton = new PenaltyCardButton {
                PenaltyCard = new PenaltyCard(Catalog.GetString("Red card"),
                                              Color.Red, CardShape.Rectangle),
                Position = new Point(10 + (10 + CAT_WIDTH) * 2, 10)
            };
            template.List.Add(cardButton);

            cardButton = new PenaltyCardButton {
                PenaltyCard = new PenaltyCard(Catalog.GetString("Yellow card"),
                                              Color.Yellow, CardShape.Rectangle),
                Position = new Point(10 + (10 + CAT_WIDTH) * 3, 10)
            };
            template.List.Add(cardButton);

            scoreButton = new ScoreButton {
                Score = new Score {
                    Name   = Catalog.GetString("Free play goal"),
                    Points = 1,
                    Color  = StyleConf.ButtonScoreColor
                },
                Position = new Point(10 + (10 + CAT_WIDTH) * 4, 10)
            };
            template.List.Add(scoreButton);

            scoreButton = new ScoreButton {
                Score = new Score {
                    Name   = Catalog.GetString("Penalty goal"),
                    Points = 1,
                    Color  = StyleConf.ButtonScoreColor
                },
                Position = new Point(10 + (10 + CAT_WIDTH) * 5, 10)
            };
            template.List.Add(scoreButton);

            timerButton = new TimerButton {
                Timer = new Timer {
                    Name = Catalog.GetString("Ball playing")
                },
                Position = new Point(10 + (10 + CAT_WIDTH) * 6, 10)
            };
            template.List.Add(timerButton);
            return(template);
        }