📄 eventinternetpostform.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 EventInternetPostForm : System.Windows.Forms.Form, IEventConfigForm
{
private EventInternetPost configEvent = null;
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.TextBox textBoxURL;
private System.Windows.Forms.Label labelNoteText;
private System.Windows.Forms.ComboBox comboBoxTrigger;
private System.Windows.Forms.ComboBox comboBoxTriggerMode;
private System.Windows.Forms.Label labelTitle;
public EventInternetPostForm()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
buttonTestEvent.Visible = false;
}
public EventInternetPostForm( EventInternetPost 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(EventInternetPostForm));
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.textBoxURL = new System.Windows.Forms.TextBox();
this.labelNoteText = new System.Windows.Forms.Label();
this.comboBoxTrigger = new System.Windows.Forms.ComboBox();
this.comboBoxTriggerMode = new System.Windows.Forms.ComboBox();
//
// labelTitle
//
this.labelTitle.Location = new System.Drawing.Point(8, 80);
this.labelTitle.Size = new System.Drawing.Size(56, 16);
this.labelTitle.Text = "URL:";
//
// 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, 20);
this.labelTrigger.Text = "Trigger:";
//
// buttonCells
//
this.buttonCells.Location = new System.Drawing.Point(168, 240);
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, 20);
this.labelMode.Text = "Fire event:";
//
// buttonAreas
//
this.buttonAreas.Location = new System.Drawing.Point(88, 240);
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, 240);
this.buttonTestEvent.Size = new System.Drawing.Size(64, 20);
this.buttonTestEvent.Text = "Test";
this.buttonTestEvent.Click += new System.EventHandler(this.buttonTestEvent_Click);
//
// textBoxURL
//
this.textBoxURL.Location = new System.Drawing.Point(80, 80);
this.textBoxURL.Multiline = true;
this.textBoxURL.Size = new System.Drawing.Size(152, 72);
this.textBoxURL.Text = "";
//
// labelNoteText
//
this.labelNoteText.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F, System.Drawing.FontStyle.Regular);
this.labelNoteText.Location = new System.Drawing.Point(16, 160);
this.labelNoteText.Size = new System.Drawing.Size(208, 80);
this.labelNoteText.Text = "Use the following placeholders in your URL:\n\n^AREAID^ ^AREADESC^ ^CELLID^ ^CEL" +
"LDESC^ ^DATE^ ^TIME^ ^IMEI^\n\nThey will be replaced with real values when the " +
"event fires";
//
// 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);
//
// EventInternetPostForm
//
this.ClientSize = new System.Drawing.Size(240, 272);
this.Controls.Add(this.comboBoxTriggerMode);
this.Controls.Add(this.comboBoxTrigger);
this.Controls.Add(this.labelNoteText);
this.Controls.Add(this.textBoxURL);
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.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Menu = this.mainMenu1;
this.Text = "Internet Post";
this.Load += new System.EventHandler(this.EventInternetPostForm_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 EventInternetPost ConfiguredEvent
{
get
{
return configEvent;
}
}
private void textBoxDescription_LostFocus(object sender, EventArgs e)
{
inputPanel1.Enabled = false;
}
private void EventInternetPostForm_Load(object sender, System.EventArgs e)
{
textBoxURL.Text = configEvent.URL;
EventConfigBase.PopulateTriggerType( comboBoxTrigger );
EventConfigBase.PopulateTriggerModeType( comboBoxTriggerMode );
EventConfigBase.Adapt( configEvent, this );
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.URL = textBoxURL.Text;
EventConfigBase.Adapt( this, configEvent );
}
private void buttonTestEvent_Click(object sender, System.EventArgs e)
{
if ( configEvent != null )
{
MakeChanges();
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 + -