Add project files.
This commit is contained in:
31
TestWinFormsDataVis.sln
Normal file
31
TestWinFormsDataVis.sln
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 16
|
||||||
|
VisualStudioVersion = 16.0.31005.135
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestWinFormsDataVis", "TestWinFormsDataVis\TestWinFormsDataVis.csproj", "{E863ED95-AF3C-4F67-BF82-3C9A57A38274}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testthings", "Testthings\Testthings.csproj", "{521D3DAA-F6A8-44F1-85CF-7E0AAC405BBB}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{E863ED95-AF3C-4F67-BF82-3C9A57A38274}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{E863ED95-AF3C-4F67-BF82-3C9A57A38274}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{E863ED95-AF3C-4F67-BF82-3C9A57A38274}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{E863ED95-AF3C-4F67-BF82-3C9A57A38274}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{521D3DAA-F6A8-44F1-85CF-7E0AAC405BBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{521D3DAA-F6A8-44F1-85CF-7E0AAC405BBB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{521D3DAA-F6A8-44F1-85CF-7E0AAC405BBB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{521D3DAA-F6A8-44F1-85CF-7E0AAC405BBB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {D06D1593-FCB9-4A09-94CF-1C68304F2495}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
69
TestWinFormsDataVis/Form1.Designer.cs
generated
Normal file
69
TestWinFormsDataVis/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
|
||||||
|
namespace TestWinFormsDataVis
|
||||||
|
{
|
||||||
|
partial class Form1
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.components = new System.ComponentModel.Container();
|
||||||
|
this.pnlCanvas = new System.Windows.Forms.Panel();
|
||||||
|
this.paintTimer = new System.Windows.Forms.Timer(this.components);
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// pnlCanvas
|
||||||
|
//
|
||||||
|
this.pnlCanvas.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(224)))), ((int)(((byte)(192)))));
|
||||||
|
this.pnlCanvas.Location = new System.Drawing.Point(269, 297);
|
||||||
|
this.pnlCanvas.Name = "pnlCanvas";
|
||||||
|
this.pnlCanvas.Size = new System.Drawing.Size(487, 123);
|
||||||
|
this.pnlCanvas.TabIndex = 0;
|
||||||
|
this.pnlCanvas.Paint += new System.Windows.Forms.PaintEventHandler(this.pnlCanvas_Paint);
|
||||||
|
//
|
||||||
|
// paintTimer
|
||||||
|
//
|
||||||
|
this.paintTimer.Enabled = true;
|
||||||
|
this.paintTimer.Tick += new System.EventHandler(this.paintTimer_Tick);
|
||||||
|
//
|
||||||
|
// Form1
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||||
|
this.Controls.Add(this.pnlCanvas);
|
||||||
|
this.Name = "Form1";
|
||||||
|
this.Text = "Form1";
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.Panel pnlCanvas;
|
||||||
|
private System.Windows.Forms.Timer paintTimer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
193
TestWinFormsDataVis/Form1.cs
Normal file
193
TestWinFormsDataVis/Form1.cs
Normal file
@ -0,0 +1,193 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace TestWinFormsDataVis
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
public partial class Form1 : Form
|
||||||
|
{
|
||||||
|
|
||||||
|
Pen myPen = new Pen(Color.Black);
|
||||||
|
Graphics g = null;
|
||||||
|
|
||||||
|
List<StraightLine> koordCross = new();
|
||||||
|
List<TwoPoints> CurveSin = new();
|
||||||
|
List<TwoPoints> CurveCos = new();
|
||||||
|
public bool CrossDrawn { get; set; } = false;
|
||||||
|
|
||||||
|
static int _yMid = 0;
|
||||||
|
static int _yxPos = 3;
|
||||||
|
static int _yTop = 0;
|
||||||
|
static int _yStep = 0;
|
||||||
|
static long _yScaleStep = 0;
|
||||||
|
static int _yBottom = 0;
|
||||||
|
static int _xRight = 0;
|
||||||
|
static int countNum = 0;
|
||||||
|
static double _timeX = 0;
|
||||||
|
static int _timeXPosOld = 0;
|
||||||
|
static int _timeXPos = 0;
|
||||||
|
static int _timeYSin = 0;
|
||||||
|
static int _timeYCos = 0;
|
||||||
|
|
||||||
|
|
||||||
|
public Form1()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_yMid = pnlCanvas.Height / 2;
|
||||||
|
_yTop = pnlCanvas.Height;
|
||||||
|
_yBottom = 0;
|
||||||
|
_xRight = pnlCanvas.Width;
|
||||||
|
createKoordCross(koordCross, 3000, -3000);
|
||||||
|
pnlCanvas.Refresh();
|
||||||
|
_timeYCos = _yMid;
|
||||||
|
_timeYSin = _yMid;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void createKoordCross(List<StraightLine> koordCross, decimal maxVal, decimal minVal)
|
||||||
|
{
|
||||||
|
// Y-axel
|
||||||
|
koordCross.Add(new StraightLine { start_x = _yxPos, start_y = _yTop, end_x = _yxPos, end_y = _yBottom });
|
||||||
|
// X-axel
|
||||||
|
koordCross.Add(new StraightLine { start_x = _yxPos - 2, start_y = _yMid, end_x = _xRight, end_y = _yMid });
|
||||||
|
|
||||||
|
|
||||||
|
_yScaleStep = scaleStep(maxVal, 8);
|
||||||
|
_yStep = (int)_yScaleStep * _yMid / (int)maxVal;
|
||||||
|
var _yVal = _yMid;
|
||||||
|
while (_yVal < _yTop)
|
||||||
|
{
|
||||||
|
koordCross.Add(new StraightLine { start_x = _yxPos - 2, start_y = _yVal, end_x = _yxPos + 2, end_y = _yVal });
|
||||||
|
_yVal += _yStep;
|
||||||
|
}
|
||||||
|
|
||||||
|
_yVal = _yMid;
|
||||||
|
while (_yVal > 0)
|
||||||
|
{
|
||||||
|
koordCross.Add(new StraightLine { start_x = _yxPos - 2, start_y = _yVal, end_x = _yxPos + 2, end_y = _yVal });
|
||||||
|
_yVal -= _yStep;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static long scaleStep(decimal maxValue, int maxSteps)
|
||||||
|
{
|
||||||
|
long stepValue = nextValue(true);
|
||||||
|
long tmpValue = stepValue;
|
||||||
|
int _maxSteps = (int)((int)maxValue / stepValue);
|
||||||
|
while (_maxSteps > maxSteps)
|
||||||
|
{
|
||||||
|
stepValue = tmpValue * nextValue();
|
||||||
|
_maxSteps = (int)((int)maxValue / stepValue);
|
||||||
|
tmpValue = stepValue == tmpValue * 10 ? stepValue : tmpValue;
|
||||||
|
}
|
||||||
|
return stepValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int nextValue(bool first = false)
|
||||||
|
{
|
||||||
|
if (first)
|
||||||
|
{
|
||||||
|
countNum = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (countNum)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
countNum = 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
countNum = 5;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 5:
|
||||||
|
{
|
||||||
|
countNum = 10;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 10:
|
||||||
|
{
|
||||||
|
countNum = 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return countNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void drawKoordCrossLines()
|
||||||
|
{
|
||||||
|
foreach (var x in koordCross)
|
||||||
|
{
|
||||||
|
Point[] points =
|
||||||
|
{
|
||||||
|
new Point(x.start_x,x.start_y),
|
||||||
|
new Point(x.end_x,x.end_y)
|
||||||
|
};
|
||||||
|
g.DrawLines(myPen, points);
|
||||||
|
}
|
||||||
|
CrossDrawn = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawCurves()
|
||||||
|
{
|
||||||
|
var _prevYSin = _timeYSin;
|
||||||
|
var _prevYCos = _timeYCos;
|
||||||
|
|
||||||
|
_timeX = _timeX + .017453292519;
|
||||||
|
_timeYSin = _yMid + (int)(Math.Sin(_timeX) * -1 * _yMid);
|
||||||
|
CurveSin.Add(new TwoPoints { X1 = _timeXPosOld, Y1 = _prevYSin, X2 = _timeXPos, Y2 = _timeYSin });
|
||||||
|
|
||||||
|
foreach (var tp in CurveSin)
|
||||||
|
{
|
||||||
|
g.DrawLines(myPen, tp.drwPoints());
|
||||||
|
}
|
||||||
|
//Debug.WriteLine($"p1 (x1,y1,x2,y2) -> {points[0].X},{points[0].Y},{points[1].X},{points[1].Y} ");
|
||||||
|
|
||||||
|
_timeYCos = _yMid + (int)(Math.Cos(_timeX) * _yMid);
|
||||||
|
CurveSin.Add(new TwoPoints { X1 = _timeXPosOld, Y1 = _prevYCos, X2 = _timeXPos, Y2 = _timeYCos });
|
||||||
|
|
||||||
|
foreach (var tp in CurveCos)
|
||||||
|
{
|
||||||
|
g.DrawLines(myPen, tp.drwPoints());
|
||||||
|
}
|
||||||
|
//Debug.WriteLine($"p2 (x1,y1,x2,y2) -> {xpoints[0].X},{xpoints[0].Y},{xpoints[1].X},{xpoints[1].Y} ");
|
||||||
|
_timeXPosOld = _timeXPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void pnlCanvas_Paint(object sender, PaintEventArgs e)
|
||||||
|
{
|
||||||
|
if (!CrossDrawn)
|
||||||
|
{
|
||||||
|
myPen.Width = 1;
|
||||||
|
g = pnlCanvas.CreateGraphics();
|
||||||
|
drawKoordCrossLines();
|
||||||
|
}
|
||||||
|
|
||||||
|
//drawCurves();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void paintTimer_Tick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_timeXPos += 1;
|
||||||
|
drawCurves();
|
||||||
|
//pnlCanvas.Refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
60
TestWinFormsDataVis/Form1.resx
Normal file
60
TestWinFormsDataVis/Form1.resx
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
25
TestWinFormsDataVis/Program.cs
Normal file
25
TestWinFormsDataVis/Program.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace TestWinFormsDataVis
|
||||||
|
{
|
||||||
|
static class Program
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The main entry point for the application.
|
||||||
|
/// </summary>
|
||||||
|
[STAThread]
|
||||||
|
static void Main()
|
||||||
|
{
|
||||||
|
Application.SetHighDpiMode(HighDpiMode.SystemAware);
|
||||||
|
Application.EnableVisualStyles();
|
||||||
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
Application.Run(new Form1());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
16
TestWinFormsDataVis/StraightLine.cs
Normal file
16
TestWinFormsDataVis/StraightLine.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace TestWinFormsDataVis
|
||||||
|
{
|
||||||
|
public class StraightLine
|
||||||
|
{
|
||||||
|
public int start_x { get; set; }
|
||||||
|
public int start_y { get; set; }
|
||||||
|
public int end_x { get; set; }
|
||||||
|
public int end_y { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
9
TestWinFormsDataVis/TestWinFormsDataVis.csproj
Normal file
9
TestWinFormsDataVis/TestWinFormsDataVis.csproj
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>net5.0-windows</TargetFramework>
|
||||||
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
26
TestWinFormsDataVis/TwoPoints.cs
Normal file
26
TestWinFormsDataVis/TwoPoints.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace TestWinFormsDataVis
|
||||||
|
{
|
||||||
|
public class TwoPoints
|
||||||
|
{
|
||||||
|
public int X1 { get; set; }
|
||||||
|
public int Y1 { get; set; }
|
||||||
|
public int X2 { get; set; }
|
||||||
|
public int Y2 { get; set; }
|
||||||
|
|
||||||
|
public Point[] drwPoints(int posShift = 0)
|
||||||
|
{
|
||||||
|
return new Point[] {
|
||||||
|
new Point(X1+posShift,Y1),
|
||||||
|
new Point(X2+posShift,Y2)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
75
Testthings/Program.cs
Normal file
75
Testthings/Program.cs
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
namespace Testthings
|
||||||
|
{
|
||||||
|
class Program
|
||||||
|
{
|
||||||
|
|
||||||
|
static int countNum = 0;
|
||||||
|
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
var x = 0.0001;
|
||||||
|
for (int i = 0; i < 360; i++)
|
||||||
|
{
|
||||||
|
x = x + .017453292519;
|
||||||
|
var y = Math.Sin(x) * 250;
|
||||||
|
Debug.WriteLine($"pos [{i}] x={x}, y={y}");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Console.WriteLine($"testar scaling {445} -> {scaleStep(445, 8)}");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private static long scaleStep(decimal maxValue, int maxSteps)
|
||||||
|
{
|
||||||
|
long stepValue = nextValue(true);
|
||||||
|
long tmpValue = stepValue;
|
||||||
|
int _maxSteps = (int)((int) maxValue/stepValue);
|
||||||
|
while (_maxSteps > maxSteps)
|
||||||
|
{
|
||||||
|
stepValue = tmpValue * nextValue();
|
||||||
|
_maxSteps = (int)((int)maxValue / stepValue);
|
||||||
|
tmpValue = stepValue == tmpValue * 10 ? stepValue : tmpValue;
|
||||||
|
}
|
||||||
|
return stepValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int nextValue(bool first=false)
|
||||||
|
{
|
||||||
|
if (first)
|
||||||
|
{
|
||||||
|
countNum = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (countNum)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
countNum = 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
countNum = 5;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 5:
|
||||||
|
{
|
||||||
|
countNum = 10;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 10:
|
||||||
|
{
|
||||||
|
countNum = 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return countNum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
8
Testthings/Testthings.csproj
Normal file
8
Testthings/Testthings.csproj
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
Reference in New Issue
Block a user