当前位置: 首页>>代码示例>>C#>>正文


C# Response.GetType方法代码示例

本文整理汇总了C#中Response.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Response.GetType方法的具体用法?C# Response.GetType怎么用?C# Response.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Response的用法示例。


在下文中一共展示了Response.GetType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EventHandler

 private void EventHandler(Exception ex, Response response)
 {
     if (!(response is EventResponse))
     {
         _logger.Error("Unexpected response type for event: " + response.GetType().Name);
         return;
     }
     if (CassandraEventResponse != null)
     {
         CassandraEventResponse(this, ((EventResponse) response).CassandraEventArgs);
     }
 }
开发者ID:shawhu,项目名称:csharp-driver,代码行数:12,代码来源:Connection.cs

示例2: GetRequestTypeFor

        public Type GetRequestTypeFor(Response response)
        {
            if (response == null) throw new ArgumentNullException("response");

            return responseRequestMappings[response.GetType()];
        }
开发者ID:hoghweed,项目名称:Agatha,代码行数:6,代码来源:BasicConventions.cs

示例3: addresponse

 int addresponse(Response r)
 {
     int id = _NEXTRESPONSEID;
     try
     {
         // set the id
         r.ID = id;
         // ensure it has a full name
         if (r.FullName == string.Empty)
             r.FullName = r.GetType().ToString();
         // get local response index
         int idx = _reslist.Count;
         // bind events
         bindresponseevents(r);
         // show it to user
         _resnames.Items.Add(r.FullName);
         // add it to trade list
         lock (_reslist)
         {
             _reslist.Add(r);
         }
         // prepare log entry for it
         _indlog.Add(null);
         // save id to local relationship
         _rid2local.Add(r.ID, idx);
         // setup place for it's symbols
         _rsym.Add(id, string.Empty);
         // map name to response
         _disp2real.Add(idx);
         // save id
         _NEXTRESPONSEID++;
         // reset response
         _reslist[idx].Reset();
         // send it current positions
         foreach (Position p in _pt)
             _reslist[idx].GotPosition(p);
         // update everything
         IndexBaskets();
         // show we added response
         status(r.FullName + getsyms(idx));
     }
     catch (Exception)
     {
         return -1;
     }
     return id;
 }
开发者ID:sopnic,项目名称:larytet-master,代码行数:47,代码来源:asp.cs

示例4: GetRowSet

 /// <summary>
 /// Validates that the result contains a RowSet and returns it.
 /// </summary>
 /// <exception cref="NullReferenceException" />
 /// <exception cref="DriverInternalError" />
 public static IEnumerable<Row> GetRowSet(Response response)
 {
     if (response == null)
     {
         throw new NullReferenceException("Response can not be null");
     }
     if (!(response is ResultResponse))
     {
         throw new DriverInternalError("Expected rows, obtained " + response.GetType().FullName);
     }
     var result = (ResultResponse) response;
     if (!(result.Output is OutputRows))
     {
         throw new DriverInternalError("Expected rows output, obtained " + result.Output.GetType().FullName);
     }
     return ((OutputRows) result.Output).RowSet;
 }
开发者ID:jorgebay,项目名称:csharp-driver,代码行数:22,代码来源:ControlConnection.cs

示例5: OneShotLocation_Click

        private async void OneShotLocation_Click(object sender, RoutedEventArgs e)
        {
            string latitude, longitude;
            var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            if ((bool)localSettings.Values["LocationConsent"] != true)
            {
                // The user has opted out of Location.
                return;
            }

            Geolocator geolocator = new Geolocator();
            geolocator.DesiredAccuracyInMeters = 50;

            try
            {
                Geoposition geoposition = await geolocator.GetGeopositionAsync(
                    maximumAge: TimeSpan.FromMinutes(5),
                    timeout: TimeSpan.FromSeconds(10)
                    );

                string bingMapsKey = "AqzuDl7U8coCVlvDrG30M2lwryW2N-tPnuQaIVjH4p9DFCnxD32Xgkt6ll9Selr7";
                latitude = geoposition.Coordinate.Latitude.ToString("0.00");
                longitude = geoposition.Coordinate.Longitude.ToString("0.00");
                double Radius = 3; // km

                string accessID = "f22876ec257b474b82fe2ffcb8393150";
                string dataEntityName = "NavteqNA";
                string dataSource = "NavteqPOIs";


                string requestUrl = string.Format("http://spatial.virtualearth.net/REST/v1/data/{0}/{1}/{2}?spatialFilter=nearby({3},{4},{5})&$filter=EntityTypeID eq '5800'&$select=EntityID,DisplayName,AddressLine,PostalCode,Phone,__Distance&$format=json&$top=10&key={6}", accessID, dataEntityName, dataSource, latitude, longitude, Radius, bingMapsKey);

                string json = await getData(requestUrl);
                Response childlist = new Response();

                MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(json));
                DataContractJsonSerializer ser = new DataContractJsonSerializer(childlist.GetType());
                childlist = ser.ReadObject(ms) as Response;
                string teststring = "";
                foreach (var d in childlist.results)
                {
                    foreach (var s in d.metadata)
                    {
                        teststring = teststring + "" + s.DisplayName + "\t" + s.EntityID + "\n";
                    }
                }

                ms.Dispose();

                // results = json.ToString();
                LatitudeTextBlock.Text = teststring;
            }
            catch (Exception ex)
            {
                if ((uint)ex.HResult == 0x80004004)
                {
                    // the application does not have the right capability or the location master switch is off
                    StatusTextBlock.Text = "location  is disabled in phone settings.";
                }
                //else
                {
                    // something else happened acquring the location
                    StatusTextBlock.Text = "Some error occured.";
                }
            }
        }
开发者ID:niyatia,项目名称:Mobile-App,代码行数:66,代码来源:MainPage.xaml.cs

示例6: SerializeResponse

 private string SerializeResponse(Response response)
 {
     //TODO handle multiple input/output types
     response.Time = Functions.ConvertToUnixTimestamp(DateTime.Now);
     String responseString;
     switch (response.Request.ContentType)
     {
         case ContentType.Xml:
             var x = new XmlSerializer(response.GetType());
             using (var writer = new StringWriter())
             {
                 x.Serialize(writer, response);
                 responseString = writer.ToString();
             }
             break;
             //case ContentType.Json:
         default:
             responseString = JsonConvert.SerializeObject(response, Formatting.None, SerializerSettings);
             break;
     }
     return responseString;
 }
开发者ID:Olivine-Labs,项目名称:Tiamat,代码行数:22,代码来源:Client.cs


注:本文中的Response.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。