public ClientForm() { InitializeComponent(); UserInput.SetCueBanner("Username"); PassInput.SetCueBanner("Password"); PicInput.SetCueBanner("PIC"); CharInput.SetCueBanner("Character"); PacketInput.SetCueBanner("Enter packet to send..."); DelayInput.SetCueBanner("Delay"); InitializeProgress(); client = new Client(this); PacketView.SetInput(PacketInput); RushView.SetClient(client); FmFunctions = new FreeMarketForm(this); #if DEBUG /*Use this for testing account * username.Text = ""; * password.Text = ""; * pic.Text = ""; * character.Text = ""; * world.SelectedIndex = 0; * channel.SelectedIndex = 0;*/ #endif InitializeAccount(); }
private void InitializeProgress() { ConnectToggle = new Progress <bool>(b => { ConnectBtn.Text = b ? "Connect" : "Disconnect"; UserInput.Enabled = b; PassInput.Enabled = b; PicInput.Enabled = b; CharInput.Enabled = b; SelectList.Enabled = b; WorldList.Enabled = b; ChannelList.Enabled = b; ModeList.Enabled = b; UpTimer.Enabled = !b; uptime = new DateTime(); // reset time after disconnect? }); /* Writers */ WriteLog = new Progress <string>(s => LogText.AppendText(s + Environment.NewLine)); WriteSend = PacketView.WriteSend; WriteRecv = PacketView.WriteRecv; /* Stats */ UpdateMapler = new Progress <Mapler>(m => { if (m != null) { NameStat.Text = m.Name; MapStat.Text = m.Map.ToString(); LevelStat.Text = m.Level.ToString(); ExpStatus.Text = (decimal.Divide(m.Exp, Resources.Exp.PlayerExp[m.Level]) * 100).ToString("F") + '%'; RushView.Update(m.Map); } else { NameStat.Text = "Unknown"; MapStat.Text = "-1"; LevelStat.Text = "-1"; ExpStatus.Text = "-1"; //Just going to leave this here... :D ItemsStatus.Text = "-1"; PeopleStatus.Text = "Not Active"; } }); UpdateMesos = new Progress <long>(d => MesoStatus.Text = d.ToString()); UpdateCh = new Progress <byte>(d => ChannelStat.Text = d.ToString()); UpdateItems = new Progress <int>(d => ItemsStatus.Text = d.ToString()); UpdatePeople = new Progress <int>(d => PeopleStatus.Text = d.ToString()); }