예제 #1
0
            private async void TestValue()
            {
                var testN = ++_testN;

                if (string.IsNullOrWhiteSpace(Value))
                {
                    IsValueAcceptable  = true;
                    CheckingInProgress = false;
                    return;
                }

                CheckingInProgress         = true;
                InternetConnectionRequired = false;

                await Task.Delay(50);

                if (testN != _testN)
                {
                    return;
                }

                var value = await InternalUtils.CheckKeyAsync(Value, CmApiProvider.UserAgent);

                if (testN != _testN)
                {
                    return;
                }

                CheckingInProgress = false;

                if (value.HasValue || OptionOfflineMode)
                {
                    IsValueAcceptable = value ?? true;
                }
                else
                {
                    InternetConnectionRequired = true;
                    IsValueAcceptable          = false;

                    if (_attemptsCounter == 1)
                    {
                        OfflineModeAvailable = true;
                    }
                }
            }