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

📄 eventflashbacklightform.cs

📁 用C#实现的取得CellID和LAC的程序源代码!
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

using NiceTracker.Events;

namespace NiceTracker
{
	/// <summary>
	/// Summary description for EventFlashBacklightForm.
	/// </summary>
	public class EventFlashBacklightForm : System.Windows.Forms.Form, IEventConfigForm
	{
		private EventFlashBacklight configEvent = null;	
		private System.Windows.Forms.NumericUpDown numericUpDownDuration;
		private System.Windows.Forms.Label labelDescription;
		private System.Windows.Forms.TextBox textBoxDescription;
		private System.Windows.Forms.Label labelTrigger;
		private Microsoft.WindowsCE.Forms.InputPanel inputPanel1;
		private System.Windows.Forms.MainMenu mainMenu1;
		private System.Windows.Forms.Button buttonCells;
		private System.Windows.Forms.Label labelMode;
		private System.Windows.Forms.Button buttonAreas;
		private System.Windows.Forms.Button buttonTestEvent;
		private System.Windows.Forms.ComboBox comboBoxTrigger;
		private System.Windows.Forms.ComboBox comboBoxTriggerMode;
		private System.Windows.Forms.Label labelTitle;
	
		public EventFlashBacklightForm()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			buttonTestEvent.Visible = false;
		}

		public EventFlashBacklightForm( EventFlashBacklight evt )
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			configEvent = evt;	
		
			buttonTestEvent.Visible = true;

		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			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(EventFlashBacklightForm));
			this.numericUpDownDuration = new System.Windows.Forms.NumericUpDown();
			this.labelTitle = new System.Windows.Forms.Label();
			this.labelDescription = new System.Windows.Forms.Label();
			this.textBoxDescription = new System.Windows.Forms.TextBox();
			this.labelTrigger = new System.Windows.Forms.Label();
			this.inputPanel1 = new Microsoft.WindowsCE.Forms.InputPanel();
			this.mainMenu1 = new System.Windows.Forms.MainMenu();
			this.buttonCells = new System.Windows.Forms.Button();
			this.labelMode = new System.Windows.Forms.Label();
			this.buttonAreas = new System.Windows.Forms.Button();
			this.buttonTestEvent = new System.Windows.Forms.Button();
			this.comboBoxTrigger = new System.Windows.Forms.ComboBox();
			this.comboBoxTriggerMode = new System.Windows.Forms.ComboBox();
			// 
			// numericUpDownDuration
			// 
			this.numericUpDownDuration.Location = new System.Drawing.Point(80, 88);
			this.numericUpDownDuration.Size = new System.Drawing.Size(88, 20);
			// 
			// labelTitle
			// 
			this.labelTitle.Location = new System.Drawing.Point(8, 88);
			this.labelTitle.Size = new System.Drawing.Size(56, 16);
			this.labelTitle.Text = "Duration:";
			// 
			// labelDescription
			// 
			this.labelDescription.Location = new System.Drawing.Point(8, 8);
			this.labelDescription.Size = new System.Drawing.Size(72, 20);
			this.labelDescription.Text = "Description:";
			// 
			// textBoxDescription
			// 
			this.textBoxDescription.Location = new System.Drawing.Point(80, 8);
			this.textBoxDescription.Size = new System.Drawing.Size(152, 20);
			this.textBoxDescription.Text = "";
			this.textBoxDescription.LostFocus += new System.EventHandler(this.textBoxDescription_LostFocus);
			this.textBoxDescription.GotFocus += new System.EventHandler(this.textBoxDescription_GotFocus);
			// 
			// labelTrigger
			// 
			this.labelTrigger.Location = new System.Drawing.Point(8, 32);
			this.labelTrigger.Size = new System.Drawing.Size(56, 16);
			this.labelTrigger.Text = "Trigger:";
			// 
			// buttonCells
			// 
			this.buttonCells.Location = new System.Drawing.Point(168, 128);
			this.buttonCells.Size = new System.Drawing.Size(64, 20);
			this.buttonCells.Text = "Cells...";
			this.buttonCells.Click += new System.EventHandler(this.buttonCells_Click);
			// 
			// labelMode
			// 
			this.labelMode.Location = new System.Drawing.Point(8, 56);
			this.labelMode.Size = new System.Drawing.Size(64, 16);
			this.labelMode.Text = "Fire event:";
			// 
			// buttonAreas
			// 
			this.buttonAreas.Location = new System.Drawing.Point(88, 128);
			this.buttonAreas.Size = new System.Drawing.Size(64, 20);
			this.buttonAreas.Text = "Areas...";
			this.buttonAreas.Click += new System.EventHandler(this.buttonAreas_Click);
			// 
			// buttonTestEvent
			// 
			this.buttonTestEvent.Location = new System.Drawing.Point(8, 128);
			this.buttonTestEvent.Size = new System.Drawing.Size(64, 20);
			this.buttonTestEvent.Text = "Test";
			this.buttonTestEvent.Click += new System.EventHandler(this.buttonTestEvent_Click);
			// 
			// comboBoxTrigger
			// 
			this.comboBoxTrigger.Location = new System.Drawing.Point(80, 32);
			this.comboBoxTrigger.Size = new System.Drawing.Size(152, 21);
			// 
			// comboBoxTriggerMode
			// 
			this.comboBoxTriggerMode.Location = new System.Drawing.Point(80, 56);
			this.comboBoxTriggerMode.Size = new System.Drawing.Size(152, 21);
			// 
			// EventFlashBacklightForm
			// 
			this.ClientSize = new System.Drawing.Size(240, 272);
			this.Controls.Add(this.comboBoxTriggerMode);
			this.Controls.Add(this.comboBoxTrigger);
			this.Controls.Add(this.buttonTestEvent);
			this.Controls.Add(this.buttonAreas);
			this.Controls.Add(this.labelMode);
			this.Controls.Add(this.buttonCells);
			this.Controls.Add(this.labelTrigger);
			this.Controls.Add(this.textBoxDescription);
			this.Controls.Add(this.labelDescription);
			this.Controls.Add(this.labelTitle);
			this.Controls.Add(this.numericUpDownDuration);
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.Menu = this.mainMenu1;
			this.Text = "Flash Backlight";
			this.Load += new System.EventHandler(this.EventFlashBacklightForm_Load);

		}
		#endregion

		private void buttonOK_Click(object sender, System.EventArgs e)
		{					
			this.DialogResult = DialogResult.OK;

			this.Close();
		}

		private void textBoxDescription_GotFocus(object sender, System.EventArgs e)
		{
			inputPanel1.Enabled = true;
		}

		public EventFlashBacklight ConfiguredEvent
		{
			get
			{
				return configEvent;
			}
		}

		private void textBoxDescription_LostFocus(object sender, EventArgs e)
		{
			inputPanel1.Enabled = false;
		}

		private void EventFlashBacklightForm_Load(object sender, System.EventArgs e)
		{

			EventConfigBase.PopulateTriggerType( comboBoxTrigger );
			EventConfigBase.PopulateTriggerModeType( comboBoxTriggerMode );

			EventConfigBase.Adapt( configEvent, this );

			numericUpDownDuration.Value = configEvent.Duration;

			Application.DoEvents();
		}

		private void buttonCells_Click(object sender, System.EventArgs e)
		{
			CellChooserForm ccf = new CellChooserForm( configEvent );
			if ( ccf.ShowDialog() == DialogResult.OK )
			{
				configEvent.ClearCells();

				foreach ( GSMCell gsmCell in ccf.SelectedCells )
				{
					configEvent.AddCell( gsmCell );
				}
			}
		}

		private void buttonAreas_Click(object sender, System.EventArgs e)
		{
			AreaChooserForm acf = new AreaChooserForm( configEvent );
			if ( acf.ShowDialog() == DialogResult.OK )
			{
				configEvent.ClearAreas();

				foreach ( GSMCell gsmCell in acf.SelectedAreas )
				{
					configEvent.AddArea( gsmCell );
				}
			}
		}

		public void MakeChanges( )
		{
			configEvent.Duration = Convert.ToInt32( numericUpDownDuration.Value );

			EventConfigBase.Adapt( this, configEvent );
		}

		private void buttonTestEvent_Click(object sender, System.EventArgs e)
		{
			if ( configEvent != null )
				configEvent.Action();
		}

		public string Description
		{
			get
			{
				return textBoxDescription.Text;
			}
			set
			{
				textBoxDescription.Text = value;
			}
		}

		public int Trigger
		{
			get
			{
				return comboBoxTrigger.SelectedIndex;
			}
			set
			{
				comboBoxTrigger.SelectedIndex = value;
			}
		}

		public int TriggerMode
		{
			get
			{
				return comboBoxTriggerMode.SelectedIndex;
			}
			set
			{
				comboBoxTriggerMode.SelectedIndex = value;
			}
		}
	}
}

⌨️ 快捷键说明

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