示例#1
0
        public void AuthenticateThreadMethod()
        {
            try
            {
                LiveClient client = null;
                BinaryMessageEncodingBindingElement binaryMessageEncoding = new BinaryMessageEncodingBindingElement()
                {
                    ReaderQuotas = new XmlDictionaryReaderQuotas()
                    {
                        MaxStringContentLength = int.MaxValue,
                        MaxBytesPerRead        = int.MaxValue,
                        MaxDepth       = int.MaxValue,
                        MaxArrayLength = int.MaxValue
                    }
                };

                HttpTransportBindingElement httpTransport = new HttpsTransportBindingElement()
                {
                    MaxBufferSize          = int.MaxValue,
                    MaxReceivedMessageSize = int.MaxValue,
                    AllowCookies           = false,
                };

                client = new LiveClient(new CustomBinding(binaryMessageEncoding, httpTransport), new EndpointAddress("https://api.groundspeak.com/LiveV6/Geocaching.svc/Silverlightsoap"));
                var req = new GetYourUserProfileRequest();
                req.AccessToken = this.Token;
                req.DeviceInfo  = new DeviceData()
                {
                    DeviceName                 = "GAPPChatService",
                    DeviceUniqueId             = "internal",
                    ApplicationSoftwareVersion = "V1.0.0.0"
                };

                var resp = client.GetYourUserProfile(req);
                if (resp.Status.StatusCode == 0)
                {
                    GeocachingComUserProfile = resp.Profile;
                }
                client.Close();
            }
            catch
            {
                GeocachingComUserProfile = null;
            }
            //_authenticateThread = null;
            _authentificationChecked = true;
            if (AuthentificationFinished != null && !_closed)
            {
                AuthentificationFinished(this, EventArgs.Empty);
            }
        }
示例#2
0
        public void AuthenticateThreadMethod()
        {
            try
            {
                LiveClient client = null;
                BinaryMessageEncodingBindingElement binaryMessageEncoding = new BinaryMessageEncodingBindingElement()
                {
                    ReaderQuotas = new XmlDictionaryReaderQuotas()
                    {
                        MaxStringContentLength = int.MaxValue,
                        MaxBytesPerRead = int.MaxValue,
                        MaxDepth = int.MaxValue,
                        MaxArrayLength = int.MaxValue
                    }
                };

                HttpTransportBindingElement httpTransport = new HttpsTransportBindingElement()
                {
                    MaxBufferSize = int.MaxValue,
                    MaxReceivedMessageSize = int.MaxValue,
                    AllowCookies = false,
                };

                client = new LiveClient(new CustomBinding(binaryMessageEncoding, httpTransport), new EndpointAddress("https://api.groundspeak.com/LiveV6/Geocaching.svc/Silverlightsoap"));
                var req = new GetYourUserProfileRequest();
                req.AccessToken = this.Token;
                req.DeviceInfo = new DeviceData()
                            {
                                DeviceName = "GAPPChatService",
                                DeviceUniqueId = "internal",
                                ApplicationSoftwareVersion = "V1.0.0.0"
                            };

                var resp = client.GetYourUserProfile(req);
                if (resp.Status.StatusCode == 0)
                {
                    GeocachingComUserProfile = resp.Profile;
                }
                client.Close();
            }
            catch
            {
                GeocachingComUserProfile = null;
            }
            //_authenticateThread = null;
            _authentificationChecked = true;
            if (AuthentificationFinished != null && !_closed)
            {
                AuthentificationFinished(this, EventArgs.Empty);
            }
        }