void Discovery_Connect(DiscoveryCompleteEventArgs e)
        {
            var reference = e.Reference;
            foreach (var warning in reference.Warnings) logger.Warn(warning);
            foreach (var error in reference.Errors) logger.Error(error);

            if (reference.HasErrors)
                logger.Write("Cannot create a connection.");
            else
            {
                logger.Write("Click \"Next\" to continue.");
                SelectButton.IsEnabled = true;

                var reset = string.IsNullOrEmpty(Model.BindingName) ||
                    !reference.Bindings.Any(b => b.Name == Model.BindingName);
                if (reset)
                {
                    Model.BindingName = reference.Bindings.Count > 0
                        ? reference.Bindings[0].Name : "";
                }

                BindingBox.ItemsSource = reference.Bindings.Select(b => b.Name);
                BindingBox.SelectedItem = Model.BindingName;
            }

            RestartButton.IsEnabled = true;
            Progress.IsIndeterminate = false;
            LogBox.ScrollToEnd();

            if (!reference.HasErrors && !reference.HasWarnings)
            {
                SetVisiblePage(2);
            }
        }
        void Discovery_Connect(DiscoveryCompleteEventArgs e)
        {
            var reference = e.Reference;

            foreach (var warning in reference.Warnings)
            {
                logger.Warn(warning);
            }
            foreach (var error in reference.Errors)
            {
                logger.Error(error);
            }

            if (reference.HasErrors)
            {
                logger.Write("Cannot create a connection.");
            }
            else
            {
                logger.Write("Click \"Next\" to continue.");
                SelectButton.IsEnabled = true;

                var reset = string.IsNullOrEmpty(Model.BindingName) ||
                            !reference.Bindings.Any(b => b.Name == Model.BindingName);
                if (reset)
                {
                    Model.BindingName = reference.Bindings.Count > 0
                                                ? reference.Bindings[0].Name : "";
                }

                BindingBox.ItemsSource  = reference.Bindings.Select(b => b.Name);
                BindingBox.SelectedItem = Model.BindingName;
            }

            RestartButton.IsEnabled  = true;
            Progress.IsIndeterminate = false;
            LogBox.ScrollToEnd();

            if (!reference.HasErrors && !reference.HasWarnings)
            {
                SetVisiblePage(2);
            }
        }