Создание Windows-приложений на основе Visual C#


           

Clean up any resources being


using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms;
namespace MailApplication { /// <summary> /// Summary description for CUWStep2. /// </summary> public class CUWStep2 : System.Windows.Forms.Form { private UserIdentity identity; private System.Windows.Forms.Label lblPop3Sample; private System.Windows.Forms.TextBox txbPop3; private System.Windows.Forms.Label lblPop3; private System.Windows.Forms.Label lblPop3PortSample; private System.Windows.Forms.TextBox txbPop3Port; private System.Windows.Forms.Label lblPop3Port; private System.Windows.Forms.Button btnNext; /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.Container components = null;
public CUWStep2(UserIdentity identity) { InitializeComponent();
this.identity = identity; }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); }
#region Windows Form Designer generated code /// <summary> /// Required method for Designer support — do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(CUWStep2)); this.lblPop3Sample = new System.Windows.Forms.Label(); this.txbPop3 = new System.Windows.Forms.TextBox(); this.lblPop3 = new System.Windows.Forms.Label(); this.lblPop3PortSample = new System.Windows.Forms.Label(); this.txbPop3Port = new System.Windows.Forms.TextBox(); this.lblPop3Port = new System.Windows.Forms.Label(); this.btnNext = new System.Windows.Forms.Button(); this.SuspendLayout(); // // lblPop3Sample // this.lblPop3Sample.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lblPop3Sample.ForeColor = System.Drawing.SystemColors.AppWorkspace; this.lblPop3Sample.Location = new System.Drawing.Point(26, 64); this.lblPop3Sample.Name = "lblPop3Sample"; this.lblPop3Sample.Size = new System.Drawing.Size(240, 23); this.lblPop3Sample.TabIndex = 5; this.lblPop3Sample.Text = "Например, pop3.mail.com"; this.lblPop3Sample.TextAlign = System.Drawing.ContentAlignment.TopRight; // // txbPop3 // this.txbPop3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.txbPop3.Location = new System.Drawing.Point(26, 40); this.txbPop3.Name = "txbPop3"; this.txbPop3.Size = new System.Drawing.Size(240, 20); this.txbPop3.TabIndex = 4; this.txbPop3.Text = ""; // // lblPop3 // this.lblPop3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lblPop3.Location = new System.Drawing.Point(26, 8); this.lblPop3.Name = "lblPop3"; this.lblPop3.Size = new System.Drawing.Size(240, 23); this.lblPop3.TabIndex = 3; this.lblPop3.Text = "Введите адрес сервера POP3:"; this.lblPop3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // lblPop3PortSample // this.lblPop3PortSample.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lblPop3PortSample.ForeColor = System.Drawing.SystemColors.AppWorkspace; this.lblPop3PortSample.Location = new System.Drawing.Point(26, 160); this.lblPop3PortSample.Name = "lblPop3PortSample"; this.lblPop3PortSample.Size = new System.Drawing.Size(240, 23); this.lblPop3PortSample.TabIndex = 8; this.lblPop3PortSample.Text = "Например, 110"; this.lblPop3PortSample.TextAlign = System.Drawing.ContentAlignment.TopRight; // // txbPop3Port // this.txbPop3Port.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.txbPop3Port.Location = new System.Drawing.Point(26, 136); this.txbPop3Port.Name = "txbPop3Port"; this.txbPop3Port.Size = new System.Drawing.Size(240, 20); this.txbPop3Port.TabIndex = 7; this.txbPop3Port.Text = "110"; // // lblPop3Port // this.lblPop3Port.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lblPop3Port.Location = new System.Drawing.Point(26, 104); this.lblPop3Port.Name = "lblPop3Port"; this.lblPop3Port.Size = new System.Drawing.Size(240, 23); this.lblPop3Port.TabIndex = 6; this.lblPop3Port.Text = "Укажите почтовый порт:"; this.lblPop3Port.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // btnNext // this.btnNext.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnNext.Location = new System.Drawing.Point(192, 200); this.btnNext.Name = "btnNext"; this.btnNext.TabIndex = 9; this.btnNext.Text = "Далее"; this.btnNext.Click += new System.EventHandler(this.btnNext_Click); // // CUWStep2 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(292, 238); this.Controls.Add(this.btnNext); this.Controls.Add(this.lblPop3PortSample); this.Controls.Add(this.txbPop3Port); this.Controls.Add(this.lblPop3Port); this.Controls.Add(this.lblPop3Sample); this.Controls.Add(this.txbPop3); this.Controls.Add(this.lblPop3); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "CUWStep2"; this.Text = "Шаг 2 из 3"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.ResumeLayout(false);
} #endregion
private void btnNext_Click(object sender, System.EventArgs e) { if(txbPop3.Text == "") { MessageBox.Show("Введите адрес сервера POP3"); } else { this.identity.Pop3 = txbPop3.Text; try { //Преобразовываем введенное значение в тип Int32 this.identity.Pop3Port = Int32.Parse(txbPop3Port.Text); CUWStep3 step3 = new CUWStep3(this.identity); step3.MdiParent = this.MdiParent; this.Close(); step3.Show(); } catch(Exception) { MessageBox.Show("Значение порта должно быть числом"); } }
} } }
Листинг 3.20.
Закрыть окно
Содержание  Назад  Вперед