396 lines
17 KiB
C#
396 lines
17 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.ComponentModel;
|
|||
|
using System.Drawing;
|
|||
|
using System.Data;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Windows.Forms;
|
|||
|
using System.Collections;
|
|||
|
using Telerik.WinControls.UI.Docking;
|
|||
|
using Telerik.WinControls.UI;
|
|||
|
using SafeMobileLib;
|
|||
|
|
|||
|
namespace Safedispatch_4_0
|
|||
|
{
|
|||
|
public partial class ReportCont : UserControl
|
|||
|
{
|
|||
|
private Hashtable repHash = new Hashtable();
|
|||
|
private Boolean OnEnterValid = false;
|
|||
|
public ReportsControl OnFocusControl = null;
|
|||
|
|
|||
|
private void setLanguage()
|
|||
|
{
|
|||
|
repSpeed.Text = MainForm2.returnLNGString("alarmSpeed");
|
|||
|
repEmerg.Text = MainForm2.returnLNGString("emergAlarm");
|
|||
|
repFleet.Text = MainForm2.returnLNGString("FleetReport");
|
|||
|
repHist.Text = MainForm2.returnLNGString("tabHist");
|
|||
|
|
|||
|
switch (MainForm2.radioType)
|
|||
|
{
|
|||
|
case RADIOTYPE.CONECTPLUS:
|
|||
|
case RADIOTYPE.REPEATER_TRBO:
|
|||
|
case RADIOTYPE.MOTO:
|
|||
|
repONOFF.Text = MainForm2.returnLNGString("motoONOFF");
|
|||
|
break;
|
|||
|
case RADIOTYPE.HYT:
|
|||
|
repONOFF.Text = MainForm2.returnLNGString("motoONOFFHYT");
|
|||
|
break;
|
|||
|
case RADIOTYPE.HARRIS:
|
|||
|
repONOFF.Text = MainForm2.returnLNGString("motoONOFFHARRIS");
|
|||
|
break;
|
|||
|
case RADIOTYPE.ATLAS:
|
|||
|
repONOFF.Text = MainForm2.returnLNGString("motoONOFFAstro");
|
|||
|
break;
|
|||
|
case RADIOTYPE.TETRA:
|
|||
|
repONOFF.Text = MainForm2.returnLNGString("motoONOFFTetra");
|
|||
|
break;
|
|||
|
case RADIOTYPE.SIMOCO:
|
|||
|
repONOFF.Text = MainForm2.returnLNGString("motoONOFFSimoco");
|
|||
|
break;
|
|||
|
case RADIOTYPE.EXCERA:
|
|||
|
repONOFF.Text = MainForm2.returnLNGString("motoONOFFExcera");
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
repALL.Text = MainForm2.returnLNGString("allAlarm");
|
|||
|
repGeofenc.Text = MainForm2.returnLNGString("zoneAlarm");
|
|||
|
repEndDay.Text = MainForm2.returnLNGString("endofday");
|
|||
|
repIdle.Text = MainForm2.returnLNGString("Idling");
|
|||
|
repStop.Text = MainForm2.returnLNGString("stops");
|
|||
|
repTelem.Text = MainForm2.returnLNGString("tabTelemalarm");
|
|||
|
repTelemEvn.Text = MainForm2.returnLNGString("tabTelemevent");
|
|||
|
repLand.Text = MainForm2.returnLNGString("landAlarm");
|
|||
|
repSMSLocation.Text = MainForm2.returnLNGString("smsLoc");
|
|||
|
repTicketing.Text = MainForm2.returnLNGString("tabTicketing");
|
|||
|
}
|
|||
|
|
|||
|
public ReportCont()
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
setLanguage();
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
repHash.Clear();
|
|||
|
if ((MainForm2.radioType == RADIOTYPE.MOTO) || (MainForm2.radioType == RADIOTYPE.HYT)
|
|||
|
|| (MainForm2.radioType == RADIOTYPE.HARRIS) || (MainForm2.radioType == RADIOTYPE.REPEATER_TRBO)
|
|||
|
|| (MainForm2.radioType == RADIOTYPE.SIMOCO) || (MainForm2.radioType == RADIOTYPE.EXCERA))
|
|||
|
{
|
|||
|
repHash.Add(repTelem.Name, false);
|
|||
|
repHash.Add(repTelemEvn.Name, false);
|
|||
|
}
|
|||
|
if (MainForm2.radioType != RADIOTYPE.SIMOCO && MainForm2.radioType != RADIOTYPE.EXCERA)
|
|||
|
repHash.Add(repONOFF.Name, false);
|
|||
|
if (MainForm2.radioType != RADIOTYPE.CONECTPLUS)
|
|||
|
repHash.Add(repEmerg.Name, false);
|
|||
|
if (MainForm2.SMSDecide)
|
|||
|
repHash.Add(repSMSLocation.Name, false);
|
|||
|
|
|||
|
repHash.Add(repEndDay.Name, false);
|
|||
|
repHash.Add(repFleet.Name, false);
|
|||
|
repHash.Add(repGeofenc.Name, false);
|
|||
|
repHash.Add(repHist.Name, false);
|
|||
|
repHash.Add(repIdle.Name, false);
|
|||
|
//repHash.Add(repONOFF.Name, false);
|
|||
|
repHash.Add(repSpeed.Name, false);
|
|||
|
repHash.Add(repStop.Name, false);
|
|||
|
repHash.Add(repALL.Name, false);
|
|||
|
|
|||
|
documentTabStrip1.SelectedIndex = 0;
|
|||
|
OnEnterValid = true;
|
|||
|
//on ENter don' work here
|
|||
|
CheckTabs(rep_type.SPEED, repSpeed);
|
|||
|
|
|||
|
ContextMenuService menuService = this.radDock1.GetService<ContextMenuService>();
|
|||
|
menuService.ContextMenuDisplaying += menuService_ContextMenuDisplaying;
|
|||
|
//this disables the context menu
|
|||
|
menuService.AllowActiveWindowListContextMenu = false;
|
|||
|
menuService.AllowDocumentContextMenu = false;
|
|||
|
menuService.AllowToolContextMenu = false;
|
|||
|
|
|||
|
repALL.DocumentButtons &= ~Telerik.WinControls.UI.Docking.DocumentStripButtons.Close;
|
|||
|
repEmerg.DocumentButtons &= ~Telerik.WinControls.UI.Docking.DocumentStripButtons.Close;
|
|||
|
repEndDay.DocumentButtons &= ~Telerik.WinControls.UI.Docking.DocumentStripButtons.Close;
|
|||
|
repFleet.DocumentButtons &= ~Telerik.WinControls.UI.Docking.DocumentStripButtons.Close;
|
|||
|
repGeofenc.DocumentButtons &= ~Telerik.WinControls.UI.Docking.DocumentStripButtons.Close;
|
|||
|
repHist.DocumentButtons &= ~Telerik.WinControls.UI.Docking.DocumentStripButtons.Close;
|
|||
|
repIdle.DocumentButtons &= ~Telerik.WinControls.UI.Docking.DocumentStripButtons.Close;
|
|||
|
repONOFF.DocumentButtons &= ~Telerik.WinControls.UI.Docking.DocumentStripButtons.Close;
|
|||
|
repSpeed.DocumentButtons &= ~Telerik.WinControls.UI.Docking.DocumentStripButtons.Close;
|
|||
|
repStop.DocumentButtons &= ~Telerik.WinControls.UI.Docking.DocumentStripButtons.Close;
|
|||
|
repTelem.DocumentButtons &= ~Telerik.WinControls.UI.Docking.DocumentStripButtons.Close;
|
|||
|
repTelemEvn.DocumentButtons &= ~Telerik.WinControls.UI.Docking.DocumentStripButtons.Close;
|
|||
|
repSMSLocation.DocumentButtons &= ~Telerik.WinControls.UI.Docking.DocumentStripButtons.Close;
|
|||
|
repTicketing.DocumentButtons &= ~Telerik.WinControls.UI.Docking.DocumentStripButtons.Close;
|
|||
|
repLand.DocumentButtons &= ~Telerik.WinControls.UI.Docking.DocumentStripButtons.Close;
|
|||
|
MainForm2.RestartMEM += 40000000;
|
|||
|
try
|
|||
|
{
|
|||
|
switch (MainForm2.radioType)
|
|||
|
{
|
|||
|
case RADIOTYPE.HYT:
|
|||
|
radDock1.BackColor = MainForm2.HyteraColor;
|
|||
|
repSpeed.BackColor = MainForm2.HyteraColor;
|
|||
|
documentTabStrip1.BackColor = MainForm2.HyteraColor;
|
|||
|
documentContainer1.BackColor = MainForm2.HyteraColor;
|
|||
|
break;
|
|||
|
case RADIOTYPE.HARRIS:
|
|||
|
radDock1.BackColor = MainForm2.HarrisColor;
|
|||
|
repSpeed.BackColor = MainForm2.HarrisColor;
|
|||
|
documentTabStrip1.BackColor = MainForm2.HarrisColor;
|
|||
|
documentContainer1.BackColor = MainForm2.HarrisColor;
|
|||
|
break;
|
|||
|
case RADIOTYPE.ATLAS:
|
|||
|
radDock1.BackColor = MainForm2.HarrisColor;
|
|||
|
repSpeed.BackColor = MainForm2.HarrisColor;
|
|||
|
documentTabStrip1.BackColor = MainForm2.HarrisColor;
|
|||
|
documentContainer1.BackColor = MainForm2.HarrisColor;
|
|||
|
try
|
|||
|
{
|
|||
|
documentTabStrip1.Controls.Remove(repTelem);
|
|||
|
documentTabStrip1.Controls.Remove(repTelemEvn);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
SM.Debug("Error remove reports for atlas:" + ex.ToString());
|
|||
|
}
|
|||
|
break;
|
|||
|
case RADIOTYPE.CONECTPLUS:
|
|||
|
try
|
|||
|
{
|
|||
|
documentTabStrip1.Controls.Remove(repTelem);
|
|||
|
documentTabStrip1.Controls.Remove(repTelemEvn);
|
|||
|
documentTabStrip1.Controls.Remove(repEmerg);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
SM.Debug("Error remove reports for tetra:" + ex.ToString());
|
|||
|
}
|
|||
|
break;
|
|||
|
case RADIOTYPE.TETRA:
|
|||
|
try
|
|||
|
{
|
|||
|
documentTabStrip1.Controls.Remove(repTelem);
|
|||
|
documentTabStrip1.Controls.Remove(repTelemEvn);
|
|||
|
//documentTabStrip1.Controls.Remove(repONOFF);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
SM.Debug("Error remove reports for tetra:" + ex.ToString());
|
|||
|
}
|
|||
|
break;
|
|||
|
case RADIOTYPE.SIMOCO:
|
|||
|
case RADIOTYPE.EXCERA:
|
|||
|
try
|
|||
|
{
|
|||
|
documentTabStrip1.Controls.Remove(repONOFF);
|
|||
|
documentTabStrip1.Controls.Remove(repTelem);
|
|||
|
documentTabStrip1.Controls.Remove(repTelemEvn);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
SM.Debug("Error remove reports for tetra:" + ex.ToString());
|
|||
|
}
|
|||
|
break;
|
|||
|
}
|
|||
|
if (MainForm2.radioType != RADIOTYPE.MOTO && MainForm2.radioType != RADIOTYPE.REPEATER_TRBO && MainForm2.radioType != RADIOTYPE.LINXB)
|
|||
|
documentTabStrip1.Controls.Remove(repTicketing);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
SM.Debug("Error remove reports constructor" + ex.ToString());
|
|||
|
}
|
|||
|
if (!MainForm2.SMSDecide) documentTabStrip1.Controls.Remove(repSMSLocation);
|
|||
|
|
|||
|
|
|||
|
if(MainForm2.radioType == RADIOTYPE.LINX)
|
|||
|
{
|
|||
|
documentTabStrip1.Controls.Remove(repTelem);
|
|||
|
documentTabStrip1.Controls.Remove(repTelemEvn);
|
|||
|
documentTabStrip1.Controls.Remove(repTicketing);
|
|||
|
documentTabStrip1.Controls.Remove(repSMSLocation);
|
|||
|
repONOFF.Name = repONOFF.Text = MainForm2.returnLNGString("PresenceON/OFF");
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void menuService_ContextMenuDisplaying(object sender, ContextMenuDisplayingEventArgs e)
|
|||
|
{
|
|||
|
if (e.MenuType == ContextMenuType.DockWindow &&
|
|||
|
e.DockWindow.DockTabStrip is DocumentTabStrip)
|
|||
|
{
|
|||
|
for (int i = 0; i < e.MenuItems.Count; i++)
|
|||
|
{
|
|||
|
RadMenuItemBase menuItem = e.MenuItems[i];
|
|||
|
if (menuItem.Name == "CloseWindow" ||
|
|||
|
menuItem.Name == "CloseAllButThis" ||
|
|||
|
menuItem.Name == "CloseAll" ||
|
|||
|
menuItem.Name == "Hidden" ||
|
|||
|
menuItem is RadMenuSeparatorItem)
|
|||
|
{
|
|||
|
menuItem.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void CheckTabs(rep_type type, ToolWindow tool)
|
|||
|
{
|
|||
|
if (OnEnterValid)
|
|||
|
{
|
|||
|
if (repHash[tool.Name] != null)
|
|||
|
if (((Boolean)repHash[tool.Name]) == false)
|
|||
|
{
|
|||
|
repHash[tool.Name] = true;
|
|||
|
AddReportWindow(type, tool);
|
|||
|
// add geofences to the combobox
|
|||
|
if (type == rep_type.GEOFENC)
|
|||
|
OnFocusControl.Refresh_GeoName();
|
|||
|
else if (type == rep_type.LAND)
|
|||
|
OnFocusControl.Refresh_LandName();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
OnFocusControl = (ReportsControl)tool.Controls[0];
|
|||
|
// refresh geofecens from the combobox
|
|||
|
if (type == rep_type.GEOFENC)
|
|||
|
OnFocusControl.Refresh_GeoName();
|
|||
|
else if (type == rep_type.LAND)
|
|||
|
OnFocusControl.Refresh_LandName();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
repHash.Add(tool.Name, true);
|
|||
|
AddReportWindow(type, tool);
|
|||
|
// add geofences to the combobox
|
|||
|
if (type == rep_type.GEOFENC)
|
|||
|
OnFocusControl.Refresh_GeoName();
|
|||
|
else if (type == rep_type.LAND)
|
|||
|
OnFocusControl.Refresh_LandName();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void AddReportWindow(rep_type Type,ToolWindow toolwin)
|
|||
|
{
|
|||
|
ReportsControl tmpx = new ReportsControl(Type);
|
|||
|
tmpx.Visible = true;
|
|||
|
tmpx.Dock = System.Windows.Forms.DockStyle.Fill;
|
|||
|
tmpx.Location = new System.Drawing.Point(0, 0);
|
|||
|
OnFocusControl = tmpx;
|
|||
|
toolwin.Controls.Add(tmpx);
|
|||
|
}
|
|||
|
|
|||
|
private void repEmerg_Enter(object sender, EventArgs e)
|
|||
|
{
|
|||
|
CheckTabs(rep_type.EMERG, (ToolWindow)sender);
|
|||
|
}
|
|||
|
|
|||
|
private void repFleet_Enter(object sender, EventArgs e)
|
|||
|
{
|
|||
|
CheckTabs(rep_type.FLEET, (ToolWindow)sender);
|
|||
|
}
|
|||
|
|
|||
|
private void repEndDay_Enter(object sender, EventArgs e)
|
|||
|
{
|
|||
|
CheckTabs(rep_type.ENDOFDAY, (ToolWindow)sender);
|
|||
|
}
|
|||
|
|
|||
|
private void repGeofenc_Enter(object sender, EventArgs e)
|
|||
|
{
|
|||
|
CheckTabs(rep_type.GEOFENC, (ToolWindow)sender);
|
|||
|
}
|
|||
|
|
|||
|
private void repHist_Enter(object sender, EventArgs e)
|
|||
|
{
|
|||
|
CheckTabs(rep_type.HIST, (ToolWindow)sender);
|
|||
|
}
|
|||
|
|
|||
|
private void repIdle_Enter(object sender, EventArgs e)
|
|||
|
{
|
|||
|
CheckTabs(rep_type.IDLE, (ToolWindow)sender);
|
|||
|
}
|
|||
|
|
|||
|
private void repONOFF_Enter(object sender, EventArgs e)
|
|||
|
{
|
|||
|
CheckTabs(rep_type.LOG, (ToolWindow)sender);
|
|||
|
}
|
|||
|
|
|||
|
private void repSpeed_Enter(object sender, EventArgs e)
|
|||
|
{
|
|||
|
CheckTabs(rep_type.SPEED, (ToolWindow)sender);
|
|||
|
}
|
|||
|
|
|||
|
private void repStop_Enter(object sender, EventArgs e)
|
|||
|
{
|
|||
|
CheckTabs(rep_type.STOP, (ToolWindow)sender);
|
|||
|
}
|
|||
|
|
|||
|
private void repTelem_Enter(object sender, EventArgs e)
|
|||
|
{
|
|||
|
CheckTabs(rep_type.TELEMETRY_ALARM, (ToolWindow)sender);
|
|||
|
}
|
|||
|
|
|||
|
private void repALL_Enter(object sender, EventArgs e)
|
|||
|
{
|
|||
|
CheckTabs(rep_type.ALLALARM, (ToolWindow)sender);
|
|||
|
}
|
|||
|
|
|||
|
private void repLand_Enter(object sender, EventArgs e)
|
|||
|
{
|
|||
|
CheckTabs(rep_type.LAND, (ToolWindow)sender);
|
|||
|
}
|
|||
|
|
|||
|
private void repTelemEvn_Enter(object sender, EventArgs e)
|
|||
|
{
|
|||
|
CheckTabs(rep_type.TELEMETRY_EVENT, (ToolWindow)sender);
|
|||
|
}
|
|||
|
|
|||
|
private void repSMSLocation_Enter(object sender, EventArgs e)
|
|||
|
{
|
|||
|
CheckTabs(rep_type.SMS_LOCATION, (ToolWindow)sender);
|
|||
|
}
|
|||
|
|
|||
|
private void repTicketing_Enter(object sender, EventArgs e)
|
|||
|
{
|
|||
|
CheckTabs(rep_type.JOB_TICKETING, (ToolWindow)sender);
|
|||
|
}
|
|||
|
|
|||
|
#region CHANGE TABS BACKGROUND
|
|||
|
private DockWindow oldDockWindow = null;
|
|||
|
private void radDock1_ActiveWindowChanging(object sender, DockWindowCancelEventArgs e)
|
|||
|
{
|
|||
|
// reset the background icon for the previous tab
|
|||
|
e.OldWindow.TabStripItem.BackColor = Color.White;
|
|||
|
e.OldWindow.TabStripItem.DrawFill = true;
|
|||
|
e.OldWindow.TabStripItem.NumberOfColors = 1;
|
|||
|
|
|||
|
// reset the background for the new window
|
|||
|
e.NewWindow.TabStripItem.DrawFill = true;
|
|||
|
e.NewWindow.TabStripItem.NumberOfColors = 1;
|
|||
|
e.NewWindow.TabStripItem.BackColor = MainForm2.TabSelectedColor;
|
|||
|
|
|||
|
// save old dock window
|
|||
|
oldDockWindow = e.OldWindow;
|
|||
|
}
|
|||
|
|
|||
|
private void radDock1_ActiveWindowChanged(object sender, DockWindowEventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
// reset the background icon for the previous tab
|
|||
|
oldDockWindow.TabStripItem.BackColor = Color.White;
|
|||
|
oldDockWindow.TabStripItem.DrawFill = true;
|
|||
|
oldDockWindow.TabStripItem.NumberOfColors = 1;
|
|||
|
|
|||
|
e.DockWindow.TabStripItem.DrawFill = true;
|
|||
|
e.DockWindow.TabStripItem.NumberOfColors = 1;
|
|||
|
e.DockWindow.TabStripItem.BackColor = MainForm2.TabSelectedColor;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|