Esempio n. 1
0
        public void ViewModelFactoryBaseService_CreateTimerButtonVM()
        {
            var model = new TimerButton();
            var vm    = factoryService.CreateViewModel <DashboardButtonVM, DashboardButton> (model);

            Assert.IsTrue(vm is TimerButtonVM);
        }
Esempio n. 2
0
        void DeclineExtraTime(NetMessage msg)
        {
            // Update player timers
            if (!IsDecider)
            {
                TimerElement timer = GetScreenElement <TimerElement> ("timer");
                timer.Text = GetButton(IsNextPitcher ? "pitching" : "listening");
                timer.Type = IsNextPitcher ? TimerType.Pitch : TimerType.Listen;
                timer.Reset();
                return;
            }

            // Decider logic
            state = State.Pitch;
            Game.Controller.NextPitch();
            if (CurrentPitcher != "")
            {
                AllGotoView("pitch");
                SetDeciderInstructionsText("next_up");
                TimerButton.Reset(Duration);
            }
            else
            {
                AllGotoView("deliberate_instructions");
            }
        }
Esempio n. 3
0
        private void TxtCodigoEmpleado_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                Factory  data     = new Factory();
                Empleado empleado = data.GetEmpleadoByCode(TxtCodigoEmpleado.Text);

                if (empleado != null)
                {
                    TxtCodigoEmpleado.Enabled = false;
                    LblHoraRegistrada.Text    = "Hora: " + DateTime.Now.ToString("hh:mm:ss tt");
                    TimerButton.Start();

                    TxtEmpleadoId.Text = empleado.Id.ToString();
                    LblNombres.Text    = empleado.Nombre1 + ((" " + empleado.Nombre2) ?? "") + ((" " + empleado.Nombre3) ?? "");
                    LblApellidos.Text  = empleado.Apellido1 + ((" " + empleado.Apellido2) ?? "") + ((" " + empleado.Apellido3) ?? "");
                    LblCargo.Text      = (empleado.Cargo ?? "");
                    BtnRegistrar.Focus();
                    PanelEmpleado.Visible = true;
                }
                else
                {
                    TxtCodigoEmpleado.Text = "";
                }
            }
        }
Esempio n. 4
0
        protected override void OnInitDeciderElements()
        {
            Game.Dispatcher.AddListener("AcceptExtraTime", AcceptExtraTime);
            state = State.Pitch;

            Elements.Add("timer_button", new TimerButtonElement(GetButton("timer_button_decider"), Duration, () => {
                Game.Audio.Play("timer_start");
                Game.Dispatcher.ScheduleMessage(
                    "StartTimer",
                    CurrentPitcher,
                    state == State.Pitch ? "pitch" : "extra"
                    );
                Elements["skip"].Active = false;
                droppedClient           = false;
                SetDeciderInstructionsText("listen");
            }));

            // The skip button is only shown if a client was dropped (so that players don't need to wait for the timer to run down again)
            Elements.Add("skip", new ButtonElement(GetButton("skip"), () => {
                TimerButton.Skip();
                droppedClient = false;
                Game.Dispatcher.ScheduleMessage("TimerSkip");
                Elements["skip"].Active = false;
            })
            {
                Active = droppedClient
            });
        }
Esempio n. 5
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);
        }
Esempio n. 6
0
 void AcceptExtraTime(NetMessage msg)
 {
     AllGotoView("pitch");
     state = State.Extra;
     TimerButton.Reset(ExtraTimeDuration);
     TimerButton.StartTimer();
 }
Esempio n. 7
0
        public void TestIsChanged()
        {
            var tib = new TimerButton();

            Assert.IsTrue(tib.IsChanged);
            tib.IsChanged = false;
            tib.Timer     = new LMTimer();
            Assert.IsTrue(tib.IsChanged);
            tib.IsChanged = false;
        }
Esempio n. 8
0
 private void FrmInfoEmpleado_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Escape)
     {
         PanelEmpleado.Visible     = false;
         TxtCodigoEmpleado.Enabled = true;
         TimerButton.Stop();
         TxtCodigoEmpleado.Focus();
     }
 }
Esempio n. 9
0
 public void EmitTimeNodeStoppedEvent(TimeNode node, TimerButton btn, List <DashboardButton> from)
 {
     if (TimeNodeStoppedEvent != null)
     {
         if (from == null)
         {
             from = new List <DashboardButton> ();
         }
         TimeNodeStoppedEvent(node, btn, from);
     }
 }
Esempio n. 10
0
            public void InsertTimer()
            {
                var timerButton = new TimerButton {
                    Timer = new Timer {
                        Name = "Ball playing"
                    },
                    Position = new Point(10 + (10 + CAT_WIDTH) * 6, 10)
                };

                List.Add(timerButton);
            }
Esempio n. 11
0
        public void TestTimerButton()
        {
            TimerButton tm = new TimerButton();

            Assert.IsNull(tm.Name);
            tm.Timer = new LMTimer {
                Name = "test"
            };
            Assert.AreEqual(tm.Name, "test");
            tm.Name = "test2";
            Assert.AreEqual(tm.Timer.Name, "test2");
        }
Esempio n. 12
0
        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);
        }
Esempio n. 13
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);
        }
Esempio n. 14
0
 private void TimerMsg_Tick(object sender, EventArgs e)
 {
     if (msg != null)
     {
         TimerButton.Stop();
         msg.Close();
         msg = null;
         PanelEmpleado.Visible     = false;
         TxtCodigoEmpleado.Enabled = true;
         TxtCodigoEmpleado.Text    = "";
         TxtCodigoEmpleado.Focus();
         TimerMsg.Interval = 500;
     }
     else
     {
         TxtCodigoEmpleado.Focus();
         TimerMsg.Stop();
     }
 }
Esempio n. 15
0
 public TimerObject(TimerButton timer) : base(timer)
 {
     Button      = timer;
     Toggle      = true;
     CurrentTime = new Time(0);
     if (iconImage == null)
     {
         iconImage = new Image(Path.Combine(Config.ImagesDir,
                                            StyleConf.ButtonTimerIcon));
     }
     if (cancelImage == null)
     {
         cancelImage = new Image(Path.Combine(Config.IconsDir,
                                              StyleConf.CancelButton));
     }
     MinWidth   = StyleConf.ButtonMinWidth;
     MinHeight  = iconImage.Height + StyleConf.ButtonTimerFontSize;
     cancelRect = new Rectangle();
 }
Esempio n. 16
0
        void ReleaseDesignerOutlets()
        {
            if (TimeEntryField != null)
            {
                TimeEntryField.Dispose();
                TimeEntryField = null;
            }

            if (TimerButton != null)
            {
                TimerButton.Dispose();
                TimerButton = null;
            }

            if (TimerLabel != null)
            {
                TimerLabel.Dispose();
                TimerLabel = null;
            }
        }
Esempio n. 17
0
            //dummy class for abstract validation. Copied from LongoMatch and adapted to VAS.
            public static DashboardDummy Default()
            {
                var         dashboard = new DashboardDummy();
                TagButton   tagbutton;
                TimerButton timerButton;

                // Create 10 buttons
                dashboard.FillDefaultTemplate(10);
                // And create an extra one without tags
                dashboard.FillDefaultTemplate(1);
                ((AnalysisEventButton)dashboard.List.Last()).AnalysisEventType.Tags.Clear();
                dashboard.GamePeriods = new RangeObservableCollection <string> {
                    "1", "2"
                };

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

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

                timerButton = new TimerButton {
                    Timer = new Timer {
                        Name = Catalog.GetString("Ball playing")
                    },
                    Position = new Point(10 + (10 + CAT_WIDTH) * 6, 10)
                };
                dashboard.List.Add(timerButton);
                return(dashboard);
            }
Esempio n. 18
0
 private void UseTimer(TimerButton timer)
 {
     timer.Use();
 }
Esempio n. 19
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);
        }
Esempio n. 20
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);
        }
Esempio n. 21
0
 public void OnTimerPress(TimerButton timer)
 {
     Events.instance.Raise(new ButtonPressEvent(timer.Element));
 }
Esempio n. 22
0
 void HandleTimeNodeStoppedEvent(TimeNode tn, TimerButton btn, List <DashboardButton> from)
 {
     timeline.AddTimerNode(btn.Timer, tn);
 }