Beispiel #1
0
        private async void Login()
        {
            IsBusy = true;

            if (IsConnected && CanLogin)
            {
                string token = await tokenService.GetToken(Username, Password);

                if (!string.IsNullOrWhiteSpace(token))
                {
                    authenticatingMessageInspector.Bearer = token;

                    credentialDTO credentialDTO = await Task.Run(() => credentialSoapClient.my());

                    if (!(credentialDTO is null) && !string.IsNullOrWhiteSpace(credentialDTO.id))
                    {
                        if (!Device.WPF.Equals(Device.RuntimePlatform))
                        {
                            Preferences.Set("username", Username);
                            Preferences.Set("password", Password);
                        }

                        IsLogged = true;
                    }
                }
            }

            IsBusy = false;
        }
        private async void LoginAsync()
        {
            IsBusy = true;

            if (IsConnected && CanLogin)
            {
                string token = await tokenService.GetToken(Username, new System.Net.NetworkCredential(string.Empty, Password).Password);

                if (!string.IsNullOrWhiteSpace(token))
                {
                    authenticatingMessageInspector.Bearer = token;

                    credentialDTO credentialDTO = credentialSoapClient.my();

                    if (!(credentialDTO is null) && !string.IsNullOrWhiteSpace(credentialDTO.id))
                    {
                        IsLogged = true;
                    }
                }
            }


            IsBusy = false;
        }