public TimerForm() { InitializeComponent(); if (Thread.CurrentThread.CurrentUICulture.Equals(CultureInfo.GetCultureInfo("pl-PL"))) { polishToolStripMenuItem.Checked = true; } else { englishToolStripMenuItem.Checked = true; } _tournamentTimer = new TournamentTimer((int)numberOfRoundsUpDown.Value, minutesPerRoundUpDown.Value, (int)breakTimeUpDown.Value, 90); _tournamentTimer.Ticked += UpdateTime; _tournamentTimer.SettingsChanged += UpdateTime; _tournamentTimer.OnFinished += OnFinished; _tournamentTimer.FileUpdateRequired += WriteTournamentTimer; CreateDirectoryAndUnZip(); customCSSLabel.Text = Settings.Read(Settings.SettingsCustomCssFileRegister) ?? Resources.TimerForm_TimerForm_None_selected; _customCss = Settings.Read(Settings.SettingsCustomCssStringRegister); var serializationTimer = new Timer(60000); serializationTimer.Elapsed += WriteTournamentTimer; serializationTimer.Start(); WriteTournamentTimer(this, EventArgs.Empty); }
public RoundsManager(TournamentTimer timer) { _tournamentTimer = timer; InitializeComponent(); _tournamentTimer.DefaultSettingsChanged += UpdateAfterDefaultSettingsChanged; numberOfRoundsUpDown.Value = _tournamentTimer.NumberOfRounds; minutesPerRoundUpDown.Value = _tournamentTimer.DefaultRoundDurationMinutes; breakDurationUpDown.Value = _tournamentTimer.DefaultBreakDurationSeconds; blinkingDurationUpDown.Value = _tournamentTimer.DefaultBlinkingDuration; roundOvertimeCheckBox.Checked = _tournamentTimer.DefaultOvertimeAfterRound; timerNameTextBox.Text = _tournamentTimer.DefaultTimerName; breakTextTextBox.Text = _tournamentTimer.DefaultBreakText; UpdateRounds(); }
/// <summary> /// Provides notifications of approaching events and starts them /// </summary> protected override void OnTick() { if (!m_EventsEnabled || AutoRestart.Restarting) { Stop(); } // Checks the next scheduled tournament and gives out notifications for the tournament if (XMLDates.Events.ContainsKey("tournament")) { if (XMLDates.Events["tournament"].Count > 0 && ArenaControl.Arenas.Count > 0) { t = (Tournament)XMLDates.Events["tournament"][0]; TimeSpan date = t.Date - DateTime.Now; // Give 15 minute warning for the tournament if (date.Days == 0 && date.Hours == 0 && date.Minutes == 15 && date.Seconds < 10) { World.Broadcast(0, false, String.Format("The {0} tournament will commence in approximately 15 minutes.", t.TeamSize)); World.Broadcast(0, false, "If you have not registered, please do so at this time with [tournaments"); } // Give 5 minute warning for the tournament else if (date.Days == 0 && date.Hours == 0 && date.Minutes == 5 && date.Seconds < 10) { World.Broadcast(0, false, String.Format("The {0} tournament will commence in approximately 5 minutes.", t.TeamSize)); World.Broadcast(0, false, "If you have registered, please make your way to a safe location."); } // Give 2 minute warning for the tournament else if (date.Days == 0 && date.Hours == 0 && date.Minutes == 2 && date.Seconds < 10) { World.Broadcast(0, false, String.Format("Two minute warning for the {0} tournament.", t.TeamSize)); } // Begin the tournament else if (date.Days == 0 && date.Hours == 0 && date.Minutes == 0 && date.Seconds < 10) { World.Broadcast(0, false, String.Format("The {0} tournament will begin shortly.", t.TeamSize)); TournamentTimer timer = new TournamentTimer(t); timer.Prepare(); XMLDates.RemoveTournament(t); } } } }
public void SetTimer(TournamentTimer t) { timer = t; t.Changed += TimeChanged; }