private Expander CreateUITasklist(TaskList list, Google.Apis.Tasks.v1.Data.Tasks tasks) { var expander = new Expander(); // Add a bold title. expander.Header = list.Title; expander.FontWeight = FontWeights.Bold; // Add the taskItems (if applicable). if (tasks.Items != null) { var container = new StackPanel(); foreach (CheckBox box in tasks.Items.Select(CreateUITask)) { container.Children.Add(box); } expander.Content = container; } else { expander.Content = "There are no tasks in this list."; } return(expander); }
public async Task <IEnumerable <EntityVersion <string, string> > > GetAllVersions(IEnumerable <string> idsOfknownEntities, int context, IGetVersionsLogger logger) { var request = _tasksService.Tasks.List(_taskList.Id); request.Fields = "items(etag,id),nextPageToken"; var tasks = new List <EntityVersion <string, string> >(); Google.Apis.Tasks.v1.Data.Tasks result = null; do { request.PageToken = result?.NextPageToken; result = await request.ExecuteAsync(); if (result.Items != null) { tasks.AddRange(result.Items.Select(t => EntityVersion.Create(t.Id, t.ETag))); } } while (result.NextPageToken != null); return(tasks); }
private void Taskget() { string[] Scopes = { TasksService.Scope.TasksReadonly }; string ApplicationName = "Google Tasks API .NET Quickstart"; object[] storedtask = null; // string htmldata = "<div class='row'>"; string taskcolor = "white"; string complete = " <div class='row'>"; string incomplete = "<div class='row'>"; UserCredential credential; using (var stream = new FileStream(Server.MapPath("client_secret.json"), FileMode.Open, FileAccess.Read)) { string credPath = System.Environment.GetFolderPath( System.Environment.SpecialFolder.Personal);; credPath = Path.Combine(credPath, ".credentials/tasks-dotnet-quickstart.json"); credential = GoogleWebAuthorizationBroker.AuthorizeAsync( GoogleClientSecrets.Load(stream).Secrets, Scopes, "user", CancellationToken.None, new FileDataStore(credPath, true)).Result; // Console.WriteLine("Credential file saved to: " + credPath); } // Create Google Tasks API service. var service = new TasksService(new BaseClientService.Initializer() { HttpClientInitializer = credential, ApplicationName = ApplicationName, }); // Define parameters of request. Dataservice.DatamanagementClient findata = new Dataservice.DatamanagementClient(); findata.Open(); UserData user = (UserData)Session["User"]; TasksResource.ListRequest request = service.Tasks.List("@default"); request.MaxResults = 20; Google.Apis.Tasks.v1.Data.Tasks tasks = request.Execute(); if (tasks.Items != null) { foreach (Google.Apis.Tasks.v1.Data.Task task in tasks.Items) { string title = task.Title; string id = task.Id; if (task.Status.ToString() == "completed") { if (findata.checktasks(id, user.getID()) == id) { storedtask = findata.gettask(id, user.getID()); if ((string)storedtask[1] == title) { } else { findata.updatetask(task.Title, "1", user.getID().ToString(), (string)storedtask[4], task.Id, (string)storedtask[0]); } complete += "<a href=\"Taskedit.aspx?id=" + task.Id + "\">"; complete += "<div class=\"col s12 m3 l3\">"; complete += "<div class=\"card horizontal hoverable " + colorchoice(Convert.ToInt32((string)storedtask[4])) + "\">"; // htmldata += "<div class=\"card horizontal hoverable blue\">"; complete += "<div class=\"card-stacked\">"; complete += "<div class=\"card-content black-text\">"; complete += "<span class=\"card-title bold trunctext\">" + task.Title.ToString(); complete += "</span>"; complete += "</div>"; complete += "</div>"; complete += "</div>"; complete += "</div>"; complete += "</a>"; } else { findata.inserttask(task.Title, "1", "1", task.Id, user.getID()); complete += "<a href=\"Taskedit.aspx?id=" + task.Id + "\">"; complete += "<div class=\"col s12 m3 l3\">"; // complete += "<div class=\"card horizontal hoverable " + colorchoice(Convert.ToInt32((string)storedtask[4])) + " href=\"Taskedit" + "?id=" + task.Id + "\">"; complete += "<div class=\"card horizontal hoverable green\">"; complete += "<div class=\"card-stacked\">"; complete += "<div class=\"card-content black-text\">"; complete += "<span class=\"card-title bold trunctext\">" + task.Title.ToString(); complete += "</span>"; complete += "</div>"; complete += "</div>"; complete += "</div>"; complete += "</div>"; complete += "</a>"; } } else { if (findata.checktasks(id, user.getID()) == id) { storedtask = findata.gettask(id, user.getID()); if ((string)storedtask[1] == title) { } else { findata.updatetask(task.Title, "1", user.getID().ToString(), (string)storedtask[4], task.Id, (string)storedtask[0]); } incomplete += "<a href=\"Taskedit.aspx?id=" + task.Id + "\">"; incomplete += "<div class=\"col s12 m3 l3\">"; incomplete += "<div class=\"card hoverable " + colorchoice(Convert.ToInt32((string)storedtask[4])) + "\">"; //htmldata += "<div class=\"card horizontal hoverable blue\">"; incomplete += "<div class=\"card-stacked\">"; incomplete += "<div class=\"card-content black-text\">"; incomplete += "<span class=\"card-title bold trunctext\">" + task.Title.ToString(); incomplete += "</span>"; incomplete += "</div>"; incomplete += "</div>"; incomplete += "</div>"; incomplete += "</div>"; incomplete += "</a>"; } else { findata.inserttask(task.Title, "0", "1", task.Id, user.getID()); incomplete += "<a href=\"Taskedit.aspx?id=" + task.Id + "\">"; incomplete += "<div class=\"col s12 m3 l3\">"; // incomplete += "<div class=\"card horizontal hoverable " + colorchoice(Convert.ToInt32((string)storedtask[4])) + " href=\"Taskedit" + "?id=" + task.Id + "\">"; incomplete += "<div class=\"card hoverable green\">"; incomplete += "<div class=\"card-stacked\">"; incomplete += "<div class=\"card-content black-text\">"; incomplete += "<span class=\"card-title trunctext\">" + task.Title.ToString(); incomplete += "</span>"; incomplete += "</div>"; incomplete += "</div>"; incomplete += "</div>"; incomplete += "</div>"; incomplete += "</a>"; } } } } else { Console.WriteLine("No task lists found."); } // List task lists. //Console.Read(); incomplete += "</div>"; complete += "</div>"; taskinprogress.InnerHtml = incomplete; completedtask.InnerHtml = complete; findata.Close(); }