Пример #1
0
        private async void Login(string username, string password)
        {
            var authorization = new LocalBoxAuthorization(PleioUrl);

            var result = await authorization.Authorize(username, password);

            if (result)
            {
                var business = new BusinessLayer();

                if (DataLayer.Instance.GetLocalBoxesSync().Count == 0)
                {
                    await business.RegisterLocalBox(PleioUrl);
                }

                var activity = (HomeActivity)Activity;
                activity.HideLoginDialog();
                activity.menuFragment.UpdateLocalBoxes();

                Toast.MakeText(Activity, "Ingelogd.", ToastLength.Short).Show();
            }
            else
            {
                Toast.MakeText(Activity, "Gebruikersnaam en wachtwoord combinatie is ongeldig.", ToastLength.Short).Show();
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            ActivityIndicator.Hidden = true;

            // Perform any additional setup after loading the view, typically from a nib.
            LoginButton.TouchUpInside += async(s, e) => {
                LoginButton.Hidden       = true;
                ActivityIndicator.Hidden = false;
                ActivityIndicator.StartAnimating();

                var authorization = new LocalBoxAuthorization(PleioUrl);

                var result = await authorization.Authorize(LoginField.Text, PasswordField.Text);

                if (result)
                {
                    var business = new BusinessLayer();

                    if (DataLayer.Instance.GetLocalBoxesSync().Count == 0)
                    {
                        await business.RegisterLocalBox(PleioUrl);

                        this._home.InitialiseMenuAfterRegistration();
                    }

                    this.View.RemoveFromSuperview();

                    // show (second) site-selection screen
                    if (_introduction)
                    {
                        var sites = new AddSitesViewController(_home, true);
                        sites.View.BackgroundColor = UIColor.FromRGB(14, 94, 167);
                        _home.View.Add(sites.View);
                        _home.AddChildViewController(sites);
                    }
                }
                else
                {
                    LoginButton.Hidden       = false;
                    ActivityIndicator.Hidden = true;
                    ActivityIndicator.StopAnimating();

                    var alert = UIAlertController.Create("Fout", "Gebruikersnaam of wachtwoord is onjuist.", UIAlertControllerStyle.Alert);
                    alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Cancel, null));
                    PresentViewController(alert, animated: true, completionHandler: null);
                }
            };
        }
Пример #3
0
		public RemoteExplorer ()
		{
			_localBox = DataLayer.Instance.GetSelectedOrDefaultBox ();
			_authorization = new LocalBoxAuthorization (_localBox);

			if(_localBox.OriginalServerCertificate != null && SslValidator.CertificateErrorRaised == false){ //Selected localbox does have a ssl certificate

				//Set ssl validator for selected LocalBox
				SslValidator sslValidator = new SslValidator (_localBox);
				ServicePointManager.ServerCertificateValidationCallback = sslValidator.ValidateServerCertficate;
			}else {
				ServicePointManager.ServerCertificateValidationCallback = (p1, p2, p3, p4) => true;
			}
		}
Пример #4
0
        public RemoteExplorer()
        {
            _localBox      = DataLayer.Instance.GetSelectedOrDefaultBox();
            _authorization = new LocalBoxAuthorization(_localBox);

            if (_localBox.OriginalServerCertificate != null && SslValidator.CertificateErrorRaised == false)             //Selected localbox does have a ssl certificate

            //Set ssl validator for selected LocalBox
            {
                SslValidator sslValidator = new SslValidator(_localBox);
                ServicePointManager.ServerCertificateValidationCallback = sslValidator.ValidateServerCertficate;
            }
            else
            {
                ServicePointManager.ServerCertificateValidationCallback = (p1, p2, p3, p4) => true;
            }
        }
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			ActivityIndicator.Hidden = true;

			// Perform any additional setup after loading the view, typically from a nib.
			LoginButton.TouchUpInside += async (s, e) => {
				LoginButton.Hidden = true;
				ActivityIndicator.Hidden = false;
				ActivityIndicator.StartAnimating();

				var authorization = new LocalBoxAuthorization(PleioUrl);

				var result = await authorization.Authorize(LoginField.Text, PasswordField.Text); 
				if (result) {
					var business = new BusinessLayer();

					if (DataLayer.Instance.GetLocalBoxesSync ().Count  == 0) {
						await business.RegisterLocalBox(PleioUrl);

						this._home.InitialiseMenuAfterRegistration();
					}

					this.View.RemoveFromSuperview();

					// show (second) site-selection screen
					if (_introduction) {
						var sites = new AddSitesViewController (_home, true);
						sites.View.BackgroundColor = UIColor.FromRGB(14, 94, 167);
						_home.View.Add(sites.View);
						_home.AddChildViewController(sites);
					}

				} else {
					LoginButton.Hidden = false;
					ActivityIndicator.Hidden = true;
					ActivityIndicator.StopAnimating();

					var alert = UIAlertController.Create("Fout", "Gebruikersnaam of wachtwoord is onjuist.", UIAlertControllerStyle.Alert);
					alert.AddAction (UIAlertAction.Create ("Ok", UIAlertActionStyle.Cancel, null));
					PresentViewController(alert, animated: true, completionHandler: null);
				}
			};
		}
Пример #6
0
		private async void Login (string username, string password)
		{
			var authorization = new LocalBoxAuthorization (PleioUrl);

			var result = await authorization.Authorize (username, password);
			if (result) {
				var business = new BusinessLayer();

				if (DataLayer.Instance.GetLocalBoxesSync ().Count == 0) {
					await business.RegisterLocalBox (PleioUrl);
				}

				var activity = (HomeActivity) Activity;
				activity.HideLoginDialog ();
				activity.menuFragment.UpdateLocalBoxes ();

				Toast.MakeText (Activity, "Ingelogd.", ToastLength.Short).Show ();
			} else {
				Toast.MakeText (Activity, "Gebruikersnaam en wachtwoord combinatie is ongeldig.", ToastLength.Short).Show ();
			}
		}
Пример #7
0
 public RemoteExplorer(LocalBox box)
 {
     _localBox      = box;
     _authorization = new LocalBoxAuthorization(box);
 }
Пример #8
0
		public RemoteExplorer (LocalBox box)
		{
			_localBox = box;
			_authorization = new LocalBoxAuthorization(box);
		}