📄 mainform.cs
字号:
this.progressBarSignal.Maximum = 31;
this.progressBarSignal.Size = new System.Drawing.Size(104, 24);
//
// labelSignal
//
this.labelSignal.Location = new System.Drawing.Point(8, 130);
this.labelSignal.Size = new System.Drawing.Size(48, 20);
this.labelSignal.Text = "Signal:";
//
// textBoxLocation
//
this.textBoxLocation.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular);
this.textBoxLocation.Location = new System.Drawing.Point(64, 96);
this.textBoxLocation.ReadOnly = true;
this.textBoxLocation.Size = new System.Drawing.Size(160, 24);
this.textBoxLocation.Text = "";
//
// labelLocation
//
this.labelLocation.Location = new System.Drawing.Point(8, 100);
this.labelLocation.Size = new System.Drawing.Size(48, 20);
this.labelLocation.Text = "Location:";
//
// pictureBox
//
this.pictureBox.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox.Image")));
this.pictureBox.Location = new System.Drawing.Point(136, 160);
this.pictureBox.Size = new System.Drawing.Size(88, 80);
this.pictureBox.Visible = false;
this.pictureBox.Click += new System.EventHandler(this.pictureBox_Click);
//
// pictureBoxLogo_Off
//
this.pictureBoxLogo_Off.Image = ((System.Drawing.Image)(resources.GetObject("pictureBoxLogo_Off.Image")));
this.pictureBoxLogo_Off.Location = new System.Drawing.Point(8, 8);
this.pictureBoxLogo_Off.Size = new System.Drawing.Size(120, 56);
//
// tabPageAreas
//
this.tabPageAreas.Controls.Add(this.textBoxAreaDescription);
this.tabPageAreas.Controls.Add(this.buttonAreaSave);
this.tabPageAreas.Controls.Add(this.dataGridAreaDB);
this.tabPageAreas.Location = new System.Drawing.Point(4, 4);
this.tabPageAreas.Size = new System.Drawing.Size(232, 246);
this.tabPageAreas.Text = "Areas";
//
// textBoxAreaDescription
//
this.textBoxAreaDescription.Location = new System.Drawing.Point(8, 3);
this.textBoxAreaDescription.Size = new System.Drawing.Size(168, 20);
this.textBoxAreaDescription.Text = "";
//
// buttonAreaSave
//
this.buttonAreaSave.Location = new System.Drawing.Point(184, 3);
this.buttonAreaSave.Size = new System.Drawing.Size(48, 20);
this.buttonAreaSave.Text = "Save";
this.buttonAreaSave.Click += new System.EventHandler(this.buttonAreaSave_Click);
//
// dataGridAreaDB
//
this.dataGridAreaDB.Location = new System.Drawing.Point(8, 32);
this.dataGridAreaDB.Size = new System.Drawing.Size(224, 208);
this.dataGridAreaDB.Text = "AreaDB";
//
// tabPageCells
//
this.tabPageCells.Controls.Add(this.buttonCellSave);
this.tabPageCells.Controls.Add(this.textBoxCellDescription);
this.tabPageCells.Controls.Add(this.dataGridCellDB);
this.tabPageCells.Location = new System.Drawing.Point(4, 4);
this.tabPageCells.Size = new System.Drawing.Size(232, 246);
this.tabPageCells.Text = "Cells";
//
// buttonCellSave
//
this.buttonCellSave.Location = new System.Drawing.Point(184, 3);
this.buttonCellSave.Size = new System.Drawing.Size(48, 20);
this.buttonCellSave.Text = "Save";
this.buttonCellSave.Click += new System.EventHandler(this.buttonCellSave_Click);
//
// textBoxCellDescription
//
this.textBoxCellDescription.Location = new System.Drawing.Point(8, 3);
this.textBoxCellDescription.Size = new System.Drawing.Size(168, 20);
this.textBoxCellDescription.Text = "";
//
// dataGridCellDB
//
this.dataGridCellDB.Location = new System.Drawing.Point(8, 32);
this.dataGridCellDB.Size = new System.Drawing.Size(224, 208);
this.dataGridCellDB.Text = "CellDB";
//
// tabPageEvents
//
this.tabPageEvents.Controls.Add(this.buttonEditEvent);
this.tabPageEvents.Controls.Add(this.buttonRemoveEvent);
this.tabPageEvents.Controls.Add(this.buttonAddEvent);
this.tabPageEvents.Controls.Add(this.listBoxRegisteredEvents);
this.tabPageEvents.Controls.Add(this.labelNewEvent);
this.tabPageEvents.Controls.Add(this.listBoxYourEvents);
this.tabPageEvents.Controls.Add(this.labelYourEvents);
this.tabPageEvents.Location = new System.Drawing.Point(4, 4);
this.tabPageEvents.Size = new System.Drawing.Size(232, 246);
this.tabPageEvents.Text = "Event";
//
// buttonEditEvent
//
this.buttonEditEvent.Location = new System.Drawing.Point(104, 104);
this.buttonEditEvent.Size = new System.Drawing.Size(56, 20);
this.buttonEditEvent.Text = "Edit";
this.buttonEditEvent.Click += new System.EventHandler(this.buttonEditEvent_Click);
//
// buttonRemoveEvent
//
this.buttonRemoveEvent.Location = new System.Drawing.Point(168, 104);
this.buttonRemoveEvent.Size = new System.Drawing.Size(56, 20);
this.buttonRemoveEvent.Text = "Remove";
this.buttonRemoveEvent.Click += new System.EventHandler(this.buttonRemoveEvent_Click);
//
// buttonAddEvent
//
this.buttonAddEvent.Location = new System.Drawing.Point(168, 224);
this.buttonAddEvent.Size = new System.Drawing.Size(56, 20);
this.buttonAddEvent.Text = "Add";
this.buttonAddEvent.Click += new System.EventHandler(this.buttonAddEvent_Click);
//
// listBoxRegisteredEvents
//
this.listBoxRegisteredEvents.Location = new System.Drawing.Point(8, 144);
this.listBoxRegisteredEvents.Size = new System.Drawing.Size(216, 80);
//
// labelNewEvent
//
this.labelNewEvent.Location = new System.Drawing.Point(0, 128);
this.labelNewEvent.Size = new System.Drawing.Size(216, 16);
this.labelNewEvent.Text = "Event types";
//
// listBoxYourEvents
//
this.listBoxYourEvents.Location = new System.Drawing.Point(8, 16);
this.listBoxYourEvents.Size = new System.Drawing.Size(216, 80);
//
// labelYourEvents
//
this.labelYourEvents.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular);
this.labelYourEvents.Size = new System.Drawing.Size(224, 16);
this.labelYourEvents.Text = "Your configured events";
//
// tabPageLog
//
this.tabPageLog.Controls.Add(this.labelLogTitle);
this.tabPageLog.Controls.Add(this.buttonClearLog);
this.tabPageLog.Controls.Add(this.listBoxLog);
this.tabPageLog.Location = new System.Drawing.Point(4, 4);
this.tabPageLog.Size = new System.Drawing.Size(232, 246);
this.tabPageLog.Text = "Log";
//
// labelLogTitle
//
this.labelLogTitle.Location = new System.Drawing.Point(8, 0);
this.labelLogTitle.Size = new System.Drawing.Size(216, 20);
this.labelLogTitle.Text = "Log";
//
// buttonClearLog
//
this.buttonClearLog.Location = new System.Drawing.Point(168, 224);
this.buttonClearLog.Size = new System.Drawing.Size(56, 20);
this.buttonClearLog.Text = "Clear";
this.buttonClearLog.Click += new System.EventHandler(this.buttonClearLog_Click);
//
// listBoxLog
//
this.listBoxLog.Location = new System.Drawing.Point(8, 24);
this.listBoxLog.Size = new System.Drawing.Size(216, 184);
//
// timerUpdate
//
this.timerUpdate.Tick += new System.EventHandler(this.timerUpdate_Tick);
//
// MainForm
//
this.Controls.Add(this.tabControlMain);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Menu = this.mainMenu1;
this.Text = "NiceTrack";
this.Load += new System.EventHandler(this.Form1_Load);
}
#endregion
#region Form stuff
private void refreshCellData()
{
cellTracker.Update();
}
private void refreshForm()
{
if ( cellTracker.CurrentCell.LAC != "" && !ConfigManager.ShowLacCiInHex )
textBoxLAC.Text = Convert.ToInt32( cellTracker.CurrentCell.LAC, 16 ).ToString();
else
textBoxLAC.Text = cellTracker.CurrentCell.LAC;
if ( cellTracker.CurrentCell.LAC != "" && !ConfigManager.ShowLacCiInHex )
textBoxCI.Text = Convert.ToInt32( cellTracker.CurrentCell.CI, 16 ).ToString();
else
textBoxCI.Text = cellTracker.CurrentCell.CI;
textBoxLocation.Text = CellDB.GetCellDescription( cellTracker.CurrentCell.LAC, cellTracker.CurrentCell.CI );
textBoxArea.Text = CellDB.GetAreaDescription( cellTracker.CurrentCell );
// If we're on main page
if ( tabControlMain.SelectedIndex == 0 )
{
selectCellRow( cellTracker.CurrentCell.LAC, cellTracker.CurrentCell.CI );
selectAreaRow( cellTracker.CurrentCell.LAC );
}
}
private void refreshEventPage()
{
listBoxYourEvents.Items.Clear();
listBoxRegisteredEvents.Items.Clear();
foreach ( EventBase userEvent in eventManager.UserEvents )
{
listBoxYourEvents.Items.Add( userEvent.Description );
}
foreach ( string regEvent in eventManager.RegisteredEvents )
{
listBoxRegisteredEvents.Items.Add( regEvent.ToString() );
}
}
private void setupChart()
{
signalChart.WrapX = true;
signalChart.BufferLimit = ConfigManager.ChartWrapLimit;
signalChart.Location = new Point( 1, 1 );
signalChart.Size = new Size( panel1.Size.Width - 1, panel1.Size.Height - 1);
signalChart.YMax = 32;
signalChart.Click += new EventHandler(signalChart_Click);
panel1.Controls.Add( signalChart );
}
private void setupGrids()
{
// Cells DB
DataGridTableStyle ts = new DataGridTableStyle();
DataGridTextBoxColumn textColStyle = new DataGridTextBoxColumn();
textColStyle.HeaderText = "Description";
textColStyle.MappingName = "description";
textColStyle.Width = 121;
ts.GridColumnStyles.Add( textColStyle );
textColStyle = new DataGridTextBoxColumn();
textColStyle.HeaderText = "LAC";
textColStyle.MappingName = "lac";
textColStyle.Width = 33;
ts.GridColumnStyles.Add( textColStyle );
textColStyle = new DataGridTextBoxColumn();
textColStyle.HeaderText = "CI";
textColStyle.MappingName = "ci";
textColStyle.Width = 33;
ts.GridColumnStyles.Add( textColStyle );
ts.MappingName = "cells";
dataGridCellDB.TableStyles.Add( ts );
dataGridCellDB.CurrentCellChanged +=new EventHandler(dataGridCells_CurrentCellChanged);
dvCells = new DataView( CellDB.DTCells );
dvCells.AllowEdit = true;
dvCells.AllowNew = true;
dvCells.Sort = "lac, ci";
dataGridCellDB.DataSource = dvCells;
// Area DB
ts = new DataGridTableStyle();
textColStyle = new DataGridTextBoxColumn();
textColStyle.HeaderText = "Description";
textColStyle.MappingName = "description";
textColStyle.Width = 154;
ts.GridColumnStyles.Add( textColStyle );
textColStyle = new DataGridTextBoxColumn();
textColStyle.HeaderText = "LAC";
textColStyle.MappingName = "lac";
textColStyle.Width = 33;
ts.GridColumnStyles.Add( textColStyle );
ts.MappingName = "areas";
dataGridAreaDB.TableStyles.Add( ts );
dataGridAreaDB.CurrentCellChanged +=new EventHandler(dataGridAreas_CurrentCellChanged);
dvAreas = new DataView( CellDB.DTAreas );
dvAreas.AllowEdit = true;
dvAreas.AllowNew = true;
dvAreas.Sort = "lac";
dataGridAreaDB.DataSource = dvAreas;
}
#endregion
#region Events
#region Popup menu
private void menuItemExit_Click(object sender, System.EventArgs e)
{
Application.Exit();
}
private void menuItemSave_Click(object sender, System.EventArgs e)
{
CellDB.Save();
eventManager.Save();
ConfigManager.Save();
}
private void menuItemSettings_Click(object sender, System.EventArgs e)
{
ConfigForm cf = new ConfigForm();
if ( cf.ShowDialog() == DialogResult.OK )
{
// Update changes from config dialog
cf.UpdateChanges();
// Configure app based on settings
configureSettings();
// Refresh form
refreshForm();
// Save onto storage
ConfigManager.Save();
}
}
private void menuItemAbout_Click(object sender, System.EventArgs e)
{
AboutForm ab = new AboutForm();
ab.ShowDialog();
}
private void menuItemExport_Click(object sender, System.EventArgs e)
{
MessageBox.Show( "Not yet implemented" );
}
#endregion
#region Location tab
private void cellTracker_CellChanged(object sender, EventArgs e)
{
if ( ConfigManager.CollectCells )
{
// Add to DB
if ( CellDB.IsNewCell( cellTracker.CurrentCell.LAC, cellTracker.CurrentCell.CI ) )
{
CellDB.AddNewCell( cellTracker.CurrentCell.LAC, cellTracker.CurrentCell.CI );
}
}
// Log this cell
LogCell( cellTracker.CurrentCell );
// Refresh form
refreshForm();
if ( ConfigManager.ProcessEvents )
{
// Perform events
eventManager.ProcessEvents( cellTracker.CurrentCell, cellTracker.LastCell );
}
}
private void cellTracker_AreaChanged(object sender, EventArgs e)
{
// Add to DB
if ( CellDB.IsNewArea( cellTracker.CurrentCell.LAC ) )
{
CellDB.AddNewArea( cellTracker.CurrentCell.LAC );
}
}
private void cellTracker_SignalChanged(object sender, EventArgs e)
{
progressBarSignal.Value = cellTracker.Signal;
labeldBM.Text = Convert.ToString( ( cellTracker.Signal * 2 ) + ( -113 ) ) + " dBM";
}
private void signalChart_Click(object sender, EventArgs e)
{
ShowPictureControl = !ShowPictureControl;
}
private void pictureBox_Click(object sender, EventArgs e)
{
if ( m_currentPictureFilename != "" && pictureBox.Visible )
{
PicturePreviewForm form = new PicturePreviewForm(m_currentPictureFilename);
form.ShowDialog();
}
}
#endregion
#region Areas tab
private void dataGridAreas_CurrentCellChanged(object sender, EventArgs e)
{
activateAreaRow( );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -