具有Google日历的通用Windows平台应用

编程入门 行业动态 更新时间:2024-10-25 00:35:59
本文介绍了具有Google日历的通用Windows平台应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

嘿,我试图制作一个包含Google日历的通用Windows平台应用程序,但是我不知道如何转换代码,我让代码可以在WPF应用程序上工作. 我不是最擅长编码 developers.google/google的人-apps/calendar/quickstart/dotnet 这是我在开始时用作指导的网站,如果有帮助,有帮助吗? 下面的代码:

Hey im trying to make an Universal Windows Platform App where google calendar is in it, but i cant figure out how to convert the code, i got the code to work on a WPF App. I am not the best at coding developers.google/google-apps/calendar/quickstart/dotnet this is the site i use as a guideline in the start if its to any help, any help? Code below:

using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using Google.Apis.Auth.OAuth2; using Google.Apis.Calendar.v3; using Google.Apis.Calendar.v3.Data; using Google.Apis.Services; using Google.Apis.Util.Store; namespace Test1UWA { class GoogleEvents4 { public string Title { get; set; } public DateTime? StartDate { get; set; } public DateTime? EndDate { get; set; } } class GoogleClass4 { public List<GoogleEvents4> GoogleEvents = new List<GoogleEvents4>(); static string[] Scopes = { CalendarService.Scope.CalendarReadonly }; static string ApplicationName = "Google Calendar API .NET Quickstart"; public GoogleClass4() { UserCredential credential; using (var stream = new FileStream("client_secret4.json", FileMode.Open, FileAccess.Read)) { string credPath = System.Environment.GetFolderPath( System.Environment.SpecialFolder.Personal); credPath = Path.Combine(credPath, ".credentials/calendar-dotnet-quickstart.json"); credential = GoogleWebAuthorizationBroker.AuthorizeAsync( GoogleClientSecrets.Load(stream).Secrets, Scopes, "user", CancellationToken.None, new FileDataStore(credPath, true)).Result; } // Create Google Calendar API service. var service = new CalendarService(new BaseClientService.Initializer() { HttpClientInitializer = credential, ApplicationName = ApplicationName, }); // Define parameters of request. EventsResource.ListRequest request = service.Events.List("primary"); request.TimeMin = DateTime.Now; request.ShowDeleted = true; request.SingleEvents = true; request.MaxResults = 10; request.OrderBy = EventsResource.ListRequest.OrderByEnum.StartTime; // List events. Events events = request.Execute(); if (events.Items != null && events.Items.Count > 0) { foreach (var eventItem in events.Items) { string when = eventItem.Start.DateTime.ToString(); if (String.IsNullOrEmpty(when)) { when = eventItem.Start.Date; } GoogleEvents.Add(new GoogleEvents4 { Title = eventItem.Summary, StartDate = eventItem.Start.DateTime, EndDate = eventItem.End.DateTime }); } } } } }

推荐答案

目前,Google 客户端库不支持UWP.

At this time the Google Client library does not support UWP.

客户端库(受支持的平台列表)中的链接

chrisdunelm 27天前Google会员不幸的是我们不支持 UWP还没有,所以它还不能在列表中.也许我们应该强调 我们不支持它:(

chrisdunelm 27 days ago Google member Unfortunately we don't support UWP yet, so it can't be on the list yet. Maybe we should highlight that we don't support it :(

更新:

我们计划在v2.0版本中支持UWP,我们希望在2017年初发布.

We plan to support UWP in the v2.0 release, which we hope will be early 2017.

更多推荐

具有Google日历的通用Windows平台应用

本文发布于:2023-11-03 12:53:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1555185.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:日历   平台   Google   Windows

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!