using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TomShane.Neoforce.Controls;
using Omnion.SquadOmegaClient.Networking;
using Omnion.SquadOmega.Shared.Diagnostic;
using Omnion.SquadOmega.Shared.IO;
using Omnion.SquadOmega.Shared.Networking;
using Omnion.SquadOmega.Shared.Secruity;
namespace Omnion.SquadOmegaClient.MainMenuScreen
{
public class MainMenuWindow : Window
{
private Label usernameL;
private Label passwordL;
private TextBox usernameTB;
private TextBox passwordTB;
private Button loginB;
private Button registerB;
private Button aboutB;
private Button optionsB;
private Button exitB;
private CheckBox rembUsernameCB;
private ConnectingDialog connectDialog;
private RegisterWindow registerWin;
public string Username
{
get
{
return this.usernameTB.Text;
}
}
public byte[] PassHash
{
get
{
return HashUtility.HashString(this.passwordTB.Text);
}
}
public MainMenuWindow(Manager manager)
: base(manager)
{
}
public override void Init()
{
base.Init();
this.Text = "Squad Omega - Main Menu";
this.Width = 300;
this.Height = 400;
this.Resizable = false;
this.Movable = false;
this.CloseButtonVisible = false;
this.Center();
this.InitControls();
}
private void InitControls()
{
this.usernameL = new Label(this.Manager);
this.usernameL.Init();
this.usernameL.Text = "Username : ";
this.usernameL.Ellipsis = false;
this.usernameL.Width += 3;
this.usernameL.Left = Layout.LargeSpace;
this.usernameL.Top = Layout.LargeSpace;
this.usernameL.Parent = this;
this.usernameTB = new TextBox(this.Manager);
this.usernameTB.Init();
this.usernameTB.Left = this.usernameL.Left + this.usernameL.Width + Layout.SmallSpace;
this.usernameTB.Top = this.usernameL.Top;
this.usernameTB.Width = this.ClientWidth - (this.usernameTB.Left + Layout.LargeSpace);
this.usernameTB.Parent = this;
this.passwordL = new Label(this.Manager);
this.passwordL.Init();
this.passwordL.Text = "Password : ";
this.passwordL.Ellipsis = false;
this.passwordL.Left = this.usernameL.Left;
this.passwordL.Top = this.usernameTB.Top + this.usernameTB.Height + Layout.SmallSpace;
this.passwordL.Parent = this;
this.passwordTB = new TextBox(this.Manager);
this.passwordTB.Init();
this.passwordTB.Left = this.usernameTB.Left;
this.passwordTB.Top = this.passwordL.Top;
this.passwordTB.Width = this.usernameTB.Width;
this.passwordTB.Mode = TextBoxMode.Password;
this.passwordTB.Parent = this;
this.rembUsernameCB = new CheckBox(this.Manager);
this.rembUsernameCB.Text = "Remember Username";
this.rembUsernameCB.Left = this.passwordL.Left;
this.rembUsernameCB.Top = this.passwordTB.Top + this.passwordTB.Height + Layout.SmallSpace;
this.rembUsernameCB.Width = this.passwordTB.Width;
this.rembUsernameCB.Parent = this;
this.loginB = new Button(this.Manager);
this.loginB.Init();
this.loginB.Text = "Login";
this.loginB.Left = this.rembUsernameCB.Left;
this.loginB.Top = this.rembUsernameCB.Top + this.rembUsernameCB.Height + Layout.SmallSpace;
this.loginB.Width = this.ClientWidth - (Layout.LargeSpace * 2);
this.loginB.Click += new TomShane.Neoforce.Controls.EventHandler(OnLoginClick);
this.loginB.Parent = this;
this.registerB = new Button(this.Manager);
this.registerB.Init();
this.registerB.Text = "Register";
this.registerB.Left = this.loginB.Left;
this.registerB.Top = this.loginB.Top + this.loginB.Height + Layout.SmallSpace;
this.registerB.Width = this.loginB.Width;
this.registerB.Click += new TomShane.Neoforce.Controls.EventHandler(OnRegisterClick);
this.registerB.Parent = this;
this.aboutB = new Button(this.Manager);
this.aboutB.Init();
this.aboutB.Text = "About";
this.aboutB.Left = this.registerB.Left;
this.aboutB.Top = this.registerB.Top + this.registerB.Height + Layout.SmallSpace;
this.aboutB.Width = this.registerB.Width;
this.aboutB.Click += new TomShane.Neoforce.Controls.EventHandler(OnAboutClick);
this.aboutB.Parent = this;
this.optionsB = new Button(this.Manager);
this.optionsB.Init();
this.optionsB.Text = "Options";
this.optionsB.Left = this.loginB.Left;
this.optionsB.Top = this.aboutB.Top + this.aboutB.Height + Layout.SmallSpace;
this.optionsB.Width = this.aboutB.Width;
this.optionsB.Parent = this;
this.exitB = new Button(this.Manager);
this.exitB.Init();
this.exitB.Text = "Exit";
this.exitB.Left = this.aboutB.Left;
this.exitB.Top = this.optionsB.Top + this.optionsB.Height + Layout.SmallSpace;
this.exitB.Width = this.optionsB.Width;
this.exitB.Click += new TomShane.Neoforce.Controls.EventHandler(OnExitClick);
this.exitB.Parent = this;
this.ClientHeight = this.exitB.Top + this.exitB.Height + Layout.LargeSpace;
this.Center();
}
private void OnLoginClick(object sender, TomShane.Neoforce.Controls.EventArgs e)
{
}
private void OnRegisterClick(object sender, TomShane.Neoforce.Controls.EventArgs e)
{
this.Hide();
this.registerWin = new RegisterWindow(this.Manager, this);
this.registerWin.Init();
this.Manager.Add(this.registerWin);
this.registerWin.Show();
}
private void OnExitClick(object sender, TomShane.Neoforce.Controls.EventArgs e)
{
this.Manager.Game.Exit();
}
}
}