private void Init(string name, string time, int multiplier, bool autoRestart, bool trayFlash, Form_Main.TraybarContainer container) { this.Stop(); this.TimerComponent = this.timer1; this.container = container; this.TimerName = name; this.label_name.Text = TimerName; this.Multiplier = multiplier; this.AutoRestart = autoRestart; this.TraybarFlash = trayFlash; this.CurrentTime = 0; TimeSpan ts = new TimeSpan(int.Parse(time.Split(':')[0]), int.Parse(time.Split(':')[1]), int.Parse(time.Split(':')[2]) ); this.TargetTimeBase = (int)ts.TotalSeconds; this.TargetTime = this.TargetTimeBase; if (this.Multiplier > 1) { this.TargetTime *= this.Multiplier; } this.targetTimeString = SecondsToTime(this.TargetTime); if (this.Multiplier > 1) { this.targetTimeString += " (" + SecondsToTime(this.TargetTimeBase) + " x" + this.Multiplier + ")"; } UpdateTime(); progressBar1.Maximum = TargetTime; this.Start(); }
private Form_Main.TraybarContainer container; // Lazy solution lol public Control_Timer(string name, string time, int multiplier, bool autoRestart, bool trayFlash, Form_Main.TraybarContainer container) { InitializeComponent(); deleteButton = removeToolStripMenuItem; Init(name, time, multiplier, autoRestart, trayFlash, container); }