using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace CSHARPTOVBNET
{
	/// <summary>
	/// Form1 的摘要说明。
	/// </summary>
	public class MainApp : System.Windows.Forms.Form
	{
		private System.Windows.Forms.TextBox txtCSharp;
		private System.Windows.Forms.TextBox txtVBNET;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Button btnConvert;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public MainApp()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.txtCSharp = new System.Windows.Forms.TextBox();
			this.txtVBNET = new System.Windows.Forms.TextBox();
			this.label1 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.btnConvert = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// txtCSharp
			// 
			this.txtCSharp.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.txtCSharp.Location = new System.Drawing.Point(0, 40);
			this.txtCSharp.Multiline = true;
			this.txtCSharp.Name = "txtCSharp";
			this.txtCSharp.ScrollBars = System.Windows.Forms.ScrollBars.Both;
			this.txtCSharp.Size = new System.Drawing.Size(528, 136);
			this.txtCSharp.TabIndex = 0;
			this.txtCSharp.Text = "";
			// 
			// txtVBNET
			// 
			this.txtVBNET.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.txtVBNET.Location = new System.Drawing.Point(0, 216);
			this.txtVBNET.Multiline = true;
			this.txtVBNET.Name = "txtVBNET";
			this.txtVBNET.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
			this.txtVBNET.Size = new System.Drawing.Size(528, 160);
			this.txtVBNET.TabIndex = 1;
			this.txtVBNET.Text = "";
			// 
			// label1
			// 
			this.label1.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label1.Location = new System.Drawing.Point(0, 192);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(144, 23);
			this.label1.TabIndex = 2;
			this.label1.Text = "生成的VB.NET代码块:";
			// 
			// label2
			// 
			this.label2.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label2.Location = new System.Drawing.Point(8, 8);
			this.label2.Name = "label2";
			this.label2.TabIndex = 3;
			this.label2.Text = "C#代码块:";
			// 
			// btnConvert
			// 
			this.btnConvert.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
			this.btnConvert.Location = new System.Drawing.Point(120, 8);
			this.btnConvert.Name = "btnConvert";
			this.btnConvert.Size = new System.Drawing.Size(104, 24);
			this.btnConvert.TabIndex = 4;
			this.btnConvert.Text = "生成VB.NET代码";
			this.btnConvert.Click += new System.EventHandler(this.btnConvert_Click);
			// 
			// MainApp
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(528, 373);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.btnConvert,
																		  this.label2,
																		  this.label1,
																		  this.txtVBNET,
																		  this.txtCSharp});
			this.Name = "MainApp";
			this.Text = "C#-->VB.NET";
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// 应用程序的主入口点。
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new MainApp());
		}

		private void btnConvert_Click(object sender, System.EventArgs e)
		{
			//初始化服务
			net.kamalpatel.www.ConvertCSharp2VBService oService;
			oService = new net.kamalpatel.www.ConvertCSharp2VBService();
			//调用execute方法,处理格式
			string lcStr = oService.Execute(this.txtCSharp.Text);
			this.txtVBNET.Text = lcStr.Replace("\n", "\r\n");
			 
		}
	}
}
