private void btnAdd_Click(object sender, EventArgs e) { using (var dialog = new NewServerDialog()) { if (dialog.ShowDialog() == DialogResult.OK) { var setting = new Setting { Name = dialog.ServerName, Path = dialog.Path, Port = dialog.Port }; _settingStorage.Add(setting); AddServer(setting); } } }
private void Item_OnUpdate(WebListItem sender) { using (var dialog = new NewServerDialog(sender.Setting)) { if (dialog.ShowDialog() == DialogResult.OK) { var setting = new Setting { Name = dialog.ServerName, Path = dialog.Path, Port = dialog.Port }; if (_settingStorage.Update(setting)) { sender.UpdateSetting(setting); } } } }