/*
* Created by SharpDevelop.
* User: allann
* Date: 17-11-2004
* Time: 23:31
*
*/
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Collections;
namespace TouristicRental06
{
///
/// Description of RentBikeForm.
///
public class RentBikeForm : System.Windows.Forms.Form
{
private System.Windows.Forms.Label bikeIdxLbl;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox pasNummerTB;
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.Button RentalBtn;
public RentBikeForm(RentBike master)
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
this.master = master;
}
#region Windows Forms Designer generated code
///
/// 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.
///
private void InitializeComponent() {
this.RentalBtn = new System.Windows.Forms.Button();
this.listBox1 = new System.Windows.Forms.ListBox();
this.pasNummerTB = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.bikeIdxLbl = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// RentalBtn
//
this.RentalBtn.Location = new System.Drawing.Point(168, 288);
this.RentalBtn.Name = "RentalBtn";
this.RentalBtn.TabIndex = 4;
this.RentalBtn.Text = "Ok";
this.RentalBtn.Click += new System.EventHandler(this.RentalBtnClick);
//
// listBox1
//
this.listBox1.Location = new System.Drawing.Point(88, 112);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(184, 108);
this.listBox1.TabIndex = 6;
//
// pasNummerTB
//
this.pasNummerTB.Location = new System.Drawing.Point(112, 16);
this.pasNummerTB.Name = "pasNummerTB";
this.pasNummerTB.TabIndex = 1;
this.pasNummerTB.Text = "";
//
// label1
//
this.label1.Location = new System.Drawing.Point(16, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(80, 16);
this.label1.TabIndex = 0;
this.label1.Text = "Pas nummer : ";
//
// bikeIdxLbl
//
this.bikeIdxLbl.AutoSize = true;
this.bikeIdxLbl.Location = new System.Drawing.Point(24, 56);
this.bikeIdxLbl.Name = "bikeIdxLbl";
this.bikeIdxLbl.Size = new System.Drawing.Size(35, 16);
this.bikeIdxLbl.TabIndex = 2;
this.bikeIdxLbl.Text = "label2";
//
// RentBikeForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 326);
this.Controls.Add(this.listBox1);
this.Controls.Add(this.RentalBtn);
this.Controls.Add(this.bikeIdxLbl);
this.Controls.Add(this.pasNummerTB);
this.Controls.Add(this.label1);
this.Name = "RentBikeForm";
this.Text = "RentBikeForm";
this.ResumeLayout(false);
}
#endregion
void RentalBtnClick(object sender, System.EventArgs e)
{
String rentalId = pasNummerTB.Text;
int idx = listBox1.SelectedIndex;
if (idx == -1) {
idx = 0;
}
Bicycle bicycle = (Bicycle) bicycles[idx];
master.Done(rentalId, bicycle);
this.Hide();
}
public void UpdateList(IList bicycles) {
this.bicycles = bicycles;
foreach(Object o in bicycles){
listBox1.Items.Add(o.ToString());
}
}
private IList bicycles;
private RentBike master;
}
}