set interval

This commit is contained in:
Jelle Luteijn 2025-04-21 10:54:09 +02:00
parent 19db2a4fcd
commit 18f7d430e0
2 changed files with 201 additions and 200 deletions

View file

@ -28,204 +28,204 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.txtHostname = new System.Windows.Forms.TextBox(); this.txtHostname = new System.Windows.Forms.TextBox();
this.txtPassword = new System.Windows.Forms.TextBox(); this.txtPassword = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.btnConnect = new System.Windows.Forms.Button(); this.btnConnect = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.lblTime = new System.Windows.Forms.Label(); this.lblTime = new System.Windows.Forms.Label();
this.lblStatus = new System.Windows.Forms.Label(); this.lblStatus = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
this.lblRunning = new System.Windows.Forms.Label(); this.lblRunning = new System.Windows.Forms.Label();
this.cbCom = new System.Windows.Forms.ComboBox(); this.cbCom = new System.Windows.Forms.ComboBox();
this.btnClock = new System.Windows.Forms.Button(); this.btnClock = new System.Windows.Forms.Button();
this.label6 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox(); this.txtInterval = new System.Windows.Forms.TextBox();
this.tmrVlc = new System.Windows.Forms.Timer(this.components); this.tmrVlc = new System.Windows.Forms.Timer(this.components);
this.tmrClock = new System.Windows.Forms.Timer(this.components); this.tmrClock = new System.Windows.Forms.Timer(this.components);
this.SuspendLayout(); this.SuspendLayout();
// //
// label1 // label1
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.ForeColor = System.Drawing.SystemColors.Control; this.label1.ForeColor = System.Drawing.SystemColors.Control;
this.label1.Location = new System.Drawing.Point(12, 16); this.label1.Location = new System.Drawing.Point(12, 16);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(78, 13); this.label1.Size = new System.Drawing.Size(78, 13);
this.label1.TabIndex = 0; this.label1.TabIndex = 0;
this.label1.Text = "VLC Hostname"; this.label1.Text = "VLC Hostname";
// //
// txtHostname // txtHostname
// //
this.txtHostname.Location = new System.Drawing.Point(96, 13); this.txtHostname.Location = new System.Drawing.Point(96, 13);
this.txtHostname.Name = "txtHostname"; this.txtHostname.Name = "txtHostname";
this.txtHostname.Size = new System.Drawing.Size(100, 20); this.txtHostname.Size = new System.Drawing.Size(100, 20);
this.txtHostname.TabIndex = 1; this.txtHostname.TabIndex = 1;
this.txtHostname.Text = "localhost:8080"; this.txtHostname.Text = "localhost:8080";
// //
// txtPassword // txtPassword
// //
this.txtPassword.Location = new System.Drawing.Point(96, 40); this.txtPassword.Location = new System.Drawing.Point(96, 40);
this.txtPassword.Name = "txtPassword"; this.txtPassword.Name = "txtPassword";
this.txtPassword.Size = new System.Drawing.Size(100, 20); this.txtPassword.Size = new System.Drawing.Size(100, 20);
this.txtPassword.TabIndex = 2; this.txtPassword.TabIndex = 2;
this.txtPassword.Text = "animecon"; this.txtPassword.Text = "animecon";
// //
// label2 // label2
// //
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.ForeColor = System.Drawing.SystemColors.Control; this.label2.ForeColor = System.Drawing.SystemColors.Control;
this.label2.Location = new System.Drawing.Point(12, 43); this.label2.Location = new System.Drawing.Point(12, 43);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(53, 13); this.label2.Size = new System.Drawing.Size(53, 13);
this.label2.TabIndex = 3; this.label2.TabIndex = 3;
this.label2.Text = "Password"; this.label2.Text = "Password";
// //
// btnConnect // btnConnect
// //
this.btnConnect.Location = new System.Drawing.Point(96, 67); this.btnConnect.Location = new System.Drawing.Point(96, 67);
this.btnConnect.Name = "btnConnect"; this.btnConnect.Name = "btnConnect";
this.btnConnect.Size = new System.Drawing.Size(75, 23); this.btnConnect.Size = new System.Drawing.Size(75, 23);
this.btnConnect.TabIndex = 4; this.btnConnect.TabIndex = 4;
this.btnConnect.Text = "Connect"; this.btnConnect.Text = "Connect";
this.btnConnect.UseVisualStyleBackColor = true; this.btnConnect.UseVisualStyleBackColor = true;
this.btnConnect.Click += new System.EventHandler(this.btnConnect_Click); this.btnConnect.Click += new System.EventHandler(this.btnConnect_Click);
// //
// label3 // label3
// //
this.label3.AutoSize = true; this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.ForeColor = System.Drawing.SystemColors.Control; this.label3.ForeColor = System.Drawing.SystemColors.Control;
this.label3.Location = new System.Drawing.Point(319, 13); this.label3.Location = new System.Drawing.Point(319, 13);
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(308, 31); this.label3.Size = new System.Drawing.Size(308, 31);
this.label3.TabIndex = 5; this.label3.TabIndex = 5;
this.label3.Text = "Current Time Remaining"; this.label3.Text = "Current Time Remaining";
// //
// lblTime // lblTime
// //
this.lblTime.AutoSize = true; this.lblTime.AutoSize = true;
this.lblTime.Font = new System.Drawing.Font("Microsoft Sans Serif", 48F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblTime.Font = new System.Drawing.Font("Microsoft Sans Serif", 48F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblTime.ForeColor = System.Drawing.SystemColors.Control; this.lblTime.ForeColor = System.Drawing.SystemColors.Control;
this.lblTime.Location = new System.Drawing.Point(325, 48); this.lblTime.Location = new System.Drawing.Point(325, 48);
this.lblTime.Name = "lblTime"; this.lblTime.Name = "lblTime";
this.lblTime.Size = new System.Drawing.Size(284, 73); this.lblTime.Size = new System.Drawing.Size(284, 73);
this.lblTime.TabIndex = 6; this.lblTime.TabIndex = 6;
this.lblTime.Text = "00:00:00"; this.lblTime.Text = "00:00:00";
// //
// lblStatus // lblStatus
// //
this.lblStatus.AutoSize = true; this.lblStatus.AutoSize = true;
this.lblStatus.ForeColor = System.Drawing.Color.Red; this.lblStatus.ForeColor = System.Drawing.Color.Red;
this.lblStatus.Location = new System.Drawing.Point(12, 72); this.lblStatus.Location = new System.Drawing.Point(12, 72);
this.lblStatus.Name = "lblStatus"; this.lblStatus.Name = "lblStatus";
this.lblStatus.Size = new System.Drawing.Size(73, 13); this.lblStatus.Size = new System.Drawing.Size(73, 13);
this.lblStatus.TabIndex = 7; this.lblStatus.TabIndex = 7;
this.lblStatus.Text = "Disconnected"; this.lblStatus.Text = "Disconnected";
// //
// label5 // label5
// //
this.label5.AutoSize = true; this.label5.AutoSize = true;
this.label5.ForeColor = System.Drawing.SystemColors.Control; this.label5.ForeColor = System.Drawing.SystemColors.Control;
this.label5.Location = new System.Drawing.Point(15, 135); this.label5.Location = new System.Drawing.Point(15, 135);
this.label5.Name = "label5"; this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(73, 13); this.label5.Size = new System.Drawing.Size(73, 13);
this.label5.TabIndex = 8; this.label5.TabIndex = 8;
this.label5.Text = "Send to clock"; this.label5.Text = "Send to clock";
// //
// label4 // label4
// //
this.label4.AutoSize = true; this.label4.AutoSize = true;
this.label4.ForeColor = System.Drawing.SystemColors.Control; this.label4.ForeColor = System.Drawing.SystemColors.Control;
this.label4.Location = new System.Drawing.Point(18, 168); this.label4.Location = new System.Drawing.Point(18, 168);
this.label4.Name = "label4"; this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(52, 13); this.label4.Size = new System.Drawing.Size(52, 13);
this.label4.TabIndex = 9; this.label4.TabIndex = 9;
this.label4.Text = "COM port"; this.label4.Text = "COM port";
// //
// lblRunning // lblRunning
// //
this.lblRunning.AutoSize = true; this.lblRunning.AutoSize = true;
this.lblRunning.ForeColor = System.Drawing.Color.Red; this.lblRunning.ForeColor = System.Drawing.Color.Red;
this.lblRunning.Location = new System.Drawing.Point(96, 135); this.lblRunning.Location = new System.Drawing.Point(96, 135);
this.lblRunning.Name = "lblRunning"; this.lblRunning.Name = "lblRunning";
this.lblRunning.Size = new System.Drawing.Size(21, 13); this.lblRunning.Size = new System.Drawing.Size(21, 13);
this.lblRunning.TabIndex = 10; this.lblRunning.TabIndex = 10;
this.lblRunning.Text = "Off"; this.lblRunning.Text = "Off";
// //
// cbCom // cbCom
// //
this.cbCom.FormattingEnabled = true; this.cbCom.FormattingEnabled = true;
this.cbCom.Location = new System.Drawing.Point(96, 168); this.cbCom.Location = new System.Drawing.Point(96, 168);
this.cbCom.Name = "cbCom"; this.cbCom.Name = "cbCom";
this.cbCom.Size = new System.Drawing.Size(121, 21); this.cbCom.Size = new System.Drawing.Size(121, 21);
this.cbCom.TabIndex = 11; this.cbCom.TabIndex = 11;
// //
// btnClock // btnClock
// //
this.btnClock.Location = new System.Drawing.Point(96, 222); this.btnClock.Location = new System.Drawing.Point(96, 222);
this.btnClock.Name = "btnClock"; this.btnClock.Name = "btnClock";
this.btnClock.Size = new System.Drawing.Size(75, 23); this.btnClock.Size = new System.Drawing.Size(75, 23);
this.btnClock.TabIndex = 12; this.btnClock.TabIndex = 12;
this.btnClock.Text = "Start"; this.btnClock.Text = "Start";
this.btnClock.UseVisualStyleBackColor = true; this.btnClock.UseVisualStyleBackColor = true;
this.btnClock.Click += new System.EventHandler(this.btnClock_Click); this.btnClock.Click += new System.EventHandler(this.btnClock_Click);
// //
// label6 // label6
// //
this.label6.AutoSize = true; this.label6.AutoSize = true;
this.label6.ForeColor = System.Drawing.SystemColors.Control; this.label6.ForeColor = System.Drawing.SystemColors.Control;
this.label6.Location = new System.Drawing.Point(18, 199); this.label6.Location = new System.Drawing.Point(18, 199);
this.label6.Name = "label6"; this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(68, 13); this.label6.Size = new System.Drawing.Size(68, 13);
this.label6.TabIndex = 13; this.label6.TabIndex = 13;
this.label6.Text = "Interval (sec)"; this.label6.Text = "Interval (sec)";
// //
// textBox1 // txtInterval
// //
this.textBox1.Location = new System.Drawing.Point(96, 196); this.txtInterval.Location = new System.Drawing.Point(96, 196);
this.textBox1.Name = "textBox1"; this.txtInterval.Name = "txtInterval";
this.textBox1.Size = new System.Drawing.Size(100, 20); this.txtInterval.Size = new System.Drawing.Size(100, 20);
this.textBox1.TabIndex = 14; this.txtInterval.TabIndex = 14;
this.textBox1.Text = "30"; this.txtInterval.Text = "1";
// //
// tmrVlc // tmrVlc
// //
this.tmrVlc.Interval = 1000; this.tmrVlc.Interval = 1000;
this.tmrVlc.Tick += new System.EventHandler(this.tmrVlc_Tick); this.tmrVlc.Tick += new System.EventHandler(this.tmrVlc_Tick);
// //
// tmrClock // tmrClock
// //
this.tmrClock.Tick += new System.EventHandler(this.tmrClock_Tick); this.tmrClock.Tick += new System.EventHandler(this.tmrClock_Tick);
// //
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ActiveCaptionText; this.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.ClientSize = new System.Drawing.Size(634, 286); this.ClientSize = new System.Drawing.Size(634, 286);
this.Controls.Add(this.textBox1); this.Controls.Add(this.txtInterval);
this.Controls.Add(this.label6); this.Controls.Add(this.label6);
this.Controls.Add(this.btnClock); this.Controls.Add(this.btnClock);
this.Controls.Add(this.cbCom); this.Controls.Add(this.cbCom);
this.Controls.Add(this.lblRunning); this.Controls.Add(this.lblRunning);
this.Controls.Add(this.label4); this.Controls.Add(this.label4);
this.Controls.Add(this.label5); this.Controls.Add(this.label5);
this.Controls.Add(this.lblStatus); this.Controls.Add(this.lblStatus);
this.Controls.Add(this.lblTime); this.Controls.Add(this.lblTime);
this.Controls.Add(this.label3); this.Controls.Add(this.label3);
this.Controls.Add(this.btnConnect); this.Controls.Add(this.btnConnect);
this.Controls.Add(this.label2); this.Controls.Add(this.label2);
this.Controls.Add(this.txtPassword); this.Controls.Add(this.txtPassword);
this.Controls.Add(this.txtHostname); this.Controls.Add(this.txtHostname);
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Name = "Form1"; this.Name = "Form1";
this.Text = "Scraper"; this.Text = "Scraper";
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
} }
@ -245,7 +245,7 @@
private System.Windows.Forms.ComboBox cbCom; private System.Windows.Forms.ComboBox cbCom;
private System.Windows.Forms.Button btnClock; private System.Windows.Forms.Button btnClock;
private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label6;
private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox txtInterval;
private System.Windows.Forms.Timer tmrVlc; private System.Windows.Forms.Timer tmrVlc;
private System.Windows.Forms.Timer tmrClock; private System.Windows.Forms.Timer tmrClock;
} }

View file

@ -163,7 +163,8 @@ namespace AnimeCon.Vlc.Scraper
try try
{ {
DoSendDataSerial(); DoSendDataSerial();
tmrClock.Start(); tmrClock.Interval = Convert.ToInt32(txtInterval.Text)*1000;
tmrClock.Start();
btnClock.Text = "Stop"; btnClock.Text = "Stop";
lblStatus.Text = "On"; lblStatus.Text = "On";
lblStatus.ForeColor = System.Drawing.Color.Green; lblStatus.ForeColor = System.Drawing.Color.Green;