Example #1
0
        private async Task OnWindowLoaded(object arg)
        {
            try
            {
                UserMessage = (EMail == null) ? "Anmelden" : "Registrieren";

                if (!StartService.Connected)
                {
                    await startService.Connect();

                    if (!StartService.Connected)
                    {
                        Result = "Verbindung mit dem Server fehlgeschlagen";
                        StartService.Connected = true;
                        this.FinishInteraction();
                        return;
                    }
                }
                if (EMail == null)
                {
                    await Login(UserName, SecureStringConverter.ConvertToUnsecureString(Password));
                }
                else
                {
                    await Register(UserName, SecureStringConverter.ConvertToUnsecureString(Password), EMail);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Result = "Verbindung mit dem Server fehlgeschlagen";
                this.FinishInteraction();
            }
        }
Example #2
0
        private bool CanLogin(object arg)
        {
            IHavePassword passwordContainer = arg as IHavePassword;

            if (passwordContainer != null)
            {
                string unsecureString = SecureStringConverter.ConvertToUnsecureString(passwordContainer.Password);
                if (!string.IsNullOrWhiteSpace(UserName) && !string.IsNullOrWhiteSpace(unsecureString))
                {
                    Message = string.Empty;
                    return(true);
                }
                else
                {
                    Message = "Füllen sie alle Felder aus";
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }