Example #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            GoogleAccounts gAW = new GoogleAccounts(_xmlGoogleAccountSettings);

            gAW.ShowDialog();
            SaveGoogleAccountsXML();

            AdaptGoogleAccountList();

            if (_GoogleAccounts != null && _GoogleAccounts.Count > 0)
            {
                foreach (GoogleAccount ga in _GoogleAccounts)
                {
                    ga.ClearListToUpload();
                }
            }
            SetColorsOfItemList(items);

            //        //UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
            //        //    new ClientSecrets
            //        //    {
            //        //        ClientId = "846715596453-539dui7i3rf5kqmmkenfnkk1i2d5dhlj.apps.googleusercontent.com",
            //        //        ClientSecret = "U-V5GMN3qk5Z6ubSql1xYD9M",
            //        //    },
            //        //    new[] { DriveService.Scope.Drive },
            //        //    "user",
            //        //    CancellationToken.None,
            //        //    new FileDataStore("credentials_koen.mestdagh")).Result;

            //        UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
            //new ClientSecrets
            //{
            //    ClientId = "610519876157-svk4euh3mk2bt37j43engm1uciid0jc9.apps.googleusercontent.com",
            //    ClientSecret = "2x4HYu0kucG6wXqPYNBZ8dmV",
            //},
            //new[] { DriveService.Scope.Drive },
            //"user",
            //CancellationToken.None,
            //new FileDataStore("credentials_koen.mestdagh2014")).Result;

            //        // Create the service.
            //        var service = new DriveService(new BaseClientService.Initializer()
            //        {
            //            HttpClientInitializer = credential,
            //            ApplicationName = "Drive API Sample",
            //        });

            //        List<File> lstFile = retrieveAllFiles(service);
            //        if (lstFile != null && lstFile.Count > 0)
            //        {
            //            foreach (File f in lstFile)
            //            {
            //                if (f.MimeType.EndsWith("apps.folder"))
            //                {
            //                    Trace.WriteLine(f.Title);
            //                }
            //                else if (f.Title.Contains("pellikaan"))
            //                {
            //                    Trace.WriteLine(f.Title);
            //                }
            //                else
            //                {
            //                    Trace.WriteLine(f.Title);
            //                }
            //            }
            //        }

            //        //File body = new File();
            //        //body.Title = "My document";
            //        //body.Description = "A test document";
            //        //body.MimeType = "text/plain";

            //        //byte[] byteArray = System.IO.File.ReadAllBytes("document.txt");
            //        //System.IO.MemoryStream stream = new System.IO.MemoryStream(byteArray);

            //        //FilesResource.InsertMediaUpload request = service.Files.Insert(body, stream, "text/plain");
            //        //request.Upload();

            //        //File file = request.ResponseBody;
            //        //Console.WriteLine("File id: " + file.Id);
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            GoogleAccounts gAW = new GoogleAccounts(_xmlGoogleAccountSettings);
            gAW.ShowDialog();
            SaveGoogleAccountsXML();

            AdaptGoogleAccountList();

            if (_GoogleAccounts != null && _GoogleAccounts.Count > 0)
            {
                foreach (GoogleAccount ga in _GoogleAccounts)
                {
                    ga.ClearListToUpload();
                }
            }
            SetColorsOfItemList(items);

            //        //UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
            //        //    new ClientSecrets
            //        //    {
            //        //        ClientId = "846715596453-539dui7i3rf5kqmmkenfnkk1i2d5dhlj.apps.googleusercontent.com",
            //        //        ClientSecret = "U-V5GMN3qk5Z6ubSql1xYD9M",
            //        //    },
            //        //    new[] { DriveService.Scope.Drive },
            //        //    "user",
            //        //    CancellationToken.None,
            //        //    new FileDataStore("credentials_koen.mestdagh")).Result;

            //        UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
            //new ClientSecrets
            //{
            //    ClientId = "610519876157-svk4euh3mk2bt37j43engm1uciid0jc9.apps.googleusercontent.com",
            //    ClientSecret = "2x4HYu0kucG6wXqPYNBZ8dmV",
            //},
            //new[] { DriveService.Scope.Drive },
            //"user",
            //CancellationToken.None,
            //new FileDataStore("credentials_koen.mestdagh2014")).Result;

            //        // Create the service.
            //        var service = new DriveService(new BaseClientService.Initializer()
            //        {
            //            HttpClientInitializer = credential,
            //            ApplicationName = "Drive API Sample",
            //        });

            //        List<File> lstFile = retrieveAllFiles(service);
            //        if (lstFile != null && lstFile.Count > 0)
            //        {
            //            foreach (File f in lstFile)
            //            {
            //                if (f.MimeType.EndsWith("apps.folder"))
            //                {
            //                    Trace.WriteLine(f.Title);
            //                }
            //                else if (f.Title.Contains("pellikaan"))
            //                {
            //                    Trace.WriteLine(f.Title);
            //                }
            //                else
            //                {
            //                    Trace.WriteLine(f.Title);
            //                }
            //            }
            //        }

            //        //File body = new File();
            //        //body.Title = "My document";
            //        //body.Description = "A test document";
            //        //body.MimeType = "text/plain";

            //        //byte[] byteArray = System.IO.File.ReadAllBytes("document.txt");
            //        //System.IO.MemoryStream stream = new System.IO.MemoryStream(byteArray);

            //        //FilesResource.InsertMediaUpload request = service.Files.Insert(body, stream, "text/plain");
            //        //request.Upload();

            //        //File file = request.ResponseBody;
            //        //Console.WriteLine("File id: " + file.Id);
        }