我正在使用 C# 库来发送捆绑包。现在,我正在发送多个请求,这会导致 Glass 在卡片进来时发出多次叮当声。我想像在 Java Mirror API 库中回答的问题(下面的链接)中那样批量处理这些请求。我在 C# 库中找不到等效的解决方案。这是Java的原始问题如何同时发送捆绑的卡?
这是我当前的代码
TimelineItem bundleCover = Utils.GetBundleCard(bundleId);
Stream stream = null;
if (!String.IsNullOrEmpty(Config.BUNDLE_MEDIA_LINK))
{
if (Config.BUNDLE_MEDIA_LINK.StartsWith("/"))
{
stream = new StreamReader(Server.MapPath(Config.BUNDLE_MEDIA_LINK)).BaseStream;
}
else
{
HttpWebRequest request = WebRequest.Create(Config.BUNDLE_MEDIA_LINK) as HttpWebRequest;
HttpWebResponse response = request.GetResponse() as HttpWebResponse;
stream = response.GetResponseStream();
}
}
List<TimelineItem> timelineItems = Utils.GetSlideCards(presentation, bundleId);
foreach (TimelineItem tli in timelineItems)
{
Service.Timeline.Insert(tli).Fetch();
}
// Send the bundle and attachment last
Service.Timeline.Insert(bundleCover, stream, "image/jpeg").Upload();
任何帮助将不胜感激。