00001 using System;
00002 using System.Drawing;
00003 using System.Collections;
00004 using System.ComponentModel;
00005 using System.Windows.Forms;
00006 using System.Data;
00007
00008 namespace Tamir.SharpSsh.jsch.examples
00009 {
00013 public class InputForm : System.Windows.Forms.Form
00014 {
00015 public System.Windows.Forms.TextBox textBox1;
00016 private System.Windows.Forms.Button btnOK;
00017 private System.Windows.Forms.Button btnCancel;
00021 private System.ComponentModel.Container components = null;
00022
00023 public InputForm()
00024 {
00025
00026
00027
00028 InitializeComponent();
00029
00030
00031
00032
00033 }
00034
00038 protected override void Dispose( bool disposing )
00039 {
00040 if( disposing )
00041 {
00042 if (components != null)
00043 {
00044 components.Dispose();
00045 }
00046 }
00047 base.Dispose( disposing );
00048 }
00049
00050 #region Windows Form Designer generated code
00055 private void InitializeComponent()
00056 {
00057 this.textBox1 = new System.Windows.Forms.TextBox();
00058 this.btnOK = new System.Windows.Forms.Button();
00059 this.btnCancel = new System.Windows.Forms.Button();
00060 this.SuspendLayout();
00061
00062
00063
00064 this.textBox1.Location = new System.Drawing.Point(56, 24);
00065 this.textBox1.Name = "textBox1";
00066 this.textBox1.Size = new System.Drawing.Size(160, 20);
00067 this.textBox1.TabIndex = 0;
00068 this.textBox1.Text = "";
00069
00070
00071
00072 this.btnOK.Location = new System.Drawing.Point(56, 64);
00073 this.btnOK.Name = "btnOK";
00074 this.btnOK.TabIndex = 1;
00075 this.btnOK.Text = "OK";
00076 this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
00077
00078
00079
00080 this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
00081 this.btnCancel.Location = new System.Drawing.Point(144, 64);
00082 this.btnCancel.Name = "btnCancel";
00083 this.btnCancel.TabIndex = 2;
00084 this.btnCancel.Text = "Cancel";
00085 this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
00086
00087
00088
00089 this.AcceptButton = this.btnOK;
00090 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
00091 this.CancelButton = this.btnCancel;
00092 this.ClientSize = new System.Drawing.Size(264, 110);
00093 this.Controls.Add(this.btnCancel);
00094 this.Controls.Add(this.btnOK);
00095 this.Controls.Add(this.textBox1);
00096 this.Name = "InputForm";
00097 this.Text = "Form1";
00098 this.ResumeLayout(false);
00099
00100 }
00101 #endregion
00102
00103 bool okBtnClicked = false;
00104
00105 private void btnOK_Click(object sender, System.EventArgs e)
00106 {
00107 okBtnClicked = true;
00108 this.Hide();
00109 }
00110
00111 private void btnCancel_Click(object sender, System.EventArgs e)
00112 {
00113 okBtnClicked = false;
00114 this.textBox1.Text = "";
00115 this.Hide();
00116 }
00117
00118 public bool PromptForInput()
00119 {
00120 this.ShowDialog();
00121 return okBtnClicked;
00122 }
00123
00124 public string getText()
00125 {
00126 return textBox1.Text;
00127 }
00128
00129 public bool PasswordField
00130 {
00131 get
00132 {
00133 return (textBox1.PasswordChar.Equals(0));
00134 }
00135 set
00136 {
00137 if (value)
00138 textBox1.PasswordChar='*';
00139 else
00140 textBox1.PasswordChar=(char)0;
00141 }
00142 }
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152 }
00153 }