private void TestButton_Click(object sender, EventArgs e)
        {
            try
            {
                Affirma.ThreeSharp.Wrapper.ThreeSharpWrapper wrapper = new Affirma.ThreeSharp.Wrapper.ThreeSharpWrapper(this.AccessKeyTextbox.Text, this.SecretKeyTextbox.Text);
                string testBucket = Guid.NewGuid().ToString();
                wrapper.AddBucket(testBucket);
                string bucket = wrapper.ListBucket(testBucket);
                wrapper.DeleteBucket(testBucket);

                try
                {
                    string terminals = wrapper.ListBucket(AmazonBucket);
                }
                catch (Exception exc)
                {
                    if (exc.Message == "The specified bucket does not exist")
                    {
                        wrapper.AddBucket(AmazonBucket);
                        string terminals = wrapper.ListBucket(AmazonBucket);
                    }
                }

                this.ErrorLabel.Text      = "Test was successful!";
                this.ErrorLabel.ForeColor = Color.Black;
            }
            catch (Exception exc)
            {
                this.ErrorLabel.ForeColor = Color.Red;
                this.ErrorLabel.Text      = exc.Message;
            }
        }
 private void BackupButton_Click(object sender, EventArgs e)
 {
     if (System.Windows.Forms.MessageBox.Show("Are you sure you want to upload your current configuration?", "Amazon S3 Backup", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         Affirma.ThreeSharp.Wrapper.ThreeSharpWrapper wrapper = new Affirma.ThreeSharp.Wrapper.ThreeSharpWrapper(this.AccessKeyTextbox.Text, this.SecretKeyTextbox.Text);
         string url = null;
         try
         {
             string terminals = wrapper.ListBucket(AmazonBucket);
         }
         catch (Exception exc)
         {
             wrapper.AddBucket(AmazonBucket);
         }
         try
         {
             wrapper.AddFileObject(AmazonBucket, AmazonConfigKeyName, Terminals.Program.ConfigurationFileLocation);
             url = wrapper.GetUrl(AmazonBucket, AmazonConfigKeyName);
         }
         catch (Exception exc)
         {
             this.ErrorLabel.ForeColor = Color.Red;
             this.ErrorLabel.Text      = exc.Message;
             return;
         }
         this.ErrorLabel.ForeColor = Color.Black;
         this.ErrorLabel.Text      = "The backup was a success!";
     }
 }
        private void TestButton_Click(object sender, EventArgs e)
        {
            try
            {
                Affirma.ThreeSharp.Wrapper.ThreeSharpWrapper wrapper = new Affirma.ThreeSharp.Wrapper.ThreeSharpWrapper(this.AccessKeyTextbox.Text, this.SecretKeyTextbox.Text);
                string testBucket = Guid.NewGuid().ToString();
                wrapper.AddBucket(testBucket);
                string bucket = wrapper.ListBucket(testBucket);
                wrapper.DeleteBucket(testBucket);

                try
                {
                    string terminals = wrapper.ListBucket(AmazonBucket);
                }
                catch (Exception exc)
                {
                    if (exc.Message == "The specified bucket does not exist")
                    {
                        wrapper.AddBucket(AmazonBucket);
                        string terminals = wrapper.ListBucket(AmazonBucket);
                    }
                }

                this.ErrorLabel.Text = "Test was successful!";
                this.ErrorLabel.ForeColor = Color.Black;
            }
            catch (Exception exc)
            {
                this.ErrorLabel.ForeColor = Color.Red;
                this.ErrorLabel.Text = exc.Message;
            }
        }
 private void BackupButton_Click(object sender, EventArgs e)
 {
     if (System.Windows.Forms.MessageBox.Show("Are you sure you want to upload your current configuration?", "Amazon S3 Backup", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         Affirma.ThreeSharp.Wrapper.ThreeSharpWrapper wrapper = new Affirma.ThreeSharp.Wrapper.ThreeSharpWrapper(this.AccessKeyTextbox.Text, this.SecretKeyTextbox.Text);
         string url = null;
         try
         {
             string terminals = wrapper.ListBucket(AmazonBucket);
         }
         catch (Exception exc)
         {
             wrapper.AddBucket(AmazonBucket);
         }
         try
         {
             wrapper.AddFileObject(AmazonBucket, AmazonConfigKeyName, Terminals.Program.ConfigurationFileLocation);
             url = wrapper.GetUrl(AmazonBucket, AmazonConfigKeyName);
         }
         catch (Exception exc)
         {
             this.ErrorLabel.ForeColor = Color.Red;
             this.ErrorLabel.Text = exc.Message;
             return;
         }
         this.ErrorLabel.ForeColor = Color.Black;
         this.ErrorLabel.Text = "The backup was a success!";
     }
 }