public NetworkWrapper( NetworkConfiguration networkConfig )
 {
     NetworkConfiguration = networkConfig;
     try {
         Servers = new Collection<ServerWrapper>( networkConfig.Servers.Select( _ => new ServerWrapper( _ ) ).ToList( ) );
     }
     catch ( Exception e ) {
         Debug.Print( "NetworkWrapper.`ctor: caught exception:\n{0}", e );
     }
 }
        //
        // Private methods
        //
        private ConfigurationRoot MakeUpConfiguration( )
        {
            var conf = new ConfigurationRoot( );

            var foonetic = new NetworkConfiguration {
                Name = "Foonetic",
                Description = "The IRC network where #xkcd can be found. ;3"
            };
            var freenode = new NetworkConfiguration {
                Name = "Freenode",
                Description = "lilo's network. I still miss him. =("
            };
            var testnet = new NetworkConfiguration {
                Name = "TestNet",
                Description = "My local testing network.",
            };
            var undernet = new NetworkConfiguration {
                Name = "Undernet",
                Description = "My very first IRC network, I started hanging out there before there were 500 simultaneous users network-wide."
            };

            var belayFooneticNet = new ServerConfiguration {
                Name = "Foonetic: US, NJ, Newark: belay.foonetic.net",
                Description = "zigdon's IRC server, hosted in Newark, NJ.",
                HostName = "belay.foonetic.net",
                Ports = new Collection<int> {
                    -7001, -6697, 7000, 6669, 6668, 6667,
                },
            };
            var ircFreenodeNet = new ServerConfiguration {
                Name = "Freenode: Round-robin: irc.freenode.net",
                Description = "Round robin hostname for Freenode.",
                HostName = "irc.freenode.net",
                Ports = new Collection<int> {
                    -6697, 6667,
                },
            };
            var ircUndernetOrg = new ServerConfiguration {
                Name = "Undernet: Round-robin: irc.undernet.org",
                Description = "Round robin hostname for Undernet.",
                HostName = "irc.undernet.org",
                Ports = new Collection<int> {
                    6667,
                },
            };
            var violetZiveCa = new ServerConfiguration {
                Name = "Zive: Charybdis/Atheme test: violet.zive.ca",
                Description = "Test Charybdis/Atheme server+services on violet.zive.ca.",
                HostName = "violet.zive.ca",
                Ports = new Collection<int> {
                    -6698, 6668
                },
            };

            foonetic.Servers.Add( belayFooneticNet );
            belayFooneticNet.Network = foonetic;

            freenode.Servers.Add( ircFreenodeNet );
            ircFreenodeNet.Network = freenode;

            testnet.Servers.Add( violetZiveCa );
            violetZiveCa.Network = testnet;

            undernet.Servers.Add( ircUndernetOrg );
            ircUndernetOrg.Network = undernet;

            conf.Networks.Add( foonetic );
            conf.Networks.Add( freenode );
            conf.Networks.Add( testnet );
            conf.Networks.Add( undernet );

            conf.Servers.Add( belayFooneticNet );
            conf.Servers.Add( ircFreenodeNet );
            conf.Servers.Add( ircUndernetOrg );
            conf.Servers.Add( violetZiveCa );

            conf.UserConfiguration = new UserConfiguration {
                NickName = "ZiveIrcTest",
                UserName = "******",
                RealName = "Testing instance of ZiveIrc. Contact: IceKarma",
            };

            #if DEBUG
            conf.DebuggingConfiguration.ShowDebuggingOutputInConsoleTab = true;
            #endif

            return conf;
        }
 private void Close_Executed( object sender, ExecutedRoutedEventArgs ev )
 {
     Result = NetworkListView.SelectedItem as NetworkConfiguration;
     DialogResult = ( Result != null );
     Close( );
 }