Example #1
0
 /// <summary>
 /// Handles the Click event of the btnNewServer control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
 private void btnNewServer_Click(object sender, RoutedEventArgs e)
 {
     var window = new EditServerWindow();
     if (window.ShowDialog() == true)
     {
         this.Servers.Add(
             new Server()
             {
                 Name = window.ServerName,
                 Address = window.ServerAddress
             });
     }
 }
Example #2
0
        /// <summary>
        /// Handles the Click event of the btnEditServer control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">
        ///   The <see cref="RoutedEventArgs" />
        ///   instance containing the event data.
        /// </param>
        private void btnEditServer_Click(object sender, RoutedEventArgs e)
        {
            var server = this.lvServers.SelectedItem as Server;
            if (server != null)
            {
                var window = new EditServerWindow();
                window.ServerName = server.Name;
                window.ServerAddress = server.Address;

                if (window.ShowDialog() == true)
                {
                    server.Name = window.ServerName;
                    server.Address = window.ServerAddress;
                    this.lvServers.ItemsSource = null;
                    this.lvServers.ItemsSource = this.Servers;
                }
            }
        }