Exemplo n.º 1
0
 private void OnClickOKButton(object sender, EventArgs e)
 {
     string userName = this._userNameTextBox.Text.Trim();
     string password = this._passwordTextBox.Text.Trim();
     string uriString = this._siteTextBox.Text.Trim();
     string s = this._portTextBox.Text.Trim();
     int port = 0x15;
     try
     {
         Uri uri = new Uri(uriString);
         uriString = uri.Host;
     }
     catch
     {
     }
     if (s.Length != 0)
     {
         try
         {
             port = int.Parse(s);
             if (port <= 0)
             {
                 throw new Exception();
             }
         }
         catch
         {
             ((IMxUIService) this.GetService(typeof(IUIService))).ReportError("The specified port is not a valid port number.", this.Text, false);
             return;
         }
     }
     this._httpRoot = this._httpRootTextBox.Text.Trim();
     if ((this._httpRoot.Length == 0) || (!this._httpRoot.StartsWith("/") && !this._httpRoot.EndsWith("/")))
     {
         this._okButton.Enabled = false;
         this._gradientBand.Visible = true;
         this._gradientBand.Start();
         this._connectionTask = new ConnectionAsyncTask(uriString, port, userName, password);
         this._connectionTask.Start(new AsyncTaskResultPostedEventHandler(this.OnConnectionComplete));
     }
     else
     {
         ((IMxUIService) this.GetService(typeof(IUIService))).ReportError("The specified Web directory is invalid.\r\nYou should not having leading or trailing slashes in your path.", this.Text, false);
     }
 }
Exemplo n.º 2
0
 private void OnConnectionComplete(object sender, AsyncTaskResultPostedEventArgs e)
 {
     this._gradientBand.Stop();
     this._gradientBand.Visible = false;
     this._okButton.Enabled = true;
     this._connectionTask = null;
     this._connection = (FtpConnection) e.Data;
     if (this._connection != null)
     {
         this._httpUrl = this._httpUrlTextBox.Text.Trim();
         if (this._httpUrl.EndsWith("/"))
         {
             this._httpUrl = this._httpUrl.Substring(0, this._httpUrl.Length - 1);
         }
         base.DialogResult = DialogResult.OK;
         base.Close();
     }
     else
     {
         ((IMxUIService) this.GetService(typeof(IMxUIService))).ReportError("Could not connect to the specified FTP site.\r\nCheck the site address and user information before trying again.", this.Text, false);
     }
 }
Exemplo n.º 3
0
 private void OnClickCancelButton(object sender, EventArgs e)
 {
     if (this._connectionTask != null)
     {
         this._gradientBand.Stop();
         this._gradientBand.Visible = false;
         this._okButton.Enabled = true;
         this._connectionTask = null;
     }
     else
     {
         base.DialogResult = DialogResult.Cancel;
         base.Close();
     }
 }