Mesen-X/GUI.NET/Forms/NetPlay/frmClientConfig.cs

45 lines
1.1 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
2015-07-03 00:12:02 -04:00
using Mesen.GUI.Config;
namespace Mesen.GUI.Forms.NetPlay
{
public partial class frmClientConfig : BaseConfigForm
{
public frmClientConfig()
{
InitializeComponent();
Entity = ConfigManager.Config.ClientConnectionInfo;
AddBinding("Host", this.txtHost);
AddBinding("Password", this.txtPassword);
AddBinding("Spectator", chkSpectator);
this.txtPort.Text = ConfigManager.Config.ClientConnectionInfo.Port.ToString();
}
protected override void UpdateConfig()
{
((ClientConnectionInfo)Entity).Port = Convert.ToUInt16(this.txtPort.Text);
}
private void Field_TextChanged(object sender, EventArgs e)
{
UInt16 port;
if(!UInt16.TryParse(this.txtPort.Text, out port)) {
this.btnOK.Enabled = false;
} else {
this.btnOK.Enabled = !string.IsNullOrWhiteSpace(this.txtHost.Text);
}
}
}
}