Mercurial > repos > IBBoard.WarFoundry.GUI.WinForms
view FrmSelectSystem.cs @ 37:c07d3b982129
Re #121: Move all code to AGPL
* Add Affero license file and remove old LGPL stuff
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 15 Aug 2009 10:15:43 +0000 |
parents | 6ab7ddc038f9 |
children | 1576f669b3eb |
line wrap: on
line source
// This file (FrmSelectSystem.cs) is a part of the IBBoard.WarFoundry.GUI.WinForms project and is copyright 2007, 2008, 2009 IBBoard. // // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. using System; using System.IO; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using IBBoard; using IBBoard.Lang; using IBBoard.WarFoundry.API; using IBBoard.Windows.Forms; using IBBoard.WarFoundry.API.Objects; using IBBoard.Windows.Forms.I18N; namespace IBBoard.WarFoundry { /// <summary> /// Summary description for FrmSelectSystem. /// </summary> public class FrmSelectSystem : IBBoard.Windows.Forms.IBBForm { private System.Windows.Forms.ListBox lstSystems; private IBBoard.Windows.Forms.IBBLabel lblSystemList; /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.Container components = null; private IBBoard.Windows.Forms.IBBButton bttnCancel; private IBBoard.Windows.Forms.IBBButton bttnSelectSystem; private GameSystem selectedSystem; public FrmSelectSystem() { // // Required for Windows Form Designer support // InitializeComponent(); ControlTranslator.TranslateControl(this); lstSystems.Items.Clear(); GameSystem[] systems = WarFoundryLoader.GetDefault().GetGameSystems(); lstSystems.DataSource = systems; lstSystems.DisplayMember = "Name"; } /// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); } #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.lstSystems = new System.Windows.Forms.ListBox(); this.bttnSelectSystem = new IBBoard.Windows.Forms.IBBButton(); this.lblSystemList = new IBBoard.Windows.Forms.IBBLabel(); this.bttnCancel = new IBBoard.Windows.Forms.IBBButton(); this.SuspendLayout(); // // lstSystems // this.lstSystems.Location = new System.Drawing.Point(80, 8); this.lstSystems.Name = "lstSystems"; this.lstSystems.Size = new System.Drawing.Size(216, 95); this.lstSystems.TabIndex = 0; this.lstSystems.DoubleClick += new System.EventHandler(this.lstSystems_DoubleClick); this.lstSystems.SelectedIndexChanged += new System.EventHandler(this.lstSystems_SelectedIndexChanged); // // bttnSelectSystem // this.bttnSelectSystem.Enabled = false; this.bttnSelectSystem.FlatStyle = System.Windows.Forms.FlatStyle.System; this.bttnSelectSystem.Location = new System.Drawing.Point(192, 112); this.bttnSelectSystem.Name = "bttnSelectSystem"; this.bttnSelectSystem.Size = new System.Drawing.Size(104, 24); this.bttnSelectSystem.TabIndex = 1; this.bttnSelectSystem.Text = "Select system"; this.bttnSelectSystem.Click += new System.EventHandler(this.bttnSelectSystem_Click); // // lblSystemList // this.lblSystemList.Location = new System.Drawing.Point(0, 8); this.lblSystemList.Name = "lblSystemList"; this.lblSystemList.Size = new System.Drawing.Size(80, 80); this.lblSystemList.TabIndex = 2; this.lblSystemList.Text = "system list"; this.lblSystemList.TextAlign = System.Drawing.ContentAlignment.TopRight; // // bttnCancel // this.bttnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.bttnCancel.FlatStyle = System.Windows.Forms.FlatStyle.System; this.bttnCancel.Location = new System.Drawing.Point(8, 112); this.bttnCancel.Name = "bttnCancel"; this.bttnCancel.Size = new System.Drawing.Size(80, 24); this.bttnCancel.TabIndex = 3; this.bttnCancel.Text = "Cancel"; this.bttnCancel.Click += new System.EventHandler(this.bttnCancel_Click); // // FrmSelectSystem // this.AcceptButton = this.bttnSelectSystem; this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.CancelButton = this.bttnCancel; this.ClientSize = new System.Drawing.Size(306, 142); this.ControlBox = false; this.Controls.Add(this.bttnCancel); this.Controls.Add(this.lblSystemList); this.Controls.Add(this.bttnSelectSystem); this.Controls.Add(this.lstSystems); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Name = "FrmSelectSystem"; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "FrmSelectSystem"; this.ResumeLayout(false); } #endregion private void lstSystems_SelectedIndexChanged(object sender, System.EventArgs e) { bttnSelectSystem.Enabled = (lstSystems.SelectedIndex>-1); } private void bttnSelectSystem_Click(object sender, System.EventArgs e) { selectedSystem = (GameSystem) lstSystems.SelectedItem; this.DialogResult = DialogResult.OK; this.Close(); } private void bttnCancel_Click(object sender, System.EventArgs e) { this.DialogResult = DialogResult.Cancel; this.Close(); } public GameSystem GameSystem { get { return selectedSystem; } } private void lstSystems_DoubleClick(object sender, EventArgs e) { bttnSelectSystem_Click(null, null); } } }