/// <summary>
        /// An event handler called when the primary server has changed.
        /// </summary>
        /// <param name="sender">The sender object.</param>
        /// <param name="e">The event arguments.</param>
        private void OnPrimaryServerChanged(object sender, DbPrimaryServerChangedEventArgs e)
        {
            // Execute the code on the UI thread.
            this.Invoke(() =>
                {
                    // Update the old primary server, if not null.
                    if (null != e.OldPrimary)
                    {
                        if (this.items.ContainsKey(e.OldPrimary.Id))
                        {
                            ServerControls controls = this.items[e.OldPrimary.Id];
                            controls.Item.SubItems[1].Text = "Backup";
                            controls.Node.Text = this.GetServerTreeName(e.OldPrimary);
                        }
                    }

                    // Update the new primary server, if not null.
                    if (null != e.NewPrimary)
                    {
                        if (this.items.ContainsKey(e.NewPrimary.Id))
                        {
                            ServerControls controls = this.items[e.NewPrimary.Id];
                            controls.Item.SubItems[1].Text = "Primary";
                            controls.Node.Text = this.GetServerTreeName(e.NewPrimary);
                        }
                    }

                    // Call the selected item change event to update the buttons.
                    this.OnServerSelectionChanged(this, EventArgs.Empty);

                    // Log the change.
                    this.log.Add(this.crawler.Log.Add(
                        LogEventLevel.Verbose,
                        LogEventType.Information,
                        ControlServersSql.logSource,
                        "Primary database server has changed from \'{0}\' to \'{1}\'.",
                        new object[] {
                            e.OldPrimary != null ? e.OldPrimary.Id.ToString() : string.Empty,
                            e.NewPrimary != null ? e.NewPrimary.Id.ToString() : string.Empty
                        }));
                });
        }
        /// <summary>
        /// An event handler called when the primary server has changed.
        /// </summary>
        /// <param name="sender">The sender object.</param>
        /// <param name="e">The event arguments.</param>
        private void OnPrimaryServerChanged(object sender, DbPrimaryServerChangedEventArgs e)
        {
            // Execute the code on the UI thread.
            this.Invoke(() =>
                {
                    // Update the primary server button enabled state.
                    this.buttonPrimary.Enabled = !this.crawler.Database.Sql.IsPrimary(this.server);

                    // Log the change.
                    this.log.Add(this.crawler.Log.Add(
                        LogEventLevel.Verbose,
                        LogEventType.Information,
                        ControlServerSql.logSource,
                        "Primary database server has changed from \'{0}\' to \'{1}\'.",
                        new object[] {
                            e.OldPrimary != null ? e.OldPrimary.Id.ToString() : string.Empty,
                            e.NewPrimary != null ? e.NewPrimary.Id.ToString() : string.Empty
                        }));
                });
        }