コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            uncheck_all();
            ftp.ftp_options connection_options = new ftp.ftp_options();
            connection_options.login    = ftplogin_textBox.Text;
            connection_options.password = ftppassword_textBox.Text;
            connection_options.host     = host_textBox.Text;
            connection_options.path     = folder_textBox.Text;
            ftp connection = new ftp();

            var connection_status = connection.check_connection(connection_options);

            if (connection_status.no_error)
            {
                pictureBox1.ImageLocation = path + "\\img\\check.png";
                pictureBox2.ImageLocation = path + "\\img\\check.png";
                pictureBox3.ImageLocation = path + "\\img\\check.png";
            }
            else
            {
                switch (connection_status.error_status)
                {
                case 2: pictureBox1.ImageLocation = path + "\\img\\check.png"; break;

                case 3: pictureBox1.ImageLocation = path + "\\img\\check.png"; pictureBox2.ImageLocation = path + "\\img\\check.png"; break;
                }
            }

            if (connection_status.no_error)
            {
                var list = connection.file_list(connection_options);
                if (list.Count > 0)
                {
                    files_listBox.DataSource  = list;
                    pictureBox4.ImageLocation = path + "\\img\\check.png";
                }
            }
        }