212 lines
6.4 KiB
C#
212 lines
6.4 KiB
C#
using System;
|
|
using System.ComponentModel;
|
|
using System.Configuration;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
|
|
namespace ControlApp;
|
|
|
|
public class WriteForMe : Form
|
|
{
|
|
private int seconds;
|
|
|
|
private int mistakes;
|
|
|
|
private int count;
|
|
|
|
private string senderstr;
|
|
|
|
private IContainer components;
|
|
|
|
private Button button1;
|
|
|
|
private Label label1;
|
|
|
|
private Label writelbl;
|
|
|
|
private TextBox wfmtextb;
|
|
|
|
private Label timelbl;
|
|
|
|
private Label label3;
|
|
|
|
private Label label4;
|
|
|
|
private Label mistakelbl;
|
|
|
|
private Label label6;
|
|
|
|
private Label countlbl;
|
|
|
|
private Timer timer1;
|
|
|
|
public WriteForMe(string message, string times, string senderid)
|
|
{
|
|
InitializeComponent();
|
|
writelbl.Text = message;
|
|
count = Convert.ToInt16(times);
|
|
countlbl.Text = times;
|
|
senderstr = senderid;
|
|
}
|
|
|
|
private void WriteForMe_Load(object sender, EventArgs e)
|
|
{
|
|
seconds = 0;
|
|
mistakes = 0;
|
|
mistakelbl.Text = mistakes.ToString();
|
|
timelbl.Text = seconds.ToString();
|
|
timer1.Interval = 1000;
|
|
timer1.Tick += MyTimer_Tick;
|
|
timer1.Start();
|
|
}
|
|
|
|
private void MyTimer_Tick(object sender, EventArgs e)
|
|
{
|
|
seconds++;
|
|
}
|
|
|
|
private void input_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyData == Keys.Return)
|
|
{
|
|
if (wfmtextb.Text == writelbl.Text)
|
|
{
|
|
count--;
|
|
countlbl.Text = count.ToString();
|
|
timelbl.Text = seconds.ToString();
|
|
}
|
|
else
|
|
{
|
|
mistakes++;
|
|
mistakelbl.Text = mistakes.ToString();
|
|
timelbl.Text = seconds.ToString();
|
|
}
|
|
wfmtextb.Text = "";
|
|
if (count == 0)
|
|
{
|
|
Utils ut = new Utils();
|
|
string usrnm = ConfigurationManager.AppSettings["UserName"].ToString();
|
|
ut.sendcmd(senderstr, ut.Ecrypt("M=" + usrnm + " completed your command in " + timelbl.Text + " seconds with " + mistakelbl.Text + " mistakes.&&&Please Reward"), all: false);
|
|
Close();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
Utils ut = new Utils();
|
|
string usrnm = ConfigurationManager.AppSettings["UserName"].ToString();
|
|
ut.sendcmd(senderstr, ut.Ecrypt("M=" + usrnm + " failed your command after " + timelbl.Text + " seconds with " + mistakelbl.Text + " mistakes.&&&Please Punish"), all: false);
|
|
Close();
|
|
}
|
|
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
if (disposing && components != null)
|
|
{
|
|
components.Dispose();
|
|
}
|
|
base.Dispose(disposing);
|
|
}
|
|
|
|
private void InitializeComponent()
|
|
{
|
|
this.components = new System.ComponentModel.Container();
|
|
this.button1 = new System.Windows.Forms.Button();
|
|
this.label1 = new System.Windows.Forms.Label();
|
|
this.writelbl = new System.Windows.Forms.Label();
|
|
this.wfmtextb = new System.Windows.Forms.TextBox();
|
|
this.timelbl = new System.Windows.Forms.Label();
|
|
this.label3 = new System.Windows.Forms.Label();
|
|
this.label4 = new System.Windows.Forms.Label();
|
|
this.mistakelbl = new System.Windows.Forms.Label();
|
|
this.label6 = new System.Windows.Forms.Label();
|
|
this.countlbl = new System.Windows.Forms.Label();
|
|
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
|
base.SuspendLayout();
|
|
this.button1.Location = new System.Drawing.Point(398, 136);
|
|
this.button1.Name = "button1";
|
|
this.button1.Size = new System.Drawing.Size(75, 23);
|
|
this.button1.TabIndex = 0;
|
|
this.button1.Text = "Fail";
|
|
this.button1.UseVisualStyleBackColor = true;
|
|
this.button1.Click += new System.EventHandler(button1_Click);
|
|
this.label1.AutoSize = true;
|
|
this.label1.Font = new System.Drawing.Font("Segoe UI", 14f, System.Drawing.FontStyle.Bold);
|
|
this.label1.Location = new System.Drawing.Point(21, 19);
|
|
this.label1.Name = "label1";
|
|
this.label1.Size = new System.Drawing.Size(125, 25);
|
|
this.label1.TabIndex = 1;
|
|
this.label1.Text = "Write for me";
|
|
this.writelbl.AutoSize = true;
|
|
this.writelbl.Location = new System.Drawing.Point(21, 59);
|
|
this.writelbl.Name = "writelbl";
|
|
this.writelbl.Size = new System.Drawing.Size(38, 15);
|
|
this.writelbl.TabIndex = 2;
|
|
this.writelbl.Text = "label2";
|
|
this.wfmtextb.Location = new System.Drawing.Point(21, 95);
|
|
this.wfmtextb.Name = "wfmtextb";
|
|
this.wfmtextb.Size = new System.Drawing.Size(452, 23);
|
|
this.wfmtextb.TabIndex = 3;
|
|
this.wfmtextb.KeyDown += new System.Windows.Forms.KeyEventHandler(input_KeyDown);
|
|
this.timelbl.AutoSize = true;
|
|
this.timelbl.Location = new System.Drawing.Point(420, 19);
|
|
this.timelbl.Name = "timelbl";
|
|
this.timelbl.Size = new System.Drawing.Size(38, 15);
|
|
this.timelbl.TabIndex = 4;
|
|
this.timelbl.Text = "label2";
|
|
this.label3.AutoSize = true;
|
|
this.label3.Location = new System.Drawing.Point(366, 19);
|
|
this.label3.Name = "label3";
|
|
this.label3.Size = new System.Drawing.Size(33, 15);
|
|
this.label3.TabIndex = 5;
|
|
this.label3.Text = "Time";
|
|
this.label4.AutoSize = true;
|
|
this.label4.Location = new System.Drawing.Point(366, 34);
|
|
this.label4.Name = "label4";
|
|
this.label4.Size = new System.Drawing.Size(53, 15);
|
|
this.label4.TabIndex = 6;
|
|
this.label4.Text = "Mistakes";
|
|
this.mistakelbl.AutoSize = true;
|
|
this.mistakelbl.Location = new System.Drawing.Point(420, 34);
|
|
this.mistakelbl.Name = "mistakelbl";
|
|
this.mistakelbl.Size = new System.Drawing.Size(38, 15);
|
|
this.mistakelbl.TabIndex = 7;
|
|
this.mistakelbl.Text = "label5";
|
|
this.label6.AutoSize = true;
|
|
this.label6.Location = new System.Drawing.Point(366, 49);
|
|
this.label6.Name = "label6";
|
|
this.label6.Size = new System.Drawing.Size(27, 15);
|
|
this.label6.TabIndex = 8;
|
|
this.label6.Text = "Left";
|
|
this.countlbl.AutoSize = true;
|
|
this.countlbl.Location = new System.Drawing.Point(420, 49);
|
|
this.countlbl.Name = "countlbl";
|
|
this.countlbl.Size = new System.Drawing.Size(38, 15);
|
|
this.countlbl.TabIndex = 9;
|
|
this.countlbl.Text = "label7";
|
|
base.AutoScaleDimensions = new System.Drawing.SizeF(7f, 15f);
|
|
base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
base.ClientSize = new System.Drawing.Size(492, 173);
|
|
base.ControlBox = false;
|
|
base.Controls.Add(this.countlbl);
|
|
base.Controls.Add(this.label6);
|
|
base.Controls.Add(this.mistakelbl);
|
|
base.Controls.Add(this.label4);
|
|
base.Controls.Add(this.label3);
|
|
base.Controls.Add(this.timelbl);
|
|
base.Controls.Add(this.wfmtextb);
|
|
base.Controls.Add(this.writelbl);
|
|
base.Controls.Add(this.label1);
|
|
base.Controls.Add(this.button1);
|
|
base.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
|
base.Name = "WriteForMe";
|
|
base.ShowIcon = false;
|
|
base.ShowInTaskbar = false;
|
|
this.Text = "WriteForMe";
|
|
base.TopMost = true;
|
|
base.Load += new System.EventHandler(WriteForMe_Load);
|
|
base.ResumeLayout(false);
|
|
base.PerformLayout();
|
|
}
|
|
}
|