Example #1
0
        private void OnSignIn()
        {
            _synoSettings.UserName = UserName;
            _synoSettings.Password = Password;
            _synoSettings.UseSsl   = UseSsl;
            // FIXME : detect or ask version
            _synoSettings.DsmVersion = DsmVersions.V4_0;
            _synoSettings.Host       = Host;
            _synoSettings.Port       = Port;

            // NOTE - is it still needed here, since we do a check cached token validity async just after ?
            var formatValidity = _synoSettings.IsCredentialFormatValid();

            if (formatValidity != CredentialFormatValidationResult.Valid)
            {
                _signInService.ShowCredentialErrorMessage(formatValidity);
                return;
            }

            // FIXME : we should use the SignIn method of the signInService, so we don't duplicate the logic !
            _signInService.CheckTokenValidityCompleted += OnCheckTokenValidityCompleted;


            // result of the following call is returned asynchronously as an event in which the actual log-in will take place if needed.

            _signInService.CheckCachedTokenValidityAsync();
        }