示例#1
0
 /// ticket + arg1
 public TransitType GetInstance <TransitType, ArgType1>(
     ArgType1 arg1,
     WebClientImpl <TransitType> .GetItemDelegate <ArgType1> functor)
 {
     return(WebClientImpl <TransitType> .GetInstance <ArgType1>(
                Ticket, arg1, functor, Cache, DefaultCacheTimeSpan, DefaultCacheTicket));
 }
示例#2
0
 /// ticket + arg1 + arg2
 public int GetCount <TransitType, ArgType1, ArgType2>(
     ArgType1 arg1, ArgType2 arg2,
     WebClientImpl <TransitType> .GetItemDelegateCount <ArgType1, ArgType2> functor)
 {
     return(WebClientImpl <TransitType> .GetCount(
                Ticket, arg1, arg2, functor, Cache, DefaultCacheTimeSpan, DefaultCacheTicket));
 }
示例#3
0
 /// ticket + arg1 + arg2 + arg3
 public bool GetBool <TransitType, ArgType1, ArgType2, ArgType3>(
     ArgType1 arg1, ArgType2 arg2, ArgType3 arg3,
     WebClientImpl <TransitType> .GetItemDelegateBool <ArgType1, ArgType2, ArgType3> functor)
 {
     return(WebClientImpl <TransitType> .GetBool(
                Ticket, arg1, arg2, arg3, functor, Cache, DefaultCacheTimeSpan, DefaultCacheTicket));
 }
示例#4
0
        async void Initialize()
        {
            var keys = new KeyStorage();
            var client = new DropNetClient(await keys.Get("dropbox-apikey"), await keys.Get("dropbox-secret"));
            client.UseSandbox = true;

            var token = await client.GetRequestToken();
            var url = client.BuildAuthorizeUrl(token, "http://localhost");

            var regClient = new WebClientImpl();
            browser.SetWebViewClient(regClient);
            browser.LoadUrl(url);

            await regClient.Callback.Task;
            await client.GetAccessToken();

            browser.Visibility = ViewStates.Gone;

            var items = new List<Adaptar.Item>();
            foreach (var file in (await client.GetMetaData("/")).Contents.Take(10))
            {
                var buffer = await client.GetThumbnail(file);
                items.Add(
                    new Adaptar.Item
                    {
                        Title = file.Name,
                        Icon = await BitmapFactory.DecodeByteArrayAsync(buffer, 0, buffer.Length),
                    });
            }
            adapter.Update(items);
        }
示例#5
0
 /// ticket + arg1 + arg2 + arg3
 public TransitType GetPrivateInstance <TransitType, ArgType1, ArgType2, ArgType3>(
     ArgType1 arg1, ArgType2 arg2, ArgType3 arg3,
     WebClientImpl <TransitType> .GetItemDelegate <ArgType1, ArgType2, ArgType3> functor)
 {
     return(WebClientImpl <TransitType> .GetInstance <ArgType1, ArgType2, ArgType3>(
                Ticket, arg1, arg2, arg3, functor, Cache, DefaultCacheTimeSpan, Ticket));
 }
示例#6
0
        public void T20_AuthRspDto_PortalUrl()
        {
            WebClientImpl client = new WebClientImpl(new WebClientConfig());

            string          s;
            AuthResponseDto rspDto;

            s      = File.ReadAllText("sign_404_nourl.rsp.xml");
            rspDto = _parse500Response(s, false);
            Assert.IsNotNull(rspDto);
            Assert.AreEqual(ServiceStatusCode.NO_KEY_FOUND, rspDto.Status.Code, "sync, code == 404");
            Assert.IsFalse(rspDto.Extensions.ContainsKey(AuthResponseExtension.UserAssistencePortalUrl), "sync, no user assistence url");

            rspDto = _parse500Response(s, true);
            Assert.IsNotNull(rspDto);
            Assert.AreEqual(ServiceStatusCode.NO_KEY_FOUND, rspDto.Status.Code, "async, code == 404");
            Assert.IsFalse(rspDto.Extensions.ContainsKey(AuthResponseExtension.UserAssistencePortalUrl), "sync, no user assistence url");

            s      = File.ReadAllText("sign_404_url.rsp.xml");
            rspDto = _parse500Response(s, false);
            Assert.IsNotNull(rspDto);
            Assert.AreEqual(ServiceStatusCode.NO_KEY_FOUND, rspDto.Status.Code, "sync+url, code == 404");
            Assert.AreEqual("http://mobileid.ch?msisdn=41000092404", rspDto.Extensions[AuthResponseExtension.UserAssistencePortalUrl], "sync+url, user assistence url");

            rspDto = _parse500Response(s, true);
            Assert.IsNotNull(rspDto);
            Assert.AreEqual(ServiceStatusCode.NO_KEY_FOUND, rspDto.Status.Code, "async+url, code == 404");
            Assert.AreEqual("http://mobileid.ch?msisdn=41000092404", rspDto.Extensions[AuthResponseExtension.UserAssistencePortalUrl], "sync+url, user assistence url");
        }
示例#7
0
 /// ticket + arg1 + arg2 + arg3 + ServiceQueryOptions
 public IList <TransitType> GetPrivateCollection <TransitType, ArgType1, ArgType2, ArgType3>(
     ArgType1 arg1, ArgType2 arg2, ArgType3 arg3, ServiceQueryOptions options,
     WebClientImpl <TransitType> .GetCollectionDelegate <ArgType1, ArgType2, ArgType3> functor)
 {
     return(WebClientImpl <TransitType> .GetCollection <ArgType1, ArgType2, ArgType3>(
                Ticket, arg1, arg2, arg3, options, functor, Cache, DefaultCacheTimeSpan, Ticket));
 }
示例#8
0
        private void doFile(string fileName)
        {
            WebClientImpl   client = new WebClientImpl(new WebClientConfig());
            string          s      = File.ReadAllText(fileName);
            AuthResponseDto rsp    = new AuthResponseDto(ServiceStatusCode.SIGNATURE);

            rsp.Signature = Convert.FromBase64String(s);
            Assert.IsNotNull(rsp.Signature, "signature not null");
            Assert.IsNotNull(rsp.UserCertificate, "signer cert not null");
            Assert.AreEqual("MIDCHE28RCLRX077", rsp.UserSerialNumber, "signer serial number");
            Assert.AreEqual("MIDCHE28RCLRX077:PN", rsp.UserPseudonym, "signer pseudonym");
        }
示例#9
0
    private string Handle <TransitType, ArgType>(
        string tagname, string tagvalue, ArgType arg,
        WebClientImpl <TransitType> .GetItemDelegate <int, ArgType> functor,
        ToString <TransitType> transformer)
    {
        int id = 0;

        if (int.TryParse(tagvalue, out id))
        {
            TransitType t_instance = GetInstance <TransitType, int, ArgType>(id, arg, functor);
            if (t_instance != null)
            {
                return(transformer(t_instance));
            }
        }

        return(string.Format("[invalid {0}: {1}]", tagname, tagvalue));
    }
示例#10
0
 /// ticket
 public bool GetBool <TransitType>(
     WebClientImpl <TransitType> .GetItemDelegateBool functor)
 {
     return(WebClientImpl <TransitType> .GetBool(
                Ticket, functor, Cache, DefaultCacheTimeSpan, DefaultCacheTicket));
 }
示例#11
0
 public void InvalidateCache <TransitType>()
 {
     WebClientImpl <TransitType> .Invalidate(Cache);
 }
示例#12
0
 public void Delete <TransitType>(
     int id, WebClientImpl <TransitType> .DeleteItemDelegate functor)
 {
     WebClientImpl <TransitType> .Delete(
         Ticket, id, functor, Cache);
 }
示例#13
0
 public int CreateOrUpdate <TransitType, ArgType1>(
     TransitType t_instance, ArgType1 arg1, WebClientImpl <TransitType> .CreateOrUpdateItemDelegate <ArgType1> functor)
 {
     return(WebClientImpl <TransitType> .CreateOrUpdate(
                Ticket, t_instance, arg1, functor, Cache));
 }
示例#14
0
 /// no parameters
 public IList <TransitType> GetCollection <TransitType>(
     WebClientImpl <TransitType> .GetCollectionDelegateNoArgs functor)
 {
     return(WebClientImpl <TransitType> .GetCollection(
                functor, Cache, DefaultCacheTimeSpan, DefaultCacheTicket));
 }
示例#15
0
 /// ticket
 public int GetCount <TransitType>(
     WebClientImpl <TransitType> .GetItemDelegateCount functor)
 {
     return(WebClientImpl <TransitType> .GetCount(
                Ticket, functor, Cache, DefaultCacheTimeSpan, DefaultCacheTicket));
 }
示例#16
0
 /// ticket
 public TransitType GetPrivateInstance <TransitType>(
     WebClientImpl <TransitType> .GetItemDelegate functor)
 {
     return(WebClientImpl <TransitType> .GetInstance(
                Ticket, functor, Cache, DefaultCacheTimeSpan, Ticket));
 }
示例#17
0
 /// ticket + ServiceQueryOptions
 public IList <TransitType> GetPrivateCollection <TransitType>(
     ServiceQueryOptions options, WebClientImpl <TransitType> .GetCollectionDelegate functor)
 {
     return(WebClientImpl <TransitType> .GetCollection(
                Ticket, options, functor, Cache, DefaultCacheTimeSpan, Ticket));
 }