private void optionsToolStripMenuItem_Click(object sender, EventArgs e) { var window = new OptionsWindow(); if (Server != null) { SetText(window, "tbModSicAddr", Server.Address); SetText(window, "tbModSicUser", Server.Username); SetText(window, "tbModSicPass", Server.Password); SetText(window, "tbModSicPort", Server.Port); } window.Icon = this.Icon; if (window.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { Server.Address = GetText(window, "tbModSicAddr"); Server.Username = GetText(window, "tbModSicUser"); Server.Password = GetText(window, "tbModSicPass"); Server.Port = GetText(window, "tbModSicPort"); } }
private void SetText(OptionsWindow window, string name, string text) { var control = window.Controls.Find(name, true).First() as TextBox; control.Text = text; }
private string GetText(OptionsWindow window, string name) { var control = window.Controls.Find(name, true).First() as TextBox; return(control.Text); }
private void optionsToolStripMenuItem_Click(object sender, EventArgs e) { var window = new OptionsWindow(); if (Server != null) { SetText(window, "tbModSicAddr", Server.Address); SetText(window, "tbModSicUser", Server.Username); SetText(window, "tbModSicPass", Server.Password); SetText(window, "tbModSicPort", Server.Port); } window.Icon = this.Icon; if (window.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { Server.Address = GetText(window, "tbModSicAddr"); Server.Username = GetText(window, "tbModSicUser"); Server.Password = GetText(window, "tbModSicPass"); Server.Port = GetText(window, "tbModSicPort"); } }
private void SetText(OptionsWindow window, string name, string text) { var control = window.Controls.Find(name, true).First() as TextBox; control.Text = text; }
private string GetText(OptionsWindow window, string name) { var control = window.Controls.Find(name, true).First() as TextBox; return control.Text; }