예제 #1
0
        public Form1()
        {
            InitializeComponent();

            GoogleClientLogin loginDialog = new GoogleClientLogin(new DocumentsService("GoogleDocumentsSample"), "*****@*****.**");
            if (loginDialog.ShowDialog() == DialogResult.OK)
            {
                RequestSettings settings = new RequestSettings("GoogleDocumentsSample", loginDialog.Credentials);
                settings.AutoPaging = true;
                settings.PageSize = 100;
                if (settings != null)
                {
                    this.request = new DocumentsRequest(settings);
                    this.Text = "Successfully logged in";

                    Feed<Document> feed = this.request.GetEverything();
                    // this takes care of paging the results in
                    foreach (Document entry in feed.Entries)
                    {
                        all.Add(entry);
                    }

                    TreeNode noFolder = null;
                    noFolder = new TreeNode("Items with no folder");
                    this.documentsView.Nodes.Add(noFolder);
                    noFolder.SelectedImageIndex = 0;
                    noFolder.ImageIndex = 0;

                    foreach (Document entry in all)
                    {
                        // let's add those with no parents for the toplevel
                        if (entry.ParentFolders.Count == 0)
                        {
                            if (entry.Type != Document.DocumentType.Folder)
                            {
                                AddToTreeView(noFolder.Nodes, entry);
                            }
                            else
                            {
                                TreeNode n = AddToTreeView(this.documentsView.Nodes, entry);
                                AddAllChildren(n.Nodes, entry);
                            }

                        }
                    }
                }
            }
        }
예제 #2
0
        private void OnLoad(object sender, System.EventArgs e)
        {
            if (this.googleAuthToken == null) 
            {
                GoogleClientLogin loginDialog = new GoogleClientLogin(new PicasaService("PhotoBrowser"), "*****@*****.**"); 
                loginDialog.ShowDialog();
              
                this.googleAuthToken = loginDialog.AuthenticationToken;
                this.user = loginDialog.User;

                if (this.googleAuthToken != null)
                {
                    picasaService.SetAuthenticationToken(loginDialog.AuthenticationToken);
                    UpdateAlbumFeed();
                }
                else
                {
                    this.Close();
                }
            }
        
        }
예제 #3
0
        // when the form loads, we want to load the application settings,
        // get the cmd line args, and process that 
        private void YouTubeUploader_Load(object sender, EventArgs e) {
            LoadAppSettings();
            GetCmdLineArgs();

            if (this.credentials != null) {
                try {
                    this.youTubeAuthenticator = new ClientLoginAuthenticator(YouTubeUploader.ApplicationName,
                        ServiceNames.YouTube, this.credentials);
                    this.youTubeAuthenticator.DeveloperKey = this.developerKey;
                } catch {
                    this.youTubeAuthenticator = null;
                }
            }

            if (this.youTubeAuthenticator == null) {
                GoogleClientLogin loginDialog = new GoogleClientLogin("*****@*****.**");
                loginDialog.ShowDialog();

                if (loginDialog.Credentials != null) {
                    this.youTubeAuthenticator = new ClientLoginAuthenticator(YouTubeUploader.ApplicationName,
                        ServiceNames.YouTube, loginDialog.Credentials);
                    this.youTubeAuthenticator.DeveloperKey = this.developerKey;

                    this.youtubeAccount = loginDialog.YoutubeAccount;
                } else {
                    this.Close();
                }
            }

            if (this.csvFileName != null) {
                LoadCSVFile(this.csvFileName);
                if (this.autoStart) {
                    Upload_Click(null, null);
                }
            }
        }