Mercurial > repos > IBBoard.WarFoundry.GUI.WinForms
diff FrmSelectSystem.cs @ 24:7c366fe55635
* Fix line terminators
no-open-ticket
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 27 Jun 2009 19:01:59 +0000 |
parents | fb55f9f0865e |
children | f72a3da5059b |
line wrap: on
line diff
--- a/FrmSelectSystem.cs Sat Jun 27 18:20:22 2009 +0000 +++ b/FrmSelectSystem.cs Sat Jun 27 19:01:59 2009 +0000 @@ -1,162 +1,162 @@ -// This file (FrmSelectSystem.cs) is a part of the IBBoard.WarFoundry.GUI.WinForms project and is copyright 2009 IBBoard. -// -// The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL 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.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; } - } - } -} +// This file (FrmSelectSystem.cs) is a part of the IBBoard.WarFoundry.GUI.WinForms project and is copyright 2009 IBBoard. +// +// The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL 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.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; } + } + } +}