?? eventsetvolumeform.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 EventSetVolumeForm : System.Windows.Forms.Form, IEventConfigForm
{
private EventSetVolume 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.ComboBox comboBoxTrigger;
private System.Windows.Forms.ComboBox comboBoxTriggerMode;
private System.Windows.Forms.TrackBar trackBarVolume;
private System.Windows.Forms.Label labelNoteText;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TrackBar trackBarRingVolume;
private System.Windows.Forms.Label labelTitle;
public EventSetVolumeForm()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
buttonTestEvent.Visible = false;
}
public EventSetVolumeForm( EventSetVolume 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(EventSetVolumeForm));
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();
this.trackBarVolume = new System.Windows.Forms.TrackBar();
this.labelNoteText = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.trackBarRingVolume = new System.Windows.Forms.TrackBar();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
//
// labelTitle
//
this.labelTitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F, System.Drawing.FontStyle.Regular);
this.labelTitle.Location = new System.Drawing.Point(80, 88);
this.labelTitle.Size = new System.Drawing.Size(72, 16);
this.labelTitle.Text = "Master Volume:";
//
// 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, 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, 16);
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);
//
// 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);
//
// trackBarVolume
//
this.trackBarVolume.Location = new System.Drawing.Point(80, 108);
this.trackBarVolume.Maximum = 5;
this.trackBarVolume.Orientation = System.Windows.Forms.Orientation.Vertical;
this.trackBarVolume.Size = new System.Drawing.Size(45, 104);
this.trackBarVolume.ValueChanged += new System.EventHandler(this.trackBarVolume_ValueChanged);
//
// labelNoteText
//
this.labelNoteText.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F, System.Drawing.FontStyle.Regular);
this.labelNoteText.Location = new System.Drawing.Point(120, 192);
this.labelNoteText.Size = new System.Drawing.Size(28, 16);
this.labelNoteText.Text = "Silent";
//
// label1
//
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F, System.Drawing.FontStyle.Regular);
this.label1.Location = new System.Drawing.Point(120, 120);
this.label1.Size = new System.Drawing.Size(24, 16);
this.label1.Text = "Full";
//
// trackBarRingVolume
//
this.trackBarRingVolume.Location = new System.Drawing.Point(160, 108);
this.trackBarRingVolume.Maximum = 5;
this.trackBarRingVolume.Orientation = System.Windows.Forms.Orientation.Vertical;
this.trackBarRingVolume.Size = new System.Drawing.Size(45, 104);
this.trackBarRingVolume.ValueChanged += new System.EventHandler(this.trackBarRingVolume_ValueChanged);
//
// label2
//
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F, System.Drawing.FontStyle.Regular);
this.label2.Location = new System.Drawing.Point(200, 192);
this.label2.Size = new System.Drawing.Size(28, 16);
this.label2.Text = "Silent";
//
// label3
//
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F, System.Drawing.FontStyle.Regular);
this.label3.Location = new System.Drawing.Point(200, 120);
this.label3.Size = new System.Drawing.Size(24, 16);
this.label3.Text = "Full";
//
// label4
//
this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F, System.Drawing.FontStyle.Regular);
this.label4.Location = new System.Drawing.Point(160, 88);
this.label4.Size = new System.Drawing.Size(64, 16);
this.label4.Text = "Ring Volume:";
//
// EventSetVolumeForm
//
this.ClientSize = new System.Drawing.Size(240, 272);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.trackBarRingVolume);
this.Controls.Add(this.label1);
this.Controls.Add(this.labelNoteText);
this.Controls.Add(this.trackBarVolume);
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.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 EventSetVolume 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 );
trackBarVolume.Value = configEvent.Volume;
trackBarRingVolume.Value = configEvent.RingVolume;
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.Volume = Convert.ToInt32( trackBarVolume.Value );
configEvent.RingVolume = Convert.ToInt32( trackBarRingVolume.Value );
EventConfigBase.Adapt( this, configEvent );
}
private void buttonTestEvent_Click(object sender, System.EventArgs e)
{
MakeChanges( );
if ( configEvent != null )
configEvent.Action();
}
private void trackBarVolume_ValueChanged(object sender, System.EventArgs e)
{
configEvent.Volume = Convert.ToInt32( trackBarVolume.Value );
}
private void trackBarRingVolume_ValueChanged(object sender, System.EventArgs e)
{
configEvent.RingVolume = Convert.ToInt32( trackBarRingVolume.Value );
}
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 + -