|
// Resort Companion Mobile Edition
// Copyright (c) 2004 Wolf Logan
using System;
using System.Drawing;
using System.Windows.Forms;
using org.CircleCross.ResortCompanion.Data;
namespace org.CircleCross.ResortCompanion.Mobile {
/// <summary>
/// detail view for transport records
/// </summary>
public class TransportDetail: DetailView {
private TextBox departuresBox;
private Label departuresLabel;
private ListBox connectionsList;
private Label connectionsLabel;
public override Type TargetType {
get {
return typeof(TransportPlaceRecord);
}
}
public override string TargetLabel {
get {
return "Transportation";
}
}
private TransportPlaceRecord transportPlace {
get {
return (TransportPlaceRecord)place;
}
}
public override event EventHandler SelectedIndexChanged;
public TransportDetail(): base() {
this.departuresBox = new TextBox();
this.departuresBox.Parent = this;
this.departuresLabel = new Label();
this.departuresLabel.Parent = this;
this.connectionsList = new ListBox();
this.connectionsList.Parent = this;
this.connectionsLabel = new Label();
this.connectionsLabel.Parent = this;
this.departuresBox.Bounds = new Rectangle(4, 20, 224, 44);
this.departuresBox.Multiline = true;
this.departuresLabel.Bounds = new Rectangle(4, 4, 176, 16);
this.departuresLabel.Text = "Departures from this station:";
this.connectionsList.DisplayMember = "Name";
this.connectionsList.Bounds = new Rectangle(4, 88, 224, 58);
this.connectionsList.ValueMember = "Name";
this.connectionsList.SelectedIndexChanged += new System.EventHandler(this.connectionsList_SelectedIndexChanged);
this.connectionsLabel.Bounds = new Rectangle(4, 72, 104, 16);
this.connectionsLabel.Text = "Connected Stops:";
}
protected override void bindData() {
this.connectionsList.Items.Clear();
foreach(PlaceRecord p in this.transportPlace.Connections) {
this.connectionsList.Items.Add(p);
}
this.departuresBox.Text = this.transportPlace.Departures;
}
private void connectionsList_SelectedIndexChanged(Object sender, EventArgs e) {
// when an item is selected in the connections list, make that item the selected
// place, and notify any interested parties by triggering an event
this.selectedPlace = (PlaceRecord)connectionsList.SelectedItem;
this.SelectedIndexChanged(this, e);
}
}
}
|
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.