20211113 C#10 Update
This commit is contained in:
245
demo/CountValueTest.Designer.cs
generated
245
demo/CountValueTest.Designer.cs
generated
@@ -1,134 +1,133 @@
|
||||
namespace demo
|
||||
namespace demo;
|
||||
|
||||
partial class CountValueTest
|
||||
{
|
||||
partial class CountValueTest
|
||||
/// <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)
|
||||
{
|
||||
/// <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))
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
#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.InsertDataLabel = new System.Windows.Forms.Label();
|
||||
this.InsertDataBox = new System.Windows.Forms.TextBox();
|
||||
this.ResultLabel = new System.Windows.Forms.Label();
|
||||
this.CalculateButton = new System.Windows.Forms.Button();
|
||||
this.SelectFormatterLabel = new System.Windows.Forms.Label();
|
||||
this.SelectFormatterBox = new System.Windows.Forms.ComboBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// InsertDataLabel
|
||||
//
|
||||
this.InsertDataLabel.AutoSize = true;
|
||||
this.InsertDataLabel.Location = new System.Drawing.Point(12, 66);
|
||||
this.InsertDataLabel.Name = "InsertDataLabel";
|
||||
this.InsertDataLabel.Size = new System.Drawing.Size(197, 17);
|
||||
this.InsertDataLabel.TabIndex = 0;
|
||||
this.InsertDataLabel.Text = "&Insert any int value:";
|
||||
//
|
||||
// InsertDataBox
|
||||
//
|
||||
this.InsertDataBox.Location = new System.Drawing.Point(12, 86);
|
||||
this.InsertDataBox.Name = "InsertDataBox";
|
||||
this.InsertDataBox.Size = new System.Drawing.Size(246, 24);
|
||||
this.InsertDataBox.TabIndex = 1;
|
||||
//
|
||||
// ResultLabel
|
||||
//
|
||||
this.ResultLabel.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.ResultLabel.Location = new System.Drawing.Point(0, 143);
|
||||
this.ResultLabel.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.ResultLabel.Name = "ResultLabel";
|
||||
this.ResultLabel.Padding = new System.Windows.Forms.Padding(5);
|
||||
this.ResultLabel.Size = new System.Drawing.Size(270, 79);
|
||||
this.ResultLabel.TabIndex = 2;
|
||||
this.ResultLabel.Text = "&Insert any int value to insert box above and press \"Calculate\" button to see res" +
|
||||
"ult...";
|
||||
this.ResultLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// CalculateButton
|
||||
//
|
||||
this.CalculateButton.Location = new System.Drawing.Point(81, 116);
|
||||
this.CalculateButton.Name = "CalculateButton";
|
||||
this.CalculateButton.Size = new System.Drawing.Size(103, 23);
|
||||
this.CalculateButton.TabIndex = 3;
|
||||
this.CalculateButton.Text = "Calc&ulate";
|
||||
this.CalculateButton.UseVisualStyleBackColor = true;
|
||||
this.CalculateButton.Click += new System.EventHandler(this.CalculateButton_Click);
|
||||
//
|
||||
// SelectFormatterLabel
|
||||
//
|
||||
this.SelectFormatterLabel.AutoSize = true;
|
||||
this.SelectFormatterLabel.Location = new System.Drawing.Point(12, 9);
|
||||
this.SelectFormatterLabel.Name = "SelectFormatterLabel";
|
||||
this.SelectFormatterLabel.Size = new System.Drawing.Size(161, 17);
|
||||
this.SelectFormatterLabel.TabIndex = 4;
|
||||
this.SelectFormatterLabel.Text = "&Select formatter:";
|
||||
//
|
||||
// SelectFormatterBox
|
||||
//
|
||||
this.SelectFormatterBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.SelectFormatterBox.FlatStyle = System.Windows.Forms.FlatStyle.System;
|
||||
this.SelectFormatterBox.FormattingEnabled = true;
|
||||
this.SelectFormatterBox.Items.AddRange(new object[] {
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent ()
|
||||
{
|
||||
this.InsertDataLabel = new System.Windows.Forms.Label();
|
||||
this.InsertDataBox = new System.Windows.Forms.TextBox();
|
||||
this.ResultLabel = new System.Windows.Forms.Label();
|
||||
this.CalculateButton = new System.Windows.Forms.Button();
|
||||
this.SelectFormatterLabel = new System.Windows.Forms.Label();
|
||||
this.SelectFormatterBox = new System.Windows.Forms.ComboBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// InsertDataLabel
|
||||
//
|
||||
this.InsertDataLabel.AutoSize = true;
|
||||
this.InsertDataLabel.Location = new System.Drawing.Point(12, 66);
|
||||
this.InsertDataLabel.Name = "InsertDataLabel";
|
||||
this.InsertDataLabel.Size = new System.Drawing.Size(197, 17);
|
||||
this.InsertDataLabel.TabIndex = 0;
|
||||
this.InsertDataLabel.Text = "&Insert any int value:";
|
||||
//
|
||||
// InsertDataBox
|
||||
//
|
||||
this.InsertDataBox.Location = new System.Drawing.Point(12, 86);
|
||||
this.InsertDataBox.Name = "InsertDataBox";
|
||||
this.InsertDataBox.Size = new System.Drawing.Size(246, 24);
|
||||
this.InsertDataBox.TabIndex = 1;
|
||||
//
|
||||
// ResultLabel
|
||||
//
|
||||
this.ResultLabel.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.ResultLabel.Location = new System.Drawing.Point(0, 143);
|
||||
this.ResultLabel.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.ResultLabel.Name = "ResultLabel";
|
||||
this.ResultLabel.Padding = new System.Windows.Forms.Padding(5);
|
||||
this.ResultLabel.Size = new System.Drawing.Size(270, 79);
|
||||
this.ResultLabel.TabIndex = 2;
|
||||
this.ResultLabel.Text = "&Insert any int value to insert box above and press \"Calculate\" button to see res" +
|
||||
"ult...";
|
||||
this.ResultLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// CalculateButton
|
||||
//
|
||||
this.CalculateButton.Location = new System.Drawing.Point(81, 116);
|
||||
this.CalculateButton.Name = "CalculateButton";
|
||||
this.CalculateButton.Size = new System.Drawing.Size(103, 23);
|
||||
this.CalculateButton.TabIndex = 3;
|
||||
this.CalculateButton.Text = "Calc&ulate";
|
||||
this.CalculateButton.UseVisualStyleBackColor = true;
|
||||
this.CalculateButton.Click += new System.EventHandler(this.CalculateButton_Click);
|
||||
//
|
||||
// SelectFormatterLabel
|
||||
//
|
||||
this.SelectFormatterLabel.AutoSize = true;
|
||||
this.SelectFormatterLabel.Location = new System.Drawing.Point(12, 9);
|
||||
this.SelectFormatterLabel.Name = "SelectFormatterLabel";
|
||||
this.SelectFormatterLabel.Size = new System.Drawing.Size(161, 17);
|
||||
this.SelectFormatterLabel.TabIndex = 4;
|
||||
this.SelectFormatterLabel.Text = "&Select formatter:";
|
||||
//
|
||||
// SelectFormatterBox
|
||||
//
|
||||
this.SelectFormatterBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.SelectFormatterBox.FlatStyle = System.Windows.Forms.FlatStyle.System;
|
||||
this.SelectFormatterBox.FormattingEnabled = true;
|
||||
this.SelectFormatterBox.Items.AddRange(new object[] {
|
||||
"CountFormatter",
|
||||
"FileSizeFormatter"});
|
||||
this.SelectFormatterBox.Location = new System.Drawing.Point(12, 29);
|
||||
this.SelectFormatterBox.Name = "SelectFormatterBox";
|
||||
this.SelectFormatterBox.Size = new System.Drawing.Size(246, 25);
|
||||
this.SelectFormatterBox.TabIndex = 5;
|
||||
//
|
||||
// CountValueTest
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 17F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(270, 222);
|
||||
this.Controls.Add(this.SelectFormatterBox);
|
||||
this.Controls.Add(this.SelectFormatterLabel);
|
||||
this.Controls.Add(this.CalculateButton);
|
||||
this.Controls.Add(this.ResultLabel);
|
||||
this.Controls.Add(this.InsertDataBox);
|
||||
this.Controls.Add(this.InsertDataLabel);
|
||||
this.Font = new System.Drawing.Font("Courier New", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "CountValueTest";
|
||||
this.ShowIcon = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Formatter Test Unit";
|
||||
this.Load += new System.EventHandler(this.CountValueTest_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
this.SelectFormatterBox.Location = new System.Drawing.Point(12, 29);
|
||||
this.SelectFormatterBox.Name = "SelectFormatterBox";
|
||||
this.SelectFormatterBox.Size = new System.Drawing.Size(246, 25);
|
||||
this.SelectFormatterBox.TabIndex = 5;
|
||||
//
|
||||
// CountValueTest
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 17F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(270, 222);
|
||||
this.Controls.Add(this.SelectFormatterBox);
|
||||
this.Controls.Add(this.SelectFormatterLabel);
|
||||
this.Controls.Add(this.CalculateButton);
|
||||
this.Controls.Add(this.ResultLabel);
|
||||
this.Controls.Add(this.InsertDataBox);
|
||||
this.Controls.Add(this.InsertDataLabel);
|
||||
this.Font = new System.Drawing.Font("Courier New", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "CountValueTest";
|
||||
this.ShowIcon = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Formatter Test Unit";
|
||||
this.Load += new System.EventHandler(this.CountValueTest_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label InsertDataLabel;
|
||||
private TextBox InsertDataBox;
|
||||
private Label ResultLabel;
|
||||
private Button CalculateButton;
|
||||
private Label SelectFormatterLabel;
|
||||
private ComboBox SelectFormatterBox;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label InsertDataLabel;
|
||||
private TextBox InsertDataBox;
|
||||
private Label ResultLabel;
|
||||
private Button CalculateButton;
|
||||
private Label SelectFormatterLabel;
|
||||
private ComboBox SelectFormatterBox;
|
||||
}
|
@@ -1,42 +1,32 @@
|
||||
using anbs_cp;
|
||||
namespace demo
|
||||
|
||||
namespace demo;
|
||||
|
||||
public partial class CountValueTest: Form
|
||||
{
|
||||
public partial class CountValueTest : Form
|
||||
public CountValueTest ()
|
||||
{
|
||||
public CountValueTest()
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void CalculateButton_Click (object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (string.IsNullOrEmpty(InsertDataBox.Text))
|
||||
return;
|
||||
|
||||
long value = TypeConverter.StrToInt64(InsertDataBox.Text);
|
||||
IValueFormatter formatter = SelectFormatterBox.SelectedIndex switch
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
0 => new CountFormatter(),
|
||||
1 => new FileSizeFormatter(),
|
||||
_ => new CountFormatter(),
|
||||
};
|
||||
ResultLabel.Text = formatter.Format(value);
|
||||
}
|
||||
|
||||
private void CalculateButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (string.IsNullOrEmpty(InsertDataBox.Text))
|
||||
return;
|
||||
|
||||
IValueFormatter formatter;
|
||||
|
||||
long value = TypeConverter.StrToInt64(InsertDataBox.Text);
|
||||
|
||||
switch (SelectFormatterBox.SelectedIndex)
|
||||
{
|
||||
case 0:
|
||||
formatter = new CountFormatter();
|
||||
break;
|
||||
case 1:
|
||||
formatter = new FileSizeFormatter();
|
||||
break;
|
||||
default:
|
||||
formatter = new CountFormatter();
|
||||
break;
|
||||
}
|
||||
|
||||
ResultLabel.Text = formatter.Format(value);
|
||||
}
|
||||
|
||||
private void CountValueTest_Load(object sender, EventArgs e)
|
||||
{
|
||||
SelectFormatterBox.SelectedIndex = 0;
|
||||
}
|
||||
private void CountValueTest_Load (object sender, EventArgs e)
|
||||
{
|
||||
SelectFormatterBox.SelectedIndex = 0;
|
||||
}
|
||||
}
|
@@ -1,15 +1,14 @@
|
||||
namespace demo
|
||||
namespace demo;
|
||||
|
||||
internal static class Program
|
||||
{
|
||||
internal static class Program
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main ()
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new CountValueTest());
|
||||
}
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new CountValueTest());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user