partial void OnContinue(MonoMac.Foundation.NSObject sender)
        {
            ServerCredentials credentials = new ServerCredentials()
            {
                UserName = UserText.StringValue,
                Password = PasswordText.StringValue,
                Address  = new Uri(AddressText.StringValue),
                Binding  = (this.Controller.saved_binding == null) ? ServerCredentials.BindingBrowser : this.Controller.saved_binding
            };

            WarnText.StringValue   = string.Empty;
            AddressText.Enabled    = false;
            UserText.Enabled       = false;
            PasswordText.Enabled   = false;
            ContinueButton.Enabled = false;
            CancelButton.Enabled   = false;
            //  monomac bug: animation GUI effect will cause GUI to hang, when backend thread is busy
//            LoginProgress.StartAnimation(this);
            Thread check = new Thread(() => {
                var result = SetupController.GetRepositories(credentials);
                if (result.Repositories != null)
                {
                    this.Controller.repositories = result.Repositories.WithoutHiddenOnce();
                }
                else
                {
                    this.Controller.repositories = null;
                }

                InvokeOnMainThread(delegate {
                    if (this.Controller.repositories == null)
                    {
                        AddressText.StringValue = result.Credentials.Address.ToString();
                        WarnText.StringValue    = this.Controller.GetConnectionsProblemWarning(result.FailedException);
                        AddressText.Enabled     = true;
                        UserText.Enabled        = true;
                        PasswordText.Enabled    = true;
                        ContinueButton.Enabled  = true;
                        CancelButton.Enabled    = true;
                    }
                    else
                    {
                        RemoveEvent();
                        Controller.Add1PageCompleted(result.Credentials.Address, result.Credentials.Binding, credentials.UserName, credentials.Password.ToString());
                    }

                    LoginProgress.StopAnimation(this);
                });
            });

            check.Start();
        }
Ejemplo n.º 2
0
        partial void OnContinue(MonoMac.Foundation.NSObject sender)
        {
            ServerCredentials credentials = new ServerCredentials()
            {
                UserName = UserText.StringValue,
                Password = PasswordText.StringValue,
                Address  = new Uri(AddressText.StringValue)
            };

            WarnText.StringValue   = String.Empty;
            AddressText.Enabled    = false;
            UserText.Enabled       = false;
            PasswordText.Enabled   = false;
            ContinueButton.Enabled = false;
            CancelButton.Enabled   = false;
            //  monomac bug: animation GUI effect will cause GUI to hang, when backend thread is busy
//            LoginProgress.StartAnimation(this);
            Thread check = new Thread(() => {
                Tuple <CmisServer, Exception> fuzzyResult = CmisUtils.GetRepositoriesFuzzy(credentials);
                CmisServer cmisServer = fuzzyResult.Item1;
                if (cmisServer != null)
                {
                    Controller.repositories = cmisServer.Repositories;
                }
                else
                {
                    Controller.repositories = null;
                }
                InvokeOnMainThread(delegate {
                    if (Controller.repositories == null)
                    {
                        WarnText.StringValue   = Controller.GetConnectionsProblemWarning(fuzzyResult.Item1, fuzzyResult.Item2);
                        AddressText.Enabled    = true;
                        UserText.Enabled       = true;
                        PasswordText.Enabled   = true;
                        ContinueButton.Enabled = true;
                        CancelButton.Enabled   = true;
                    }
                    else
                    {
                        RemoveEvent();
                        Controller.Add1PageCompleted(cmisServer.Url, credentials.UserName, credentials.Password.ToString());
                    }
                    LoginProgress.StopAnimation(this);
                });
            });

            check.Start();
        }