Ejemplo n.º 1
0
        void connectEvent(object sender, System.EventArgs e)
        {
            try
            {
                bool isFinished = false;
                if (new Regex(ipFormat).IsMatch(ipBox.Text))
                {
                    ftp = new FtpConnection(ipBox.Text);
                    NewThread(new System.Action(() =>
                    {
                        for (int i = defaultSize; i < maxSize; i++)
                        {
                            this.Size = new System.Drawing.Size(389, i);
                        }
                        ftp.SetCurrentDirectory("/dev_hdd0/home");

                        foreach (var item in ftp.GetDirectories("/dev_hdd0/home"))
                        {
                            if (item.Name.Length > 5)
                            {
                                accLists.Items.Add(ftp.ReadFile("/dev_hdd0/home/" + item.Name + "/localusername"));
                                allusers.Add(item.Name);
                            }
                        }
                        isFinished = true;
                    }));
                    while (!isFinished)
                    {
                        Application.DoEvents();
                    }
                    this.commentBox.Depth                    = 0;
                    this.commentBox.Hint                     = "";
                    this.commentBox.Location                 = new System.Drawing.Point(24, 267);
                    this.commentBox.MouseState               = MaterialSkin.MouseState.HOVER;
                    this.commentBox.Name                     = "materialSingleLineTextField1";
                    this.commentBox.PasswordChar             = '\0';
                    this.commentBox.SelectedText             = "";
                    this.commentBox.SelectionLength          = 0;
                    this.commentBox.SelectionStart           = 0;
                    this.commentBox.Size                     = new System.Drawing.Size(339, 23);
                    this.commentBox.TabIndex                 = 3;
                    this.commentBox.UseSystemPasswordChar    = false;
                    this.sendComment.AutoSize                = true;
                    this.sendComment.AutoSizeMode            = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
                    this.sendComment.Depth                   = 0;
                    this.sendComment.Location                = new System.Drawing.Point(134, 303);
                    this.sendComment.Margin                  = new System.Windows.Forms.Padding(4, 6, 4, 6);
                    this.sendComment.MouseState              = MaterialSkin.MouseState.HOVER;
                    this.sendComment.Name                    = "sendComment";
                    this.sendComment.Primary                 = false;
                    this.sendComment.Size                    = new System.Drawing.Size(118, 36);
                    this.sendComment.TabIndex                = 4;
                    this.sendComment.Text                    = "Send Comment";
                    this.sendComment.UseVisualStyleBackColor = true;
                    this.sendComment.Click                  += sendCommentClick;
                    this.Controls.Add(this.commentBox);
                    this.Controls.Add(this.sendComment);
                }
                else
                {
                    MetroMessageBox.Show(this, "Error ip addrees not in correct format", "Success", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MetroMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }