Пример #1
0
        private void loginToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LoginDialog ld = new LoginDialog();

            ld.ShowDialog();

            if (ld.DialogResult == DialogResult.OK)
            {
                pam = new PicasaAlbumsManager(ld.Username, ld.Password);

                //How do we handle failures?
                // pam.login();
                // We done, yet :-/ ...... Well, I wrote some code for it
                // using exception handling, but I thought it was crap, and deleted it.

                // This is how:

                try {
                    pam.login();

                    this.lblStatus.Text = "Connected as " + ld.Username;
                    myAlbums            = pam.getAllAlbums();

                    albumList.DisplayMember = pam.DisplayMember;
                    for (int i = 0; i < myAlbums.Count; i++)
                    {
                        albumList.Items.Add(myAlbums[i]);
                    }
                } catch (UnauthorizedAccessException) {
                    NotifyDialog bad_login = new NotifyDialog();
                    bad_login.NotificationMessage = "Wrong password. Try again.";
                    bad_login.ShowDialog();
                }
            }
        }
Пример #2
0
        private void propertiesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (null == pam || false == pam.LoggedIn)
            {
                NotifyDialog please_login = new NotifyDialog();
                please_login.NotificationMessage = "Please login, then proceed to upload.";
                please_login.ShowDialog();
            }
            else
            {
                OpenFileDialog get_filenames_to_upload = new OpenFileDialog();
                get_filenames_to_upload.Multiselect = true;
                if (get_filenames_to_upload.ShowDialog() == DialogResult.OK)
                {
                    string next_page = "";
                    next_page += "<html><head><title>";
                    next_page += "Photo Upload";
                    next_page += "</title></head><body>";
                    next_page += "Uploading " + get_filenames_to_upload.FileNames.Length;

                    if (get_filenames_to_upload.FileNames.Length > 1)
                    {
                        next_page += " photos ";
                    }
                    else if (get_filenames_to_upload.FileNames.Length == 1)
                    {
                        next_page += " photo ";
                    }
                    else
                    {
                        throw new Exception("Must select 1 or more photos for upload!");
                    }

                    next_page += "to " + myAlbums[albumList.SelectedIndex].Title + " ...";

                    next_page += "</br>";
                    next_page += "</body></html>";

                    albumPhotoBrowser.DocumentText = next_page;

                    StupidContainer stupid = new StupidContainer();
                    stupid.album     = myAlbums[albumList.SelectedIndex];
                    stupid.filenames = get_filenames_to_upload.FileNames;

                    if (display_photos_thread != null)
                    {
                        display_photos_thread.Abort();
                    }
                    display_photos_thread = new Thread(get_album_thumbs_from_local);
                    display_photos_thread.Start(stupid);
                }
            }
        }
Пример #3
0
        private void createNewAlbumToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (null == pam || false == pam.LoggedIn) {
                NotifyDialog please_login = new NotifyDialog();
                please_login.NotificationMessage = "Please login, then proceed to create new albums.";
                please_login.ShowDialog();
            } else {

                NewAlbumDialog nad = new NewAlbumDialog();

                nad.ShowDialog();

                if (nad.DialogResult == DialogResult.OK) {
                    PicasaWeb picasa = pam.getWeb();
                    PicasaAlbum unique_id = picasa.CreateAlbum(nad.AlbumTitle, nad.AlbumDescription, nad.AlbumAcessMode, nad.AlbumDate);

                }

            }
        }
Пример #4
0
        private void createNewAlbumToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (null == pam || false == pam.LoggedIn)
            {
                NotifyDialog please_login = new NotifyDialog();
                please_login.NotificationMessage = "Please login, then proceed to create new albums.";
                please_login.ShowDialog();
            }
            else
            {
                NewAlbumDialog nad = new NewAlbumDialog();

                nad.ShowDialog();

                if (nad.DialogResult == DialogResult.OK)
                {
                    PicasaWeb   picasa    = pam.getWeb();
                    PicasaAlbum unique_id = picasa.CreateAlbum(nad.AlbumTitle, nad.AlbumDescription, nad.AlbumAcessMode, nad.AlbumDate);
                }
            }
        }
Пример #5
0
        private void propertiesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (null == pam || false == pam.LoggedIn) {
                NotifyDialog please_login = new NotifyDialog();
                please_login.NotificationMessage = "Please login, then proceed to upload.";
                please_login.ShowDialog();
            } else {

                OpenFileDialog get_filenames_to_upload = new OpenFileDialog();
                get_filenames_to_upload.Multiselect = true;
                if (get_filenames_to_upload.ShowDialog() == DialogResult.OK) {

                    string next_page = "";
                    next_page += "<html><head><title>";
                    next_page += "Photo Upload";
                    next_page += "</title></head><body>";
                    next_page += "Uploading " + get_filenames_to_upload.FileNames.Length;

                    if (get_filenames_to_upload.FileNames.Length > 1) {
                        next_page += " photos ";
                    } else if (get_filenames_to_upload.FileNames.Length == 1) {
                        next_page += " photo ";
                    } else {
                        throw new Exception("Must select 1 or more photos for upload!");
                    }

                    next_page += "to " + myAlbums[albumList.SelectedIndex].Title + " ...";

                    next_page += "</br>";
                    next_page += "</body></html>";

                    albumPhotoBrowser.DocumentText = next_page;

                    StupidContainer stupid = new StupidContainer();
                    stupid.album = myAlbums[albumList.SelectedIndex];
                    stupid.filenames = get_filenames_to_upload.FileNames;

                    if (display_photos_thread != null) {
                        display_photos_thread.Abort();
                    }
                    display_photos_thread = new Thread(get_album_thumbs_from_local);
                    display_photos_thread.Start(stupid);

                }
            }
        }
Пример #6
0
        private void loginToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LoginDialog ld = new LoginDialog();
            ld.ShowDialog();

            if (ld.DialogResult == DialogResult.OK) {
                pam = new PicasaAlbumsManager(ld.Username, ld.Password);

                //How do we handle failures?
               // pam.login();
                // We done, yet :-/ ...... Well, I wrote some code for it
                // using exception handling, but I thought it was crap, and deleted it.

                // This is how:

                try {
                    pam.login();

                    this.lblStatus.Text = "Connected as " + ld.Username;
                    myAlbums = pam.getAllAlbums();

                    albumList.DisplayMember = pam.DisplayMember;
                    for (int i = 0; i < myAlbums.Count; i++) {
                        albumList.Items.Add(myAlbums[i]);
                    }

                } catch (UnauthorizedAccessException) {
                    NotifyDialog bad_login = new NotifyDialog();
                    bad_login.NotificationMessage = "Wrong password. Try again.";
                    bad_login.ShowDialog();
                }
            }
        }