private void differServer_Click(object sender, RoutedEventArgs e) { Server server1 = (sender as System.Windows.Controls.MenuItem).Tag as Server; ServerEditor serverEditor = new ServerEditor(server1); serverEditor.ShowDialog(); if (!serverEditor.wasAccepted) { return; } this.settings.servers.Remove(server1); this.settings.servers.Add(serverEditor.server); System.Windows.Controls.ListViewItem serverItem = this.getServerItem(server1); foreach (ComboBoxItem comboBoxItem in (IEnumerable)this.comboServer.Items) { if (comboBoxItem.Tag == server1) { comboBoxItem.Tag = (object)serverEditor.server; comboBoxItem.Content = (object)serverEditor.server.name; break; } } Server server2 = serverEditor.server; serverItem.Content = (object)server2.name; foreach (FrameworkElement frameworkElement in (IEnumerable)serverItem.ContextMenu.Items) { frameworkElement.Tag = (object)server2; } }
private void btnAddServer_Click(object sender, RoutedEventArgs e) { ServerEditor serverEditor = new ServerEditor(); serverEditor.ShowDialog(); if (!serverEditor.wasAccepted) { return; } this.settings.servers.Add(serverEditor.server); this.addServer(serverEditor.server); }