Removed automatic naming for items

This commit is contained in:
aj
2018-05-31 22:50:09 -04:00
parent 8967aa8b55
commit 09fa851367
3 changed files with 13 additions and 23 deletions

View File

@@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
namespace CutToLength namespace CutToLength
{ {

View File

@@ -33,7 +33,6 @@
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
this.dataGridView1 = new System.Windows.Forms.DataGridView(); this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.itemBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
@@ -44,15 +43,16 @@
this.toolStripButton2 = new System.Windows.Forms.ToolStripButton(); this.toolStripButton2 = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripButton3 = new System.Windows.Forms.ToolStripButton(); this.toolStripButton3 = new System.Windows.Forms.ToolStripButton();
this.itemBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.nameDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.nameDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.lengthDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.lengthDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.quantityDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.quantityDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.totalLengthDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.totalLengthDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.itemBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
this.toolStrip1.SuspendLayout(); this.toolStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.itemBindingSource)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// dataGridView1 // dataGridView1
@@ -82,10 +82,6 @@
this.dataGridView1.Size = new System.Drawing.Size(763, 361); this.dataGridView1.Size = new System.Drawing.Size(763, 361);
this.dataGridView1.TabIndex = 5; this.dataGridView1.TabIndex = 5;
// //
// itemBindingSource
//
this.itemBindingSource.DataSource = typeof(CutToLength.UIItem);
//
// label1 // label1
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
@@ -208,6 +204,10 @@
this.toolStripButton3.Text = "Run"; this.toolStripButton3.Text = "Run";
this.toolStripButton3.Click += new System.EventHandler(this.toolStripButton3_Click); this.toolStripButton3.Click += new System.EventHandler(this.toolStripButton3_Click);
// //
// itemBindingSource
//
this.itemBindingSource.DataSource = typeof(CutToLength.UIItem);
//
// nameDataGridViewTextBoxColumn // nameDataGridViewTextBoxColumn
// //
this.nameDataGridViewTextBoxColumn.DataPropertyName = "Name"; this.nameDataGridViewTextBoxColumn.DataPropertyName = "Name";
@@ -263,11 +263,11 @@
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Cut To Length"; this.Text = "Cut To Length";
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.itemBindingSource)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
this.toolStrip1.ResumeLayout(false); this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout(); this.toolStrip1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.itemBindingSource)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();

View File

@@ -1,29 +1,18 @@
namespace CutToLength using Newtonsoft.Json;
namespace CutToLength
{ {
public class UIItem public class UIItem
{ {
private string name;
public UIItem() public UIItem()
{ {
} }
public string Name public string Name { get; set; }
{
get
{
return string.IsNullOrWhiteSpace(name) ?
GetDefaultName() :
name;
}
set
{
name = value;
}
}
public double Length { get; set; } public double Length { get; set; }
[JsonIgnore]
public double TotalLength public double TotalLength
{ {
get { return Length * Quantity; } get { return Length * Quantity; }