⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmcircuitinfoconfig.cs

📁 该项目实现在.net 2003上
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

using ctd.E1Analyzer.GlobalConstant;

namespace SmartE1Analyzer
{
	/// <summary>
	/// frmCircuitInfoConfig 的摘要说明。
	/// </summary>
	public class frmCircuitInfoConfig : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Label lblStation;
		private System.Windows.Forms.Label lblCircuitCode;
		private System.Windows.Forms.TextBox txtStationName;
		private System.Windows.Forms.TextBox txtCircuitName;
		private System.Windows.Forms.Button btnOK;
		private System.Windows.Forms.ComboBox comboFrameOrRate;
		private System.Windows.Forms.Label lblFrameOrRate;
		private System.Windows.Forms.ComboBox comboClockSel;
		private System.Windows.Forms.Label lblClockSel;
		private System.Windows.Forms.ComboBox comboAsynSel;
		private System.Windows.Forms.Label lblAsynSel;
		private System.Windows.Forms.ComboBox comboDTEorDCE;
		private System.Windows.Forms.Label lblDTEorDCEsel;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.ComboBox comboInterfaceType;
		private System.Windows.Forms.Button btnCancel;
	    private frmMain m_ParentFrm;
		public frmCircuitInfoConfig(frmMain frm)
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
			this.m_ParentFrm = frm;
		}

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

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.lblStation = new System.Windows.Forms.Label();
			this.lblCircuitCode = new System.Windows.Forms.Label();
			this.txtStationName = new System.Windows.Forms.TextBox();
			this.txtCircuitName = new System.Windows.Forms.TextBox();
			this.btnOK = new System.Windows.Forms.Button();
			this.btnCancel = new System.Windows.Forms.Button();
			this.comboFrameOrRate = new System.Windows.Forms.ComboBox();
			this.lblFrameOrRate = new System.Windows.Forms.Label();
			this.comboClockSel = new System.Windows.Forms.ComboBox();
			this.lblClockSel = new System.Windows.Forms.Label();
			this.comboAsynSel = new System.Windows.Forms.ComboBox();
			this.lblAsynSel = new System.Windows.Forms.Label();
			this.comboDTEorDCE = new System.Windows.Forms.ComboBox();
			this.lblDTEorDCEsel = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.comboInterfaceType = new System.Windows.Forms.ComboBox();
			// 
			// lblStation
			// 
			this.lblStation.Location = new System.Drawing.Point(32, 25);
			this.lblStation.Size = new System.Drawing.Size(64, 16);
			this.lblStation.Text = "所属局站";
			// 
			// lblCircuitCode
			// 
			this.lblCircuitCode.Location = new System.Drawing.Point(32, 49);
			this.lblCircuitCode.Size = new System.Drawing.Size(56, 16);
			this.lblCircuitCode.Text = "电路名称";
			// 
			// txtStationName
			// 
			this.txtStationName.Location = new System.Drawing.Point(104, 17);
			this.txtStationName.Size = new System.Drawing.Size(80, 21);
			this.txtStationName.Text = "";
			// 
			// txtCircuitName
			// 
			this.txtCircuitName.Location = new System.Drawing.Point(104, 41);
			this.txtCircuitName.Size = new System.Drawing.Size(80, 21);
			this.txtCircuitName.Text = "";
			// 
			// btnOK
			// 
			this.btnOK.Location = new System.Drawing.Point(96, 216);
			this.btnOK.Size = new System.Drawing.Size(64, 24);
			this.btnOK.Text = "确定[&Y]";
			this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
			// 
			// btnCancel
			// 
			this.btnCancel.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular);
			this.btnCancel.Location = new System.Drawing.Point(168, 216);
			this.btnCancel.Size = new System.Drawing.Size(64, 24);
			this.btnCancel.Text = "取消[&C]";
			this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
			// 
			// comboFrameOrRate
			// 
			this.comboFrameOrRate.Items.Add("PCM30");
			this.comboFrameOrRate.Items.Add("PCM30C");
			this.comboFrameOrRate.Items.Add("PCM31");
			this.comboFrameOrRate.Items.Add("PCM31C");
			this.comboFrameOrRate.Location = new System.Drawing.Point(104, 169);
			this.comboFrameOrRate.Size = new System.Drawing.Size(88, 20);
			// 
			// lblFrameOrRate
			// 
			this.lblFrameOrRate.Location = new System.Drawing.Point(32, 173);
			this.lblFrameOrRate.Size = new System.Drawing.Size(64, 16);
			this.lblFrameOrRate.Text = "帧结构/速率";
			// 
			// comboClockSel
			// 
			this.comboClockSel.Items.Add("内时钟");
			this.comboClockSel.Items.Add("外时钟");
			this.comboClockSel.Location = new System.Drawing.Point(104, 145);
			this.comboClockSel.Size = new System.Drawing.Size(88, 20);
			// 
			// lblClockSel
			// 
			this.lblClockSel.Location = new System.Drawing.Point(32, 150);
			this.lblClockSel.Size = new System.Drawing.Size(64, 16);
			this.lblClockSel.Text = "时钟方式";
			// 
			// comboAsynSel
			// 
			this.comboAsynSel.Items.Add("同步");
			this.comboAsynSel.Items.Add("异步");
			this.comboAsynSel.Location = new System.Drawing.Point(104, 121);
			this.comboAsynSel.Size = new System.Drawing.Size(88, 20);
			// 
			// lblAsynSel
			// 
			this.lblAsynSel.Location = new System.Drawing.Point(32, 127);
			this.lblAsynSel.Size = new System.Drawing.Size(56, 16);
			this.lblAsynSel.Text = "同步选择";
			// 
			// comboDTEorDCE
			// 
			this.comboDTEorDCE.Items.Add("DTE");
			this.comboDTEorDCE.Items.Add("DCE");
			this.comboDTEorDCE.Location = new System.Drawing.Point(104, 97);
			this.comboDTEorDCE.Size = new System.Drawing.Size(88, 20);
			// 
			// lblDTEorDCEsel
			// 
			this.lblDTEorDCEsel.Location = new System.Drawing.Point(32, 101);
			this.lblDTEorDCEsel.Size = new System.Drawing.Size(64, 16);
			this.lblDTEorDCEsel.Text = "DTE/DCE选择";
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(32, 76);
			this.label3.Size = new System.Drawing.Size(56, 16);
			this.label3.Text = "接口类别";
			// 
			// comboInterfaceType
			// 
			this.comboInterfaceType.Location = new System.Drawing.Point(104, 73);
			this.comboInterfaceType.Size = new System.Drawing.Size(88, 20);
			this.comboInterfaceType.SelectedIndexChanged += new System.EventHandler(this.comboInterfaceType_SelectedIndexChanged);
			// 
			// frmCircuitInfoConfig
			// 
			this.Controls.Add(this.comboFrameOrRate);
			this.Controls.Add(this.lblFrameOrRate);
			this.Controls.Add(this.comboClockSel);
			this.Controls.Add(this.lblClockSel);
			this.Controls.Add(this.comboAsynSel);
			this.Controls.Add(this.lblAsynSel);
			this.Controls.Add(this.comboDTEorDCE);
			this.Controls.Add(this.lblDTEorDCEsel);
			this.Controls.Add(this.label3);
			this.Controls.Add(this.comboInterfaceType);
			this.Controls.Add(this.btnCancel);
			this.Controls.Add(this.btnOK);
			this.Controls.Add(this.txtCircuitName);
			this.Controls.Add(this.txtStationName);
			this.Controls.Add(this.lblCircuitCode);
			this.Controls.Add(this.lblStation);
			this.Location = new System.Drawing.Point(30, 30);
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Text = "电路和设备基本信息设置";
			this.Load += new System.EventHandler(this.frmCircuitInfoConfig_Load);

		}
		#endregion

		private void btnOK_Click(object sender, System.EventArgs e)
		{
			//	
			byte [] data = new byte[9];
			data[0] = 0;
			data[1] = MsgCommandId.INFO_SET;

			data[2] = (byte)((comboDTEorDCE.SelectedIndex << 4) | (byte)comboInterfaceType.SelectedIndex);
			data[3] =  (byte)((comboClockSel.SelectedIndex<<4) | (byte)comboAsynSel.SelectedIndex);
			if(comboInterfaceType.Text == "2M成帧")
				data[4] = (byte)(comboFrameOrRate.SelectedIndex + 1);
			else if(comboInterfaceType.Text == "2M非帧")
				data[4] = 0;
			else if(comboInterfaceType.Text == "V35同步")
			{
				
				data[4] = (byte)(comboFrameOrRate.SelectedIndex + 1);
				
			}
			else if(comboInterfaceType.Text == "RS232" 
				|| comboInterfaceType.Text == "RS422")
			{
				data[4] = (byte)(comboFrameOrRate.SelectedIndex + 1);
			}
			data[5] = 0;
			data[6] = 0;
			data[7] = 0;
			data[8] = 0;
			this.m_ParentFrm.m_CircuitInfo.szData = data;
			this.m_ParentFrm.m_EquipAndPerformInfo.m_CirConfigParam.StaName = this.txtStationName.Text;
			this.m_ParentFrm.m_EquipAndPerformInfo.m_CirConfigParam.CirName = this.txtCircuitName.Text;
            this.Close();
			
		}

		private void frmCircuitInfoConfig_Load(object sender, System.EventArgs e)
		{
			
            comboInterfaceType.Items.Add("2M非帧");
			comboInterfaceType.Items.Add("2M成帧");
			comboInterfaceType.Items.Add("V35同步");
			comboInterfaceType.Items.Add("RS232");
			comboInterfaceType.Items.Add("RS422");

			comboInterfaceType.Text = "2M成帧";
			comboInterfaceType.SelectedIndex = 1;

			
			comboDTEorDCE.Text = "DTE";

			comboAsynSel.Text = "同步";
            
			comboClockSel.Text = "内时钟";
			comboClockSel.SelectedIndex = 0;

            comboFrameOrRate.Text = "PCM30";
			comboFrameOrRate.SelectedIndex = 0;

			//
			Rectangle screen = Screen.PrimaryScreen.Bounds;
			this.Location = new Point((screen.Width - this.Width) / 2,
				(screen.Height - this.Height ) / 2);



		}

		private void comboInterfaceType_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			switch(comboInterfaceType.Text)
			{
				case "2M成帧":

					lblDTEorDCEsel.Visible = false;
					comboDTEorDCE.Visible = false;

					lblAsynSel.Visible = false;
					comboAsynSel.Visible = false;

					lblClockSel.Visible = true;
					comboClockSel.Visible = true;
					comboClockSel.Items.Clear();
					comboClockSel.Items.Add("内时钟");
					comboClockSel.Items.Add("外时钟");
					comboClockSel.Text = "内时钟";

					lblFrameOrRate.Visible = true;
					lblFrameOrRate.Text = "帧结构";

					comboFrameOrRate.Visible = true;
					comboFrameOrRate.Items.Clear();
					comboFrameOrRate.Items.Add("PCM30");
					comboFrameOrRate.Items.Add("PCM30C");
					comboFrameOrRate.Items.Add("PCM31");
					comboFrameOrRate.Items.Add("PCM31C");
					comboFrameOrRate.Text = "PCM30";

					//btnTS.Visible = false;
					//txtTS.Visible = false;

					break;
				case "2M非帧":
					
					lblDTEorDCEsel.Visible = false;
					comboDTEorDCE.Visible = false;

					lblAsynSel.Visible = false;
					comboAsynSel.Visible = false;

					lblClockSel.Visible = true;
					comboClockSel.Visible = true;
					comboClockSel.Items.Clear();
					comboClockSel.Items.Add("内时钟");
					comboClockSel.Items.Add("外时钟");
					comboClockSel.Text = "内时钟";

					lblFrameOrRate.Visible = false;
					
					comboFrameOrRate.Visible = false;
					
					//btnTS.Visible = false;
					//txtTS.Visible = false;
					break;
				case "V35同步":

					lblDTEorDCEsel.Visible = true;
					comboDTEorDCE.Visible =  true;
					comboDTEorDCE.Items.Clear();
					comboDTEorDCE.Items.Add("DTE");
					comboDTEorDCE.Items.Add("DCE");
					comboDTEorDCE.Text = "DTE";


					lblAsynSel.Visible = false;
					comboAsynSel.Visible = false;

					lblClockSel.Visible = true;
					comboClockSel.Visible = true;
					comboClockSel.Items.Clear();
					comboClockSel.Items.Add("内时钟");
					comboClockSel.Items.Add("外时钟");
					comboClockSel.Text = "内时钟";

					lblFrameOrRate.Visible = true;
					lblFrameOrRate.Text = "速率选择";

					comboFrameOrRate.Visible = true;
					comboFrameOrRate.Items.Clear();
					for(int i = 1;i <= 32; i++)
					{
						string str = " x 64K";
						comboFrameOrRate.Items.Add(i.ToString() + str);
					}
					comboFrameOrRate.Items.Add("2.4K");
					comboFrameOrRate.Items.Add("4.8K");
					comboFrameOrRate.Items.Add("9.6K");
					comboFrameOrRate.Items.Add("19.2K");

					comboFrameOrRate.Text = "19.2K";

					//btnTS.Visible = false;
					//txtTS.Visible = false;
					break;
				case "RS422":case "RS232":
					lblDTEorDCEsel.Visible = true;
					comboDTEorDCE.Visible =  true;
					comboDTEorDCE.Items.Clear();
					comboDTEorDCE.Items.Add("DTE");
					comboDTEorDCE.Items.Add("DCE");
					comboDTEorDCE.Text = "DTE";


					lblAsynSel.Visible = true;
					comboAsynSel.Visible = true;
					comboAsynSel.Items.Clear();
					comboAsynSel.Items.Add("同步");
					comboAsynSel.Items.Add("异步");
					comboAsynSel.Text = "同步";

					lblClockSel.Visible = true;
					comboClockSel.Visible = true;
					comboClockSel.Items.Clear();
					comboClockSel.Items.Add("内时钟");
					comboClockSel.Items.Add("外时钟");
					comboClockSel.Text = "内时钟";

					lblFrameOrRate.Visible = true;
					lblFrameOrRate.Text = "速率选择";

					comboFrameOrRate.Visible = true;
					comboFrameOrRate.Items.Clear();
					comboFrameOrRate.Items.Add("50");
					comboFrameOrRate.Items.Add("300");
					comboFrameOrRate.Items.Add("1.2K");
					comboFrameOrRate.Items.Add("2.4K");
					comboFrameOrRate.Items.Add("4.8K");
					comboFrameOrRate.Items.Add("9.6K");
					comboFrameOrRate.Items.Add("19.2K");
					comboFrameOrRate.Text = "19.2K";

					//btnTS.Visible = false;
					//txtTS.Visible = false;
					break;
				default:
					break;


			}
		}

		private void btnCancel_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}
		
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -