Commit f60afe88 authored by Unknown's avatar Unknown

Добавлено автовыполнение

parent 3ab0b530
......@@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.source_array_panel = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label();
......@@ -41,6 +42,7 @@
this.prevStep = new System.Windows.Forms.Button();
this.stepDescription = new System.Windows.Forms.Label();
this.stepsPanel = new System.Windows.Forms.Panel();
this.autoPlay = new System.Windows.Forms.Button();
this.varDump = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.queryL = new System.Windows.Forms.TextBox();
......@@ -49,6 +51,7 @@
this.label8 = new System.Windows.Forms.Label();
this.queryR = new System.Windows.Forms.TextBox();
this.setQuery = new System.Windows.Forms.Button();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.stepsPanel.SuspendLayout();
this.SuspendLayout();
//
......@@ -126,9 +129,9 @@
// stepCounter
//
this.stepCounter.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.stepCounter.Location = new System.Drawing.Point(31, 46);
this.stepCounter.Location = new System.Drawing.Point(31, 47);
this.stepCounter.Name = "stepCounter";
this.stepCounter.Size = new System.Drawing.Size(100, 23);
this.stepCounter.Size = new System.Drawing.Size(139, 23);
this.stepCounter.TabIndex = 10;
this.stepCounter.Text = "0/0";
this.stepCounter.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
......@@ -136,7 +139,7 @@
// nextStep
//
this.nextStep.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.nextStep.Location = new System.Drawing.Point(130, 40);
this.nextStep.Location = new System.Drawing.Point(166, 42);
this.nextStep.Name = "nextStep";
this.nextStep.Size = new System.Drawing.Size(32, 33);
this.nextStep.TabIndex = 11;
......@@ -147,7 +150,7 @@
// prevStep
//
this.prevStep.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.prevStep.Location = new System.Drawing.Point(0, 40);
this.prevStep.Location = new System.Drawing.Point(0, 41);
this.prevStep.Name = "prevStep";
this.prevStep.Size = new System.Drawing.Size(32, 33);
this.prevStep.TabIndex = 12;
......@@ -160,10 +163,10 @@
this.stepDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.stepDescription.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.stepDescription.Location = new System.Drawing.Point(0, 76);
this.stepDescription.Location = new System.Drawing.Point(-3, 149);
this.stepDescription.Margin = new System.Windows.Forms.Padding(0);
this.stepDescription.Name = "stepDescription";
this.stepDescription.Size = new System.Drawing.Size(1236, 83);
this.stepDescription.Size = new System.Drawing.Size(1236, 87);
this.stepDescription.TabIndex = 13;
this.stepDescription.Text = "stepDescription";
this.stepDescription.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
......@@ -172,6 +175,7 @@
//
this.stepsPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.stepsPanel.Controls.Add(this.autoPlay);
this.stepsPanel.Controls.Add(this.varDump);
this.stepsPanel.Controls.Add(this.label9);
this.stepsPanel.Controls.Add(this.nextStep);
......@@ -180,18 +184,29 @@
this.stepsPanel.Controls.Add(this.stepDescription);
this.stepsPanel.Location = new System.Drawing.Point(12, 364);
this.stepsPanel.Name = "stepsPanel";
this.stepsPanel.Size = new System.Drawing.Size(1236, 251);
this.stepsPanel.Size = new System.Drawing.Size(1236, 285);
this.stepsPanel.TabIndex = 14;
//
// autoPlay
//
this.autoPlay.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.autoPlay.Location = new System.Drawing.Point(0, 80);
this.autoPlay.Name = "autoPlay";
this.autoPlay.Size = new System.Drawing.Size(198, 33);
this.autoPlay.TabIndex = 20;
this.autoPlay.Text = "АВТОВЫПОЛНЕНИЕ";
this.autoPlay.UseVisualStyleBackColor = true;
this.autoPlay.Click += new System.EventHandler(this.autoPlay_Click);
//
// varDump
//
this.varDump.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.varDump.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.varDump.Location = new System.Drawing.Point(0, 159);
this.varDump.Location = new System.Drawing.Point(0, 236);
this.varDump.Margin = new System.Windows.Forms.Padding(0);
this.varDump.Name = "varDump";
this.varDump.Size = new System.Drawing.Size(1236, 83);
this.varDump.Size = new System.Drawing.Size(1236, 49);
this.varDump.TabIndex = 19;
this.varDump.Text = "varDump";
this.varDump.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
......@@ -268,11 +283,15 @@
this.setQuery.UseVisualStyleBackColor = true;
this.setQuery.Click += new System.EventHandler(this.setQuery_Click);
//
// timer1
//
this.timer1.Interval = 1000;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1264, 625);
this.ClientSize = new System.Drawing.Size(1264, 661);
this.Controls.Add(this.setQuery);
this.Controls.Add(this.queryR);
this.Controls.Add(this.label8);
......@@ -318,6 +337,8 @@
private System.Windows.Forms.Button setQuery;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label varDump;
private System.Windows.Forms.Button autoPlay;
private System.Windows.Forms.Timer timer1;
}
}
......@@ -15,6 +15,7 @@ namespace SQRT_Decomposition_Visualizer
SQRTDecompositionSum sqrtdsum;
int qL, qR, arraySize;
Steps steps;
bool autoPlayState = false;
class SQRTDecompositionSum
{
......@@ -444,11 +445,7 @@ namespace SQRT_Decomposition_Visualizer
queryR.Text = "" + rndR;
qL = rndL; qR = rndR;
calculateSteps(Int32.Parse(arrayCount.Text));
}
private void label2_Click(object sender, EventArgs e)
{
timer1.Tick += new EventHandler(autoPlayHandler);
}
void calculateSteps(int length, int min=0, int max= 100)
......@@ -471,6 +468,12 @@ namespace SQRT_Decomposition_Visualizer
void StepButtonsControl()
{
if (autoPlayState)
{
prevStep.Enabled = false;
nextStep.Enabled = false;
return;
}
if (steps.GetCurrentStep() > 1)
{
prevStep.Enabled = true;
......@@ -489,6 +492,19 @@ namespace SQRT_Decomposition_Visualizer
}
}
void autoPlayHandler(object Sender, EventArgs e)
{
steps.NextStep();
StepButtonsControl();
if (steps.GetCurrentStep() >= steps.GetStepsCount())
{
autoPlayState = false;
autoPlay.Text = "АВТОВЫПОЛНЕНИЕ";
timer1.Enabled = false;
StepButtonsControl();
}
}
private void prevStep_Click(object sender, EventArgs e)
{
steps.PrevStep();
......@@ -501,6 +517,22 @@ namespace SQRT_Decomposition_Visualizer
StepButtonsControl();
}
private void autoPlay_Click(object sender, EventArgs e)
{
if (autoPlayState == false)
{
autoPlayState = true;
autoPlay.Text = "ОСТАНОВИТЬ";
timer1.Enabled = true;
StepButtonsControl();
} else
{
autoPlayState = false;
autoPlay.Text = "АВТОВЫПОЛНЕНИЕ";
timer1.Enabled = false;
}
}
private void setArraySize_Click(object sender, EventArgs e)
{
int j;
......
......@@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment