Exemplo n.º 1
0
        void Connect()
        {
            SelectButton.IsEnabled   = false;
            RestartButton.IsEnabled  = false;
            Progress.IsIndeterminate = true;

            if (!worker.Busy)
            {
                logger.Clear();
                logger.Write("Connecting to " + Model.Uri);

                NetworkCredential cred = CredentialCache.DefaultNetworkCredentials;

                var isBasicAuth = useBasicAuth.IsChecked == true;
                if (isBasicAuth)
                {
                    var cred2 = new NetworkCredential()
                    {
                        UserName = loginName.Text.Trim(),
                        Password = password.Password.Trim()
                    };
                    cred = cred2.GetCredential(new Uri(Model.Uri), "Basic");
                }
                worker
                .Failure(Discovery_Failure)
                .Complete(Discovery_Connect)
                .Connect(Model.Uri, cred, isBasicAuth);
            }
        }
Exemplo n.º 2
0
        void Connect()
        {
            SelectButton.IsEnabled   = false;
            RestartButton.IsEnabled  = false;
            Progress.IsIndeterminate = true;

            if (!worker.Busy)
            {
                logger.Clear();
                logger.Write("Connecting to " + Model.Uri);

                worker
                .Failure(Discovery_Failure)
                .Complete(Discovery_Connect)
                .Connect(Model.Uri, CredentialCache.DefaultCredentials);
            }
        }