Exemplo n.º 1
0
        public ServiceEditViewModel(INetworkProviderPrivate provider)
        {
            DeleteCommand = new RelayCommand(Delete);
            _debouncer    = new Debouncer();
            Service       = provider;
            Configuration = Service.GetApiConfiguration;

            if (Configuration == null)
            {
                throw new ArgumentException("No API Configuration object for " + Service.GetType());
            }

            UserKey = UserContext.Current.GetApiKey(Service);

            if (UserKey != null)
            {
                _apiKey    = UserKey.Key;
                _apiSecret = UserKey.Secret;
                _apiExtra1 = UserKey.Extra;
                _apiName   = UserKey.Name;
                DecideTest(1);
            }
            else
            {
                _apiName      = Service.Title;
                _initialCheck = false;
            }

            this.PropertyChanged += ServiceEditViewModel_PropertyChanged;
        }
Exemplo n.º 2
0
        private void TestApiPrivate(INetworkProviderPrivate provider)
        {
            var ctx = new ApiPrivateTestContext(UserContext.Current.GetApiKey(provider));

            var r = AsyncContext.Run(() => provider.TestPrivateApiAsync(ctx));

            Assert.IsTrue(r);
        }
Exemplo n.º 3
0
        private void TestApi(INetworkProviderPrivate provider)
        {
            var ctx = new ApiPrivateTestContext(UserContext.Current.GetApiKey(provider));

            try
            {
                var r = AsyncContext.Run(() => provider.TestPrivateApiAsync(ctx));
                Assert.IsTrue(r);
            }
            catch (Exception e)
            {
                Assert.Fail(e.Message);
            }
        }
Exemplo n.º 4
0
 public static Task <ApiResponse <bool> > TestApiAsync(INetworkProviderPrivate provider, ApiPrivateTestContext context)
 {
     return(ApiHelpers.WrapExceptionAsync(() => provider.TestPrivateApiAsync(context), nameof(TestApi), provider, context));
 }
Exemplo n.º 5
0
 public static ApiResponse <bool> TestApi(INetworkProviderPrivate provider, ApiPrivateTestContext context)
 {
     return(AsyncContext.Run(() => TestApiAsync(provider, context)));
 }