public ControlBox() { instance = this; InitializeComponent(); formTitle = AssemblyTitle + " Configuration"; //Add XML servers config = XmlHandler.Deserialize(); //not interfering with anything the server might use. for (int i = 0; i < config.ServerList.Count; i++) { // Read from config and fill in the provided info int outerHeight = GBServer.outerHeight; //20 + (GBServer.innerHeight * 4) + 40; int y = i * outerHeight; //outer y offset GBServer server = new GBServer(i, config.ServerList[i].Name, config.ServerList[i].FilePath, config.ServerList[i].AllowInput); server.SetLocation(0, y); ListServerBox.Add(server); ServerBox.Controls.Add(server.gbServer); } UpdateScrollHeight(); this.Text = MCDaemon.ControlBox.Instance.formTitle; toolTip1.SetToolTip(this.buttonAdd, "Add server"); toolTip1.SetToolTip(this.buttonApply, "Save config"); TbHost.Text = config.Host; NumPort.Value = config.Port; TbHost.TextChanged += GBServer.Config_Changed; NumPort.ValueChanged += GBServer.Config_Changed; }
private void ControlBox_FormClosing(object sender, FormClosingEventArgs e) { instance = null; //Force reloading form and config from file }