Esempio n. 1
0
        //Acces the Todoist servers using the users private API-Token
        //No usernames or passwords needed
        private async void LoginToTodoist()
        {
            //Hides the buttons until connection with server
            SetButtonVisability(false);
            label_loading.Text = "Loading Todoist Data";

            try
            {
                //Connects to server
                client = new TodoistClient(settings["Todoist"]["token"]);

                //Test the connection by fetching the username and displaying it
                var resources = await client.GetResourcesAsync();

                label_loading.Text = "Loged in as " + resources.UserInfo.FullName;
                SetButtonVisability(true);
            }

            catch
            {
                //Failed connection
                MessageBox.Show("Failed to load Todoist data, check API-Token");
                label_loading.Text = "Load failed";
            }
        }
Esempio n. 2
0
        public static async Task <Resources> GetResources(params ResourceType[] resourceTypes)
        {
            Resources resources = await Client.GetResourcesAsync(resourceTypes);

            return(resources);
        }