コード例 #1
0
ファイル: ServiceNameGuest.cs プロジェクト: nkusibob/uwp10
        public static async Task <IList <MyObject> > GetBriefingsByDateAndCenter(DateTime start, DateTime end, string brfCenter)
        {
            try
            {
                string briefing = string.Format(Constants.BRIFINGS_BY_CENTER_DATE, start.ToString("s", System.Globalization.CultureInfo.InvariantCulture), end.ToString("s", System.Globalization.CultureInfo.InvariantCulture), brfCenter);
                string str      = await ServiceInvoker.GetResponseFromServiceAsync(briefing);

                var serializer = new DataContractJsonSerializer(typeof(IList <MyObject>));
                var ms         = new MemoryStream(Encoding.UTF8.GetBytes(str));
                var data       = (IList <MyObject>)serializer.ReadObject(ms);
                if (data != null)
                {
                    foreach (var item in data)
                    {
                        // App.GuestFromService.Add(item.BriefingTitle);
                    }
                }

                //log("GetBriefingDetails: " + str + "\r\n");
                return(data);
            }
            catch (Exception ex)
            {
                //log(ex + "\r\n");
                throw ex;
            }
        }