|
/*
* Created by SharpDevelop.
* User: andy
* Date: 21/12/2007
* Time: 19:34
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Drawing;
using System.Windows.Forms;
using log4net;
using uk.org.aspellclark.cooksmate.engine;
namespace uk.org.aspellclark.cooksmate
{
/// <summary>
/// <name>DlgAction</name>
/// <namespace>uk.org.aspellclark.todolist</namespace>
/// <version>1.0</version>
/// <author>Andy Aspell-Clark</author>
/// <description>Display a simple about box
/// </description>
/// <history>
/// <historyitem> 1 Jan 2008 1.0 ARAC Initial Version.</historyitem>
/// </history>
/// </summary>
public class DlgAction : System.Windows.Forms.Form
{
// Create a logger for use in this class
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public string buttonSelected = common.gui.Constants.CANCEL_BUTTON;
public ActionStep newStep;
/// <summary>
/// Action Dialog constructor
/// </summary>
public DlgAction()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
}
#region Windows Forms Designer generated code
/// <summary>
/// This method is required for Windows Forms designer support.
/// Do not change the method contents inside the source code editor. The Forms designer might
/// not be able to load this method if it was changed manually.
/// </summary>
private void InitializeComponent() {
this.lblActionName = new System.Windows.Forms.Label();
this.lblMinsDuration = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.btnDone = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.txtName = new System.Windows.Forms.TextBox();
this.txtMinsDuration = new System.Windows.Forms.NumericUpDown();
this.txtWeight = new System.Windows.Forms.NumericUpDown();
this.txtMinsPerKg = new System.Windows.Forms.NumericUpDown();
this.txtMinsStanding = new System.Windows.Forms.NumericUpDown();
this.label3 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.txtMinsDuration)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.txtWeight)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.txtMinsPerKg)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.txtMinsStanding)).BeginInit();
this.SuspendLayout();
//
// lblActionName
//
this.lblActionName.Location = new System.Drawing.Point(12, 11);
this.lblActionName.Name = "lblActionName";
this.lblActionName.Size = new System.Drawing.Size(79, 16);
this.lblActionName.TabIndex = 0;
this.lblActionName.Text = "Name";
//
// lblMinsDuration
//
this.lblMinsDuration.Location = new System.Drawing.Point(12, 36);
this.lblMinsDuration.Name = "lblMinsDuration";
this.lblMinsDuration.Size = new System.Drawing.Size(79, 16);
this.lblMinsDuration.TabIndex = 2;
this.lblMinsDuration.Text = "Mins Duration";
//
// label1
//
this.label1.Location = new System.Drawing.Point(12, 88);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(79, 16);
this.label1.TabIndex = 5;
this.label1.Text = "Mins Per Kg";
//
// label2
//
this.label2.Location = new System.Drawing.Point(12, 62);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(79, 16);
this.label2.TabIndex = 4;
this.label2.Text = "Weight (gms)";
//
// btnDone
//
this.btnDone.Location = new System.Drawing.Point(37, 196);
this.btnDone.Name = "btnDone";
this.btnDone.Size = new System.Drawing.Size(75, 23);
this.btnDone.TabIndex = 8;
this.btnDone.Text = "Done";
this.btnDone.UseVisualStyleBackColor = true;
this.btnDone.Click += new System.EventHandler(this.BtnDoneClick);
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(173, 196);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 9;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.BtnCancelClick);
//
// txtName
//
this.txtName.Location = new System.Drawing.Point(97, 8);
this.txtName.Name = "txtName";
this.txtName.Size = new System.Drawing.Size(195, 20);
this.txtName.TabIndex = 10;
this.txtName.TextChanged += new System.EventHandler(this.TxtNameTextChanged);
//
// txtMinsDuration
//
this.txtMinsDuration.Location = new System.Drawing.Point(97, 34);
this.txtMinsDuration.Name = "txtMinsDuration";
this.txtMinsDuration.Size = new System.Drawing.Size(195, 20);
this.txtMinsDuration.TabIndex = 11;
this.txtMinsDuration.ValueChanged += new System.EventHandler(this.TxtMinsDurationValueChanged);
//
// txtWeight
//
this.txtWeight.Location = new System.Drawing.Point(97, 60);
this.txtWeight.Name = "txtWeight";
this.txtWeight.Size = new System.Drawing.Size(195, 20);
this.txtWeight.TabIndex = 12;
this.txtWeight.ValueChanged += new System.EventHandler(this.TxtWeightValueChanged);
//
// txtMinsPerKg
//
this.txtMinsPerKg.Location = new System.Drawing.Point(97, 86);
this.txtMinsPerKg.Name = "txtMinsPerKg";
this.txtMinsPerKg.Size = new System.Drawing.Size(195, 20);
this.txtMinsPerKg.TabIndex = 13;
this.txtMinsPerKg.ValueChanged += new System.EventHandler(this.TxtMinsPerKgValueChanged);
//
// txtMinsStanding
//
this.txtMinsStanding.Location = new System.Drawing.Point(97, 108);
this.txtMinsStanding.Name = "txtMinsStanding";
this.txtMinsStanding.Size = new System.Drawing.Size(195, 20);
this.txtMinsStanding.TabIndex = 15;
this.txtMinsStanding.ValueChanged += new System.EventHandler(this.TxtMinsStandingValueChanged);
//
// label3
//
this.label3.Location = new System.Drawing.Point(12, 110);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(79, 16);
this.label3.TabIndex = 14;
this.label3.Text = "Mins Standing";
//
// DlgAction
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(304, 237);
this.ControlBox = false;
this.Controls.Add(this.txtMinsStanding);
this.Controls.Add(this.label3);
this.Controls.Add(this.txtMinsPerKg);
this.Controls.Add(this.txtWeight);
this.Controls.Add(this.txtMinsDuration);
this.Controls.Add(this.txtName);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnDone);
this.Controls.Add(this.label1);
this.Controls.Add(this.label2);
this.Controls.Add(this.lblMinsDuration);
this.Controls.Add(this.lblActionName);
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(312, 264);
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(312, 264);
this.Name = "DlgAction";
this.ShowInTaskbar = false;
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.Text = "FillUp";
this.Load += new System.EventHandler(this.DlgActionLoad);
((System.ComponentModel.ISupportInitialize)(this.txtMinsDuration)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtWeight)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtMinsPerKg)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtMinsStanding)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
private System.Windows.Forms.Label label3;
private System.Windows.Forms.NumericUpDown txtMinsStanding;
private System.Windows.Forms.NumericUpDown txtMinsPerKg;
private System.Windows.Forms.NumericUpDown txtWeight;
private System.Windows.Forms.NumericUpDown txtMinsDuration;
private System.Windows.Forms.Label lblActionName;
private System.Windows.Forms.Label lblMinsDuration;
private System.Windows.Forms.TextBox txtName;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnDone;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
#endregion
void DlgActionLoad(object sender, EventArgs e)
{
newStep = new ActionStep();
}
void BtnCancelClick(object sender, EventArgs e)
{
this.buttonSelected = uk.org.aspellclark.common.gui.Constants.CANCEL_BUTTON;
this.Close();
}
void BtnDoneClick(object sender, EventArgs e)
{
this.buttonSelected = uk.org.aspellclark.common.gui.Constants.DONE_BUTTON;
this.Close();
}
private void EnableDisableTxtBoxes()
{
if (txtMinsDuration.Value == 0)
{
txtWeight.Enabled = true;
txtMinsPerKg.Enabled = true;
txtMinsStanding.Enabled = true;
txtMinsDuration.Enabled = false;
txtMinsDuration.Value = 0;
newStep.MinsDuration = 0;
newStep.WeightGrams = Convert.ToInt16(txtWeight.Value);
newStep.MinsPerKilo = Convert.ToInt16(txtMinsPerKg.Value);
newStep.MinsStanding = Convert.ToInt16(txtMinsStanding.Value);
}
else
{
txtWeight.Enabled = false;
txtWeight.Value = 0;
txtMinsPerKg.Enabled = false;
txtMinsPerKg.Value = 0;
txtMinsStanding.Enabled = false;
txtMinsStanding.Value = 0;
txtMinsDuration.Enabled = true;
newStep.MinsDuration = Convert.ToInt16(txtMinsDuration.Value);
newStep.WeightGrams = 0;
newStep.MinsPerKilo = 0;
newStep.MinsStanding = 0;
}
}
void TxtMinsDurationValueChanged(object sender, EventArgs e)
{
EnableDisableTxtBoxes();
}
void TxtWeightValueChanged(object sender, EventArgs e)
{
EnableDisableTxtBoxes();
}
void TxtMinsPerKgValueChanged(object sender, EventArgs e)
{
EnableDisableTxtBoxes();
}
void TxtMinsStandingValueChanged(object sender, EventArgs e)
{
EnableDisableTxtBoxes();
}
void TxtNameTextChanged(object sender, EventArgs e)
{
newStep.Name = txtName.Text;
}
}//class
}//namespace
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.