Ejemplo n.º 1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (this.textBox1.TextLength < 3 || this.textBox2.TextLength < 3)
     {
         if (MessageBox.Show("Author's name or image name too short.(minimus is 3)", "Input too short", MessageBoxButtons.OK) != DialogResult.OK)
         {
             return;
         }
         this.Close();
     }
     else if (this.textBox1.TextLength > 30 || this.textBox2.TextLength > 30)
     {
         if (MessageBox.Show("Author's name or image name too long.(maximum is 30)", "Input too long", MessageBoxButtons.OK) != DialogResult.OK)
         {
             return;
         }
         this.Close();
     }
     else
     {
         MySQLHandle.FTPUploadImage(Form1.imageHistory[Form1.CurrentHistoryIndex]);
         MySQLHandle.SQLUploadInfo(Form1.lastBlurSize, this.textBox1.Text, this.textBox2.Text);
         if (MessageBox.Show("Successfully uploaded your image.", "Success", MessageBoxButtons.OK) != DialogResult.OK)
         {
             return;
         }
         this.Close();
     }
 }
Ejemplo n.º 2
0
 private void button10_Click(object sender, EventArgs e)
 {
     if (this.attheendofDB)
     {
         int num = (int)MessageBox.Show("There are no more images to be seen", "End of database", MessageBoxButtons.OK);
     }
     else
     {
         for (int index = 0; index < 10; ++index)
         {
             Button button = new Button();
             button.Name = MySQLHandle.getshowedID().ToString();
             Image lastUnseenImage = MySQLHandle.getLastUnseenImage();
             button.Image = lastUnseenImage;
             button.Text  = MySQLHandle.getInfoString();
             button.Size  = new Size(lastUnseenImage.Width, lastUnseenImage.Height);
             this.flowLayoutPanel1.Controls.Add((Control)button);
             button.Click += new EventHandler(this.imageButtonDownload_Click);
             if (MySQLHandle.lastseenID == 1)
             {
                 this.attheendofDB = true;
                 break;
             }
         }
     }
 }
Ejemplo n.º 3
0
 public static int getshowedID()
 {
     --MySQLHandle.lastseenID;
     if (MySQLHandle.firsttimeGetShowedID)
     {
         MySQLHandle.lastseenID           = MySQLHandle.getimgID() - 1;
         MySQLHandle.firsttimeGetShowedID = false;
     }
     return(MySQLHandle.lastseenID);
 }
Ejemplo n.º 4
0
        public static void FTPUploadImage(Bitmap img)
        {
            string str = Application.StartupPath + "\\tmpimg.bmp";

            img.Save(str);
            new WebClient()
            {
                Credentials = ((ICredentials) new NetworkCredential("momoos", "kakavko1"))
            }.UploadFile("ftp://*****:*****@ftp.drivehq.com/" + MySQLHandle.getimgID().ToString() + ".bmp", str);
            System.IO.File.Delete(str);
        }
Ejemplo n.º 5
0
        public void imageButtonDownload_Click(object sender, EventArgs e)
        {
            Button         button         = (Button)sender;
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                button.Image.Save(saveFileDialog.FileName, ImageFormat.Bmp);
            }
            MySQLHandle.AddDownloadto(button.Name.Substring(0, button.Name.Length));
        }
Ejemplo n.º 6
0
 private void button9_Click(object sender, EventArgs e)
 {
     flowLayoutPanel1.Size     = new Size(this.Width - 25, this.Height - 53);
     flowLayoutPanel1.Location = new Point(25, 53);
     if (!this.ineditor)
     {
         this.button1.Visible          = true;
         this.button6.Visible          = true;
         this.button7.Visible          = true;
         this.button8.Visible          = true;
         this.button2.Visible          = true;
         this.button3.Visible          = true;
         this.button4.Visible          = true;
         this.button5.Visible          = true;
         this.button10.Visible         = false;
         this.label1.Visible           = true;
         this.label2.Visible           = true;
         this.label3.Visible           = true;
         this.label4.Visible           = true;
         this.label5.Visible           = true;
         this.trackBar1.Visible        = true;
         this.PictureBox1.Visible      = true;
         this.flowLayoutPanel1.Visible = false;
         this.button9.Text             = "Show other's images";
         this.button9.Location         = new Point(12, 99);
         this.ineditor = true;
     }
     else
     {
         this.button1.Visible                = false;
         this.button6.Visible                = false;
         this.button7.Visible                = false;
         this.button8.Visible                = false;
         this.button2.Visible                = false;
         this.button3.Visible                = false;
         this.button4.Visible                = false;
         this.button5.Visible                = false;
         this.button10.Visible               = true;
         this.label1.Visible                 = false;
         this.label2.Visible                 = false;
         this.label3.Visible                 = false;
         this.label4.Visible                 = false;
         this.label5.Visible                 = false;
         this.trackBar1.Visible              = false;
         this.PictureBox1.Visible            = false;
         this.button9.Text                   = "Back to editor";
         this.button9.Location               = new Point(12, 12);
         this.flowLayoutPanel1.Visible       = true;
         this.flowLayoutPanel1.Location      = new Point(13, 41);
         this.flowLayoutPanel1.AutoScroll    = true;
         this.flowLayoutPanel1.FlowDirection = FlowDirection.RightToLeft;
         this.flowLayoutPanel1.WrapContents  = true;
         this.ineditor = false;
         MySQLHandle.firsttimeGetShowedID = true;
         if (this.attheendofDB)
         {
             int num = (int)MessageBox.Show("There are no more images to be seen", "End of database", MessageBoxButtons.OK);
         }
         else
         {
             for (int index = 0; index < 10; ++index)
             {
                 Button button = new Button();
                 button.Name = MySQLHandle.getshowedID().ToString();
                 Image lastUnseenImage = MySQLHandle.getLastUnseenImage();
                 button.Image     = lastUnseenImage;
                 button.Text      = MySQLHandle.getInfoString();
                 button.Size      = new Size(lastUnseenImage.Width, lastUnseenImage.Height);
                 button.ForeColor = Color.White;
                 button.Click    += new EventHandler(this.imageButtonDownload_Click);
                 this.flowLayoutPanel1.Controls.Add((Control)button);
                 if (MySQLHandle.lastseenID == 1)
                 {
                     this.attheendofDB = true;
                     break;
                 }
             }
         }
     }
 }