2024-02-22 16:43:59 +00:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections;
|
|
|
|
using System.ComponentModel;
|
|
|
|
using System.Drawing;
|
|
|
|
using System.Data;
|
|
|
|
using System.Text;
|
|
|
|
using System.Windows.Forms;
|
|
|
|
using System.Threading;
|
|
|
|
using System.Resources;
|
|
|
|
using MapGoogle;
|
|
|
|
using Telerik.WinControls.UI;
|
|
|
|
using Telerik.WinControls;
|
|
|
|
using Telerik.WinControls.UI.Docking;
|
|
|
|
using SafeMobileLib;
|
|
|
|
using System.IO;
|
|
|
|
using Dispatcher.maptab.UIClasses;
|
|
|
|
using Dispatcher.maptab;
|
2024-06-05 11:00:51 +00:00
|
|
|
using System.Linq;
|
2024-02-22 16:43:59 +00:00
|
|
|
|
|
|
|
namespace Safedispatch_4_0
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// This class implements the history tab.</summary>
|
|
|
|
/// <remarks>
|
|
|
|
/// The history tab contains two areas, left and right. On the left side
|
|
|
|
/// the vehicle selection and intervals are made, and on the right side information
|
|
|
|
/// is displayed according to the criteria from the left</remarks>
|
|
|
|
|
|
|
|
public partial class HistoryTab : UserControl
|
|
|
|
{
|
|
|
|
private bool mapIsDirty = false;
|
|
|
|
public bool KillTimerActive = false;
|
|
|
|
public String calcADDr, endtimegreate,onlyonecar;
|
|
|
|
public Boolean docLoad = false;
|
|
|
|
private Int32 loadcnt = 0;
|
|
|
|
private Int32 timestart = 0, timestop = 0;
|
|
|
|
private volatile Pushpinx pp = null;
|
|
|
|
//private volatile Int32 timeTemp = 0;
|
|
|
|
private volatile bool first = true;
|
|
|
|
private volatile Hashtable DataPos = new Hashtable();
|
|
|
|
private volatile Hashtable DataPosOutSide = new Hashtable();
|
|
|
|
private volatile Boolean hitLimit = false;
|
|
|
|
private String Nodata = "";
|
|
|
|
private String plsselcectcar = "";
|
|
|
|
private String youhave = "", googleWork = "", contorsmall = "", outsideBrowser ="", setdefault ="", selectinterval ="";
|
|
|
|
private Boolean AniStateExpande = false;
|
|
|
|
private volatile Boolean retrynew;
|
|
|
|
private volatile Boolean inwhile =false;
|
|
|
|
public static volatile Boolean StreetViewOpened = false;
|
|
|
|
public ArrayList Point_for_play = new ArrayList();
|
|
|
|
private Image theme24H_Image = Utils.ChangeColor(Dispatcher.Properties.Resources.h_24h, MainForm2.ButtonColor);
|
|
|
|
private Image themelFilter_Image = Utils.ChangeColor(Dispatcher.Properties.Resources.h_filter, MainForm2.ButtonColor);
|
|
|
|
private bool isLoaded = false;
|
|
|
|
|
|
|
|
private void setLanguage()
|
|
|
|
{
|
|
|
|
calcADDr = MainForm2.returnLNGString("retrevAddr");
|
|
|
|
endtimegreate = MainForm2.returnLNGString("endtimegreate");
|
|
|
|
toolWindow2.Text = MainForm2.returnLNGString("tabPage1");
|
|
|
|
|
|
|
|
onlyonecar = MainForm2.returnLNGString("onlyonecar");
|
|
|
|
plsselcectcar = MainForm2.returnLNGString("selval");
|
|
|
|
|
|
|
|
//rdpEndTime.Culture = MainForm2.culture;
|
|
|
|
//rdpStartTime.Culture = MainForm2.culture;
|
|
|
|
|
2024-06-05 11:00:51 +00:00
|
|
|
|
|
|
|
string startTimeCustomFormat = MainForm2.DayFirst ? "dd/MM/yyyy hh:mm tt" : "MM/dd/yyyy hh:mm tt";
|
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
if (MainForm2.is24hours)
|
2024-06-05 11:00:51 +00:00
|
|
|
startTimeCustomFormat = MainForm2.DayFirst ? "dd/MM/yyyy HH:mm" : "MM/dd/yyyy HH:mm";
|
|
|
|
|
|
|
|
rdpStartTime.CustomFormat = startTimeCustomFormat;
|
2024-02-22 16:43:59 +00:00
|
|
|
// copy format to the end date picker
|
|
|
|
rdpEndTime.CustomFormat = rdpStartTime.CustomFormat;
|
|
|
|
|
|
|
|
|
|
|
|
//MainForm2.HistSpeedLimit.ToString()
|
|
|
|
Nodata = MainForm2.returnLNGString("nodata");//nodata;
|
|
|
|
youhave = MainForm2.returnLNGString("youhave");
|
|
|
|
googleWork = MainForm2.returnLNGString("googleWork");
|
|
|
|
outsideBrowser = MainForm2.returnLNGString("outsideBrowser");
|
|
|
|
setdefault = MainForm2.returnLNGString("setdefault");
|
|
|
|
contorsmall = MainForm2.returnLNGString("contorsmall");
|
|
|
|
selectinterval = MainForm2.returnLNGString("selectSmall");
|
|
|
|
labelUnits.Text = MainForm2.returnLNGString("GrpUnits");
|
|
|
|
windowHistoryResult.Text = MainForm2.returnLNGString("historyResult");
|
|
|
|
toolWindow4.Text = MainForm2.returnLNGString("historySearchParameters");
|
|
|
|
rtbFilterUnits.NullText = MainForm2.returnLNGString("Typetosearchunit");
|
|
|
|
rlHistoryForSelectedUnits.Text = MainForm2.returnLNGString("historyForSelectedUnits");
|
|
|
|
radLabel6.Text = MainForm2.returnLNGString("historyFrom");
|
|
|
|
rlUntil.Text = MainForm2.returnLNGString("historyUntil");
|
|
|
|
rcbSpeedLower.Text = MainForm2.returnLNGString("lowerSpeed");
|
|
|
|
rcbSpeedLower.Text = (!MainForm2.isInMile) ? string.Format(rcbSpeedLower.Text, (MainForm2.returnLNGString("kmh"))) : string.Format(rcbSpeedLower.Text, (MainForm2.returnLNGString("milesh")));
|
|
|
|
rlPositionDisplayMs.Text = MainForm2.returnLNGString("posDisplay");
|
|
|
|
rbResetHistory.Text = MainForm2.returnLNGString("reset");
|
|
|
|
rbSearchHistory.Text = MainForm2.returnLNGString("searchHistory");
|
|
|
|
rcbShowGeofence.Text = MainForm2.returnLNGString("showGeofences");
|
|
|
|
rcbShowLabels.Text = MainForm2.returnLNGString("showPoints");
|
|
|
|
labelSlideshow.Text = MainForm2.returnLNGString("slideshowSearchResult");
|
|
|
|
rlAnimation.Text = MainForm2.returnLNGString("slideshowTimeline");
|
|
|
|
rcbSpeedUpper.Text = MainForm2.returnLNGString("upperSpeed");
|
|
|
|
rcbSpeedUpper.Text = (!MainForm2.isInMile) ? string.Format(rcbSpeedUpper.Text, (MainForm2.returnLNGString("kmh"))) : string.Format(rcbSpeedUpper.Text, (MainForm2.returnLNGString("milesh")));
|
|
|
|
rcbComputeAddress.Text = MainForm2.returnLNGString("compAddr");
|
|
|
|
btStopCalc.Text = MainForm2.returnLNGString("stop");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public HistoryTab(MainForm2 parentParam, String tabNameParam)
|
|
|
|
{
|
|
|
|
tabName = tabNameParam;
|
|
|
|
parent = parentParam;
|
|
|
|
|
|
|
|
smdbObj = new SMdb_access();
|
|
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
|
|
#region STYLE THEMING
|
|
|
|
labelUnits.ForeColor = labelSlideshow.ForeColor = MainForm2.LabelColor;
|
|
|
|
rbSearchHistory.ButtonElement.ButtonFillElement.BackColor = MainForm2.ButtonColor;
|
|
|
|
rbResetHistory.ButtonElement.ButtonFillElement.BackColor = MainForm2.ButtonColor;
|
|
|
|
|
|
|
|
// play buttons
|
|
|
|
rbPrev.ButtonElement.ButtonFillElement.BackColor = MainForm2.ButtonColor;
|
|
|
|
rbPause.ButtonElement.ButtonFillElement.BackColor = MainForm2.ButtonColor;
|
|
|
|
rbNext.ButtonElement.ButtonFillElement.BackColor = MainForm2.ButtonColor;
|
|
|
|
rbPlay.ButtonElement.ButtonFillElement.BackColor = MainForm2.ButtonColor;
|
|
|
|
rbStop.ButtonElement.ButtonFillElement.BackColor = MainForm2.ButtonColor;
|
|
|
|
|
|
|
|
pb24H.Image = Utils.ChangeColor(Dispatcher.Properties.Resources.h_24h, MainForm2.ButtonColor);
|
|
|
|
theme24H_Image = pb24H.Image;
|
|
|
|
pbFilter.Image = Utils.ChangeColor(Dispatcher.Properties.Resources.i_search, MainForm2.ButtonColor);
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
// set theme for the Message Box
|
|
|
|
RadMessageBox.SetThemeName("TelerikMetroBlue");
|
|
|
|
|
|
|
|
// add filter rule/predicate to the units tree
|
|
|
|
treeViewUnits.TreeViewElement.FilterPredicate = FilterNode;
|
|
|
|
|
|
|
|
|
|
|
|
// create the custom column which will display the positions in
|
|
|
|
// the new way
|
|
|
|
HistoryGridColumn ctc = new HistoryGridColumn("history");
|
|
|
|
ctc.AllowResize = true;
|
|
|
|
ctc.Name = "history";
|
|
|
|
ctc.FieldName = "history";
|
|
|
|
ctc.HeaderText = "history";
|
|
|
|
ctc.AutoSizeMode = BestFitColumnMode.AllCells;
|
|
|
|
ctc.HeaderTextAlignment = ContentAlignment.MiddleLeft;
|
|
|
|
ctc.SortOrder = RadSortOrder.Ascending;
|
|
|
|
|
|
|
|
|
|
|
|
this.gridHistoryPoints.TableElement.RowHeight = 55;
|
|
|
|
this.gridHistoryPoints.Columns.Add(ctc);
|
|
|
|
this.gridHistoryPoints.Columns.Move(ctc.Index, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// create the toolTip that will be displayed when the user sets a pattern
|
|
|
|
// over the pictureBox
|
|
|
|
toolTipHelp = new ToolTip();
|
|
|
|
toolTipHelp.ToolTipTitle = "";
|
|
|
|
toolTipHelp.AutoPopDelay = 0;
|
|
|
|
toolTipHelp.InitialDelay = 0;
|
|
|
|
toolTipHelp.ReshowDelay = 0;
|
|
|
|
toolTipHelp.IsBalloon = false;
|
|
|
|
toolTipHelp.ShowAlways = true;
|
|
|
|
|
|
|
|
|
|
|
|
// add the groups and the units to the tree view
|
|
|
|
populateListBoxGroup();
|
|
|
|
populateListBoxUnits();
|
|
|
|
|
|
|
|
// set the values for start and end time
|
|
|
|
rdpStartTime.Value = DateTime.Now.AddDays(-1);
|
|
|
|
rdpEndTime.Value = DateTime.Now;
|
|
|
|
|
|
|
|
// disable the history result window
|
|
|
|
foreach (Control ctr in windowHistoryResult.Controls)
|
|
|
|
ctr.Enabled = false;
|
|
|
|
|
|
|
|
|
|
|
|
if(mapGoogles!=null && HistMapPanel.Controls.Contains(mapGoogles))
|
|
|
|
HistMapPanel.Controls.Remove(mapGoogles);
|
|
|
|
|
|
|
|
HistMapPanel.Controls.Add(GetMapController());
|
|
|
|
|
|
|
|
setLanguage();
|
|
|
|
|
|
|
|
//this.HistoryPanel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(191)))), ((int)(((byte)(219)))), ((int)(((byte)(255)))));
|
|
|
|
|
|
|
|
MainForm2.RestartMEM += 40000000;
|
|
|
|
minTime = Int32.MaxValue;
|
|
|
|
maxTime = 0;
|
|
|
|
|
|
|
|
this.DrawMap();
|
|
|
|
|
|
|
|
|
|
|
|
busSymb = new BusSymbols(mapControl);
|
|
|
|
placeSymb = new PlaceSymbols(mapControl);
|
|
|
|
|
|
|
|
if (MainForm2.Connfailed)
|
|
|
|
{
|
|
|
|
this.mapControl.ActiveMap.Saved = true;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TraceStyle = 2;
|
|
|
|
|
|
|
|
GetPositionForStart = false;
|
|
|
|
txProgStatus.Visible = false;
|
|
|
|
HistroyProgBar.Visible = false;
|
|
|
|
HistoryPanel.Visible = false;
|
|
|
|
//rsePositionDisplay.Value = MainForm2.PauseTime;
|
|
|
|
|
|
|
|
|
|
|
|
toolWindow2.ToolCaptionButtons = Telerik.WinControls.UI.Docking.ToolStripCaptionButtons.AutoHide | Telerik.WinControls.UI.Docking.ToolStripCaptionButtons.SystemMenu;
|
|
|
|
toolWindow2.DocumentButtons &= ~Telerik.WinControls.UI.Docking.DocumentStripButtons.Close;
|
|
|
|
ContextMenuService menuService = this.radDock1.GetService<ContextMenuService>();
|
|
|
|
menuService.ContextMenuDisplaying += menuService_ContextMenuDisplaying;
|
|
|
|
|
|
|
|
//this disables the context menu
|
|
|
|
menuService.AllowActiveWindowListContextMenu = false;
|
|
|
|
menuService.AllowDocumentContextMenu = false;
|
|
|
|
menuService.AllowToolContextMenu = false;
|
|
|
|
|
|
|
|
|
|
|
|
//if (MainForm2.InterCalcAddr)
|
|
|
|
// rcbComputeAddress.Checked = true;
|
|
|
|
//else rcbComputeAddress.Checked = false;
|
|
|
|
|
2024-06-05 11:00:51 +00:00
|
|
|
string startTimeCustomFormat = MainForm2.DayFirst ? "dd/MM/yyyy hh:mm tt" : "MM/dd/yyyy hh:mm tt";
|
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
if (MainForm2.is24hours)
|
2024-06-05 11:00:51 +00:00
|
|
|
startTimeCustomFormat = MainForm2.DayFirst ? "dd/MM/yyyy HH:mm" : "MM/dd/yyyy HH:mm";
|
|
|
|
|
|
|
|
rdpStartTime.CustomFormat = startTimeCustomFormat;
|
2024-02-22 16:43:59 +00:00
|
|
|
rdpEndTime.CustomFormat = rdpStartTime.CustomFormat;
|
|
|
|
// set history time format
|
|
|
|
HistoryGridCellElement.timeFormat = rdpStartTime.CustomFormat;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private CefSharpChromiumWebBrowser GetMapController()
|
|
|
|
{
|
|
|
|
if (mapGoogles != null)
|
|
|
|
{
|
|
|
|
mapGoogles.Dispose();
|
|
|
|
mapGoogles = null;
|
|
|
|
docLoad = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String safemobileDirPath = System.Windows.Forms.Application.StartupPath.Replace('\\', '/').Replace(" ", "%20");
|
|
|
|
safemobileDirPath = safemobileDirPath.Replace("#", "%23");
|
|
|
|
|
|
|
|
mapGoogles = new CefSharpChromiumWebBrowser("file:///" + safemobileDirPath + "/resource/" + MainForm2.MapHtmlName);
|
|
|
|
|
|
|
|
mapGoogles.OnWebPageLoaded += delegate ()
|
|
|
|
{
|
|
|
|
bool isClassicIcons = (Safedispatch_4_0.MainForm2.iconThemeType == IconTheme.CLASSIC ? true : false);
|
|
|
|
|
|
|
|
docLoad = true;
|
|
|
|
|
|
|
|
mapGoogles.ExecuteScript(string.Format("window.GWTcallback('showconsole,{0}');", MainForm2.MapDebugConsole)); //FORKITT
|
|
|
|
mapGoogles.ExecuteScript("window.GWTcallback('setLegacyIcons," + (isClassicIcons ? "true" : "false") + "');");
|
|
|
|
mapGoogles.ExecuteScript("window.GWTcallback('centerzoom,"
|
|
|
|
+ MainForm2.FixDoubleLAT(Safedispatch_4_0.MainForm2.LatStart.ToString()) + ","
|
|
|
|
+ MainForm2.FixDoubleLNG(Safedispatch_4_0.MainForm2.LngStart.ToString()) + ","
|
|
|
|
+ Safedispatch_4_0.MainForm2.ZoomStart + "');");
|
|
|
|
mapGoogles.ExecuteScript("window.GWTcallback('" + "reset" + "');");
|
|
|
|
//chrome.ExecuteScript("window.GWTcallback('showconsole,true');");
|
|
|
|
};
|
|
|
|
|
|
|
|
mapGoogles.OnBrowserURLChanged += delegate (String currentURL)
|
|
|
|
{
|
|
|
|
//MessageBox.Show("Current URL is " + currentURL);
|
|
|
|
};
|
|
|
|
|
|
|
|
mapGoogles.OnURLResponseReceived += delegate (String urlResponse)
|
|
|
|
{
|
|
|
|
//MessageBox.Show("Received from map: " + urlResponse);
|
|
|
|
try
|
|
|
|
{
|
|
|
|
this.Invoke(new ProcessResponseFromMapInvokeCallBack(this.ProcessResponseFromMap), urlResponse);
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
Utils.WriteLine("Error on map received:" + ex.ToString(), ConsoleColor.Red);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
return mapGoogles;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Add the Groups as Nodes inside the Tree View
|
|
|
|
/// </summary>
|
|
|
|
private void populateListBoxGroup()
|
|
|
|
{
|
|
|
|
// all units group
|
|
|
|
ColorUnitTreeNode groupNode = new ColorUnitTreeNode(MainForm2.returnLNGString("allunits"));
|
|
|
|
groupNode.Font = new Font(
|
|
|
|
new FontFamily("Segoe UI"),
|
|
|
|
12,
|
|
|
|
FontStyle.Bold,
|
|
|
|
GraphicsUnit.Pixel);
|
|
|
|
groupNode.Tag = -1;
|
|
|
|
groupNode.CheckState = Telerik.WinControls.Enumerations.ToggleState.Off;
|
|
|
|
groupNode.Expanded = true;
|
|
|
|
groupNode.Color = Color.Brown;
|
|
|
|
|
|
|
|
treeViewUnits.Nodes.Add(groupNode);
|
|
|
|
|
|
|
|
GroupClass g = new GroupClass();
|
|
|
|
// for each group add a tree node
|
|
|
|
foreach (int i in MainForm2.GroupHash.Keys)
|
|
|
|
{
|
|
|
|
g = (GroupClass)MainForm2.GroupHash[i];
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
AddTreeGroup(g.name, g.id);
|
|
|
|
}
|
|
|
|
catch(Exception ex)
|
|
|
|
{
|
|
|
|
Utils.WriteLine("Unable to create Group: " + ex.ToString(), ConsoleColor.Red);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Add a Group Node to the Tree View
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="groupName">Group name which needs to be added to the Tree Node</param>
|
|
|
|
/// <param name="groupID">Group ID which will be set as a tag for this group node</param>
|
|
|
|
/// <returns>Returns the inserted Tree Node</returns>
|
|
|
|
private ColorUnitTreeNode AddTreeGroup(string groupName, Int32 groupID)
|
|
|
|
{
|
|
|
|
ColorUnitTreeNode groupNode = new ColorUnitTreeNode(groupName);
|
|
|
|
groupNode.Font = new Font(
|
|
|
|
new FontFamily("Segoe UI"),
|
|
|
|
12,
|
|
|
|
FontStyle.Bold,
|
|
|
|
GraphicsUnit.Pixel);
|
|
|
|
groupNode.Tag = groupID;
|
|
|
|
groupNode.CheckState = Telerik.WinControls.Enumerations.ToggleState.Off;
|
|
|
|
groupNode.Expanded = true;
|
|
|
|
groupNode.Color = Color.Red;
|
|
|
|
|
|
|
|
// add the node to the tree view
|
|
|
|
treeViewUnits.Nodes[0].Nodes.Add(groupNode);
|
|
|
|
|
|
|
|
return groupNode;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private bool DefaultGroupAdded = false;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Add Units to the groups nodes in the Tree View
|
|
|
|
/// </summary>
|
|
|
|
private void populateListBoxUnits()
|
|
|
|
{
|
|
|
|
// for each Unit defined in the hash table
|
|
|
|
foreach (DictionaryEntry de in MainForm2.vehicleHT)
|
|
|
|
{
|
|
|
|
Vehicle veh = de.Value as Vehicle;
|
|
|
|
|
|
|
|
if (veh != null)
|
|
|
|
{
|
|
|
|
ColorUnitTreeNode unitNode = new ColorUnitTreeNode(veh.busName);
|
|
|
|
unitNode.Tag = veh.sc_id;
|
|
|
|
|
|
|
|
unitNode.Color = ((Vehicle)MainForm2.vehicleHT[veh.busName]).histcolor;
|
|
|
|
|
|
|
|
// check to see if the unit is assigned to a group
|
|
|
|
if (veh.group != null && veh.group.Id != 0)
|
|
|
|
{
|
|
|
|
// the group already exists
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// create Unassigned group if not created until now
|
|
|
|
if (!DefaultGroupAdded)
|
|
|
|
{
|
|
|
|
AddTreeGroup(MainForm2.returnLNGString("otherunit"), 0);
|
|
|
|
DefaultGroupAdded = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// search the group in which the unit will be added
|
|
|
|
foreach (ColorUnitTreeNode groupNode in treeViewUnits.Nodes[0].Nodes)
|
|
|
|
{
|
|
|
|
Int32 groupID = (Int32)groupNode.Tag;
|
|
|
|
if (groupID == veh.group.Id)
|
|
|
|
groupNode.Nodes.Add(unitNode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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];
|
2024-06-05 11:00:51 +00:00
|
|
|
if (menuItem.Name.Equals("CloseWindow") ||
|
|
|
|
menuItem.Name.Equals("CloseAllButThis") ||
|
|
|
|
menuItem.Name.Equals("CloseAll") ||
|
|
|
|
menuItem.Name.Equals("Floating") ||
|
|
|
|
menuItem.Name.Equals("Docked") ||
|
|
|
|
menuItem.Name.Equals("Hidden") ||
|
2024-02-22 16:43:59 +00:00
|
|
|
menuItem is RadMenuSeparatorItem)
|
|
|
|
{
|
|
|
|
menuItem.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void GetPositionsAndAlarms(ArrayList listOfVehicles)
|
|
|
|
{
|
|
|
|
String toSendVehicles;
|
|
|
|
String toSendTimes;
|
|
|
|
toSendVehicles = "";
|
|
|
|
toSendTimes = "";
|
|
|
|
Int32 maxGooglePos = 2000;//400
|
|
|
|
Int32 cntLimPos = 0; //max 2000 for google
|
|
|
|
Int32 oldcntLimPos = 0;
|
|
|
|
selectedPositions.Clear();
|
|
|
|
DataPos.Clear();
|
|
|
|
DataPosOutSide.Clear();
|
|
|
|
ArrayList tmpPos = new ArrayList();
|
|
|
|
ArrayList tmpPosOut = new ArrayList();
|
|
|
|
try
|
|
|
|
{
|
|
|
|
// for each group I should check the units which are selected
|
|
|
|
foreach (RadTreeNode node in treeViewUnits.Nodes[0].Nodes)
|
|
|
|
foreach (RadTreeNode unit in node.Nodes)
|
|
|
|
if (unit.Checked)
|
|
|
|
{
|
|
|
|
SM.Debug("Adding vechicle :" + unit.Text);
|
|
|
|
toSendVehicles = toSendVehicles + unit.Text + ",";
|
|
|
|
tmpPosOut.Clear();
|
|
|
|
tmpPosOut = smdbObj.get_HistoryPositions2(unit.Text, timestart, timestop);
|
|
|
|
|
|
|
|
if (cntLimPos < maxGooglePos)
|
|
|
|
{
|
|
|
|
tmpPos.Clear();
|
|
|
|
foreach (SMposition objmove in tmpPosOut)
|
|
|
|
tmpPos.Add(objmove);
|
|
|
|
|
|
|
|
oldcntLimPos = cntLimPos;
|
|
|
|
cntLimPos += tmpPos.Count;
|
|
|
|
if (cntLimPos > maxGooglePos)
|
|
|
|
{
|
|
|
|
hitLimit = true;
|
|
|
|
for (int i = (maxGooglePos - oldcntLimPos); i < (cntLimPos - oldcntLimPos); i++)
|
|
|
|
tmpPos.RemoveAt(maxGooglePos - oldcntLimPos);
|
|
|
|
}
|
|
|
|
if (closeTabThread) return;
|
|
|
|
if (addrDecision)
|
|
|
|
{
|
|
|
|
String listADDR = "";
|
|
|
|
try
|
|
|
|
{
|
|
|
|
foreach (SMposition obj in tmpPos)
|
|
|
|
{
|
|
|
|
if ((obj.m_address == "") || (obj.m_address == " "))
|
|
|
|
{
|
|
|
|
MainForm2.cntaddr++;
|
|
|
|
IdReportHS[MainForm2.cntaddr.ToString()] = "no address";
|
|
|
|
AddrGISQueue.Enqueue(new AddrAndID(MainForm2.cntaddr, obj.m_lat, obj.m_lng));
|
|
|
|
obj.m_address = MainForm2.cntaddr.ToString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
GisAddressWorker.RunWorkerAsync();
|
|
|
|
//mapControl.ActiveMap.SetAddrCmdALL(listADDR);
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
SM.Debug("Error on calculate address:" + ex.ToString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else tmpPos = new ArrayList();
|
|
|
|
|
|
|
|
foreach (SMposition obj in tmpPosOut)
|
|
|
|
selectedPositions.Add(obj);
|
|
|
|
|
|
|
|
SimpleRoute tmpX = new SimpleRoute(tmpPos);
|
|
|
|
SimpleRoute tmpXOut = new SimpleRoute(tmpPosOut);
|
|
|
|
DataPos.Add(unit.Text, tmpX);
|
|
|
|
DataPosOutSide.Add(unit.Text, tmpXOut);
|
|
|
|
SM.Debug("Adding vechicle :" + unit.Text + "Number of position" + tmpPos.Count);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (toSendVehicles.Length > 0)
|
|
|
|
{
|
|
|
|
selectedPositions.Sort(new VehicleComparer());
|
|
|
|
actualNOfPositions = selectedPositions.Count;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
actualNOfPositions = 0;
|
|
|
|
selectedPositions.Clear();
|
|
|
|
}
|
|
|
|
SM.Debug("GetPositionsAndAlarms max no of positions : " + actualNOfPositions);
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
SM.Debug("Error on database connection Mess: "+ex.ToString());
|
|
|
|
MainForm2.Connfailed = true;
|
|
|
|
throw new ArgumentException("Database connection failed");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
volatile String volAddress = "";
|
|
|
|
volatile String volSpeedString = "";
|
|
|
|
volatile List<DataforGRID> ListforGrid = new List<DataforGRID>();
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
///populates the list of vehicles from the Table tab </summary>
|
|
|
|
/// <param name="listOfVehicles">an array of strings containing the vehicles names</param>
|
|
|
|
private void populateTableVehiclesList()
|
|
|
|
{
|
|
|
|
ArrayList positions = new ArrayList();
|
|
|
|
if (selectedPositions.Count > 0)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
// reset the datasource
|
|
|
|
gridHistoryPoints.DataSource = null;
|
|
|
|
gridHistoryPoints.DataSource = ListforGrid;
|
|
|
|
// select first row
|
|
|
|
gridHistoryPoints.CurrentRow = gridHistoryPoints.Rows[0];
|
|
|
|
|
|
|
|
// update tracklist
|
|
|
|
UpdateHistoryTrackList(0, ListforGrid.Count - 1);
|
|
|
|
|
|
|
|
// set the minimum and the maximum dates
|
|
|
|
minTime = (Int32)rdpStartTime.Value.DateTo70Format();
|
|
|
|
maxTime = (Int32)rdpEndTime.Value.DateTo70Format();
|
|
|
|
|
|
|
|
// activate the history result tab
|
|
|
|
radDock1.ActivateWindow(windowHistoryResult);
|
|
|
|
|
|
|
|
// flag that the map is dirty
|
|
|
|
mapIsDirty = true;
|
|
|
|
|
|
|
|
// enable the history result window
|
|
|
|
foreach (Control ctr in windowHistoryResult.Controls)
|
|
|
|
ctr.Enabled = true;
|
|
|
|
|
|
|
|
rlAnimation.Text = MainForm2.returnLNGString(selectedPositions.Count > 100 ? "histAnimationDisable" : "histAnimation");
|
|
|
|
panelAnimationButtons.Enabled = selectedPositions.Count > 100 ? false : true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
SM.Debug("Error on populate grid" + ex.ToString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gridHistoryPoints.Rows.Clear();
|
|
|
|
gridHistoryPoints.DataSource = null;
|
|
|
|
gridHistoryPoints.Refresh();
|
|
|
|
|
|
|
|
|
|
|
|
RadMessageBox.Show(Nodata, "Info", MessageBoxButtons.OK, RadMessageIcon.Info);
|
|
|
|
}
|
|
|
|
|
|
|
|
//tableVehiclesList.TableElement.ScrollToRow(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void UpdateHistoryTrackList(int minVal, int maxVal)
|
|
|
|
{
|
|
|
|
// set the range values + start and end time
|
|
|
|
timeTrackBar.TrackBarMode = Telerik.WinControls.UI.TrackBarRangeMode.SingleThumb;
|
|
|
|
timeTrackBar.Minimum = minVal;
|
|
|
|
timeTrackBar.Maximum = maxVal;
|
|
|
|
|
|
|
|
timeTrackBar.LargeTickFrequency = (int)(maxVal / 5);
|
|
|
|
timeTrackBar.SmallTickFrequency = (int)(maxVal / 25);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Deletes all used resources
|
|
|
|
/// </summary>
|
|
|
|
public void Delete()
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (WorkerHead.IsBusy)
|
|
|
|
closeTabThread = true;
|
|
|
|
WorkerHead.Dispose();
|
|
|
|
this.Dispose();
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
SM.Debug("Error on close TAB HISTORY:"+tabName+" Ex:"+ex.Message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public delegate void UpdateCurrentTimeCallBack(string text);
|
|
|
|
|
|
|
|
private void UpdateStatusBar(string text)
|
|
|
|
{
|
|
|
|
txProgStatus.Text = text;
|
|
|
|
txProgStatus.Update();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void UpdateChangeSize(string text)
|
|
|
|
{
|
|
|
|
txProgStatus.Size = new Size(205, 20);
|
|
|
|
txProgStatus.Update();
|
|
|
|
}
|
|
|
|
|
|
|
|
public delegate void UpdateStatusBarCallBack(string text);
|
|
|
|
|
|
|
|
private void UpdateProgressBar(Int32 max)
|
|
|
|
{
|
|
|
|
if (max == -1)
|
|
|
|
{
|
|
|
|
HistroyProgBar.ProgressBarElement.PerformStepValue1();
|
|
|
|
HistroyProgBar.Update();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
HistroyProgBar.Maximum = max;
|
|
|
|
HistroyProgBar.Value1 = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public delegate void UpdateProgressBarCallBack(Int32 max);
|
|
|
|
|
|
|
|
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
|
|
|
|
{
|
|
|
|
BackgroundWorker worker = sender as BackgroundWorker;
|
|
|
|
e.Result = Computation(worker, e);
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (this.mapControl == null)
|
|
|
|
return;
|
|
|
|
|
|
|
|
this.mapControl.ActiveMap.Saved = true;
|
|
|
|
parent.isCanceled[tabName] = false;
|
|
|
|
/*if (this.WorkerHead.IsBusy || this.WorkerHist.IsBusy)
|
|
|
|
Thread.Sleep(100); */
|
|
|
|
|
|
|
|
int countStop = 0;
|
|
|
|
while (this.WorkerHead.IsBusy)
|
|
|
|
{
|
|
|
|
Thread.Sleep(200);
|
|
|
|
countStop++;
|
|
|
|
if (countStop > 20) break;
|
|
|
|
}
|
|
|
|
Killtimer.Enabled = true;
|
|
|
|
Killtimer.Start();
|
|
|
|
this.mapControl.ActiveMap.Saved = true;
|
|
|
|
Killtimer.Stop();
|
|
|
|
|
|
|
|
this.mapControl = null;
|
|
|
|
GC.Collect();
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
SM.Debug("Exception on close mappoint HistoryTab "+ex.Message);
|
|
|
|
}
|
|
|
|
if ((MainForm2.ClosingApp)&&(!KillTimerActive))
|
|
|
|
{
|
|
|
|
SM.Debug("Worker History : " + tabName + " FINISHED");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Validates the text from param; the text is valid if only contains numbers (from 0 to 9)
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="param">The string to be validated</param>
|
|
|
|
/// <returns></returns>
|
|
|
|
public String ValidateText(String param)
|
|
|
|
{
|
|
|
|
string text, text2;
|
|
|
|
|
|
|
|
int i;
|
|
|
|
text = param; text2 = "";
|
|
|
|
for (i = 0; i < text.Length; i++)
|
|
|
|
{
|
|
|
|
if ((text[i] >= '0') && (text[i] <= '9'))
|
|
|
|
{
|
|
|
|
text2=text2+text[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return text2;
|
|
|
|
}
|
|
|
|
|
|
|
|
private Int32 CalcHead(Double lastLocX, Double lastLocY, Double prevLocX, Double prevLocY, Int32 heading)
|
|
|
|
{
|
|
|
|
Double dlng = lastLocX - prevLocX;
|
|
|
|
Double dlat = lastLocY - prevLocY;
|
|
|
|
Double mdelta_min = -0.00001;
|
|
|
|
Double delta_min = 0.00001;
|
|
|
|
Int32 headcalc = 0;
|
|
|
|
Double blat = 0;
|
|
|
|
Double blng = 0;
|
|
|
|
if ((dlat > mdelta_min) && (dlat < delta_min) && ((mdelta_min < dlng) && dlng < (delta_min))) headcalc = (Int32)heading;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((mdelta_min < dlat) && (dlat < delta_min))
|
|
|
|
{
|
|
|
|
blng = 1;
|
|
|
|
if (dlng < 0) headcalc = 180;
|
|
|
|
else headcalc = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
blat = 1;
|
|
|
|
if (dlat > 0) headcalc = 90;
|
|
|
|
else headcalc = 270;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((mdelta_min < dlng) && (dlng < delta_min))
|
|
|
|
{
|
|
|
|
if (blat == 0)
|
|
|
|
{
|
|
|
|
if (dlat > 0)
|
|
|
|
{
|
|
|
|
if (headcalc == 180) headcalc = 135;
|
|
|
|
if (headcalc == 0) headcalc = 45;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (headcalc == 180) headcalc = 225;
|
|
|
|
if (headcalc == 0) headcalc = 315;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (blng == 0)
|
|
|
|
{
|
|
|
|
if (dlng < 0)
|
|
|
|
{
|
|
|
|
if (headcalc == 90) headcalc = 135;
|
|
|
|
if (headcalc == 270) headcalc = 225;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (headcalc == 90) headcalc = 45;
|
|
|
|
if (headcalc == 270) headcalc = 315;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return headcalc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Catches the click on the display history button
|
|
|
|
/// Checks each vehicle for defined routes and displays them on the MapPoint control
|
|
|
|
/// Computes the positions of the corners for all defined routes, for zooming purposes
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
/// <param name="e"></param>
|
|
|
|
private void btDisplayHeadingHisotry_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
if (mapIsDirty)
|
|
|
|
{
|
|
|
|
if (mapGoogles != null && HistMapPanel.Controls.Contains(mapGoogles))
|
|
|
|
HistMapPanel.Controls.Remove(mapGoogles);
|
|
|
|
|
|
|
|
HistMapPanel.Controls.Add(GetMapController());
|
|
|
|
mapIsDirty = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//int lowerSpeed = (rcbSpeedLower.Checked ? (int)(MainForm2.isInMile ? (Int32)Math.Round((Int32)rseSpeedLower.Value * 1.60934) : (Int32)rseSpeedLower.Value) : 0);
|
|
|
|
//int upperSpeed = (rcbSpeedUpper.Checked ? (int)(MainForm2.isInMile ? (Int32)Math.Round((Int32)rseSpeedUpper.Value * 1.60934) : (Int32)rseSpeedUpper.Value) : 0);
|
|
|
|
|
|
|
|
// save upper and lower speed limits
|
|
|
|
MainForm2.HistSpeedLimit = (rcbSpeedLower.Checked ? (int)rseSpeedLower.Value : 0);
|
|
|
|
MainForm2.HistUpperSpeedLimit = (rcbSpeedUpper.Checked ? (int)rseSpeedUpper.Value : 0);
|
|
|
|
|
|
|
|
//MainForm2.HistSpeedLimit = lowerSpeed;
|
|
|
|
//MainForm2.HistUpperSpeedLimit = upperSpeed;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
smdbObj.Update_Speed_Limit("hisMinSpeed", MainForm2.HistSpeedLimit);
|
|
|
|
smdbObj.Update_Speed_Limit("hisMaxSpeed", MainForm2.HistUpperSpeedLimit);
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
SM.Debug("Add history speed limit in Database"+ex.ToString());
|
|
|
|
}
|
|
|
|
Boolean selOK = false;
|
|
|
|
if (rdpStartTime.Enabled)
|
|
|
|
{
|
|
|
|
if (rdpStartTime.Value.GetSecondsFromDT().ConvertLocalToGMT() > rdpEndTime.Value.GetSecondsFromDT().ConvertLocalToGMT())
|
|
|
|
{
|
|
|
|
if ((MainForm2.radioType==RADIOTYPE.HARRIS)||(MainForm2.radioType == RADIOTYPE.ATLAS)) ((RadLabel)RadMessageBox.Instance.Controls[1]).LabelElement.ForeColor = MainForm2.HarTextColor;
|
|
|
|
RadMessageBox.Show(endtimegreate, "", MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
selOK = true;
|
|
|
|
timestart = rdpStartTime.Value.GetSecondsFromDT().ConvertLocalToGMT();
|
|
|
|
timestop = rdpEndTime.Value.GetSecondsFromDT().ConvertLocalToGMT();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
selOK = true;
|
|
|
|
timestart = DateTime.Now.GetSecondsFromDT().ConvertLocalToGMT() - 86400;
|
|
|
|
timestop = DateTime.Now.GetSecondsFromDT().ConvertLocalToGMT();
|
|
|
|
}
|
|
|
|
|
|
|
|
//rcbShowGeofence.Checked = false;
|
|
|
|
|
|
|
|
if (selOK)
|
|
|
|
{
|
|
|
|
Boolean havecar = false;
|
|
|
|
MaxLAT = -90;
|
|
|
|
MaxLNG = -180;
|
|
|
|
MinLAT = 90;
|
|
|
|
MinLNG = 180;
|
|
|
|
FirstGoogle = true;
|
|
|
|
selectedPositions.Clear();
|
|
|
|
try
|
|
|
|
{
|
|
|
|
SliderPosition.Clear();
|
|
|
|
SliderCount = 0;
|
|
|
|
Point_for_play.Clear();
|
|
|
|
if (gridHistoryPoints.Rows.Count > 0)
|
|
|
|
{
|
|
|
|
gridHistoryPoints.Rows[0].IsSelected = true;
|
|
|
|
gridHistoryPoints.Rows[0].IsCurrent = true;
|
|
|
|
}
|
|
|
|
if (timeTrackBar.Maximum > 0)
|
|
|
|
{
|
|
|
|
changeTrackbarValueFromCode = true;
|
|
|
|
timeTrackBar.Value = 0;
|
|
|
|
timeTrackBar.Maximum = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
Utils.WriteLine("Exception put all elements on 0: "+ex.ToString(),ConsoleColor.Red);
|
|
|
|
}
|
|
|
|
// for each group I should check the units which are selected
|
|
|
|
foreach (RadTreeNode node in treeViewUnits.Nodes[0].Nodes)
|
|
|
|
foreach (RadTreeNode unit in node.Nodes)
|
|
|
|
if (unit.Checked)
|
|
|
|
{
|
|
|
|
havecar = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (havecar)
|
|
|
|
HeadStart();
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((MainForm2.radioType == RADIOTYPE.HARRIS)||(MainForm2.radioType == RADIOTYPE.ATLAS)) ((RadLabel)RadMessageBox.Instance.Controls[1]).LabelElement.ForeColor = MainForm2.HarTextColor;
|
|
|
|
RadMessageBox.Show(plsselcectcar);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private volatile Boolean addrDecision = false;
|
|
|
|
|
|
|
|
private void HeadStart()
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
//splitPanel3.SizeInfo.AbsoluteSize = new Size(splitPanel1.Width, 1);
|
|
|
|
int count = 0;
|
|
|
|
|
|
|
|
// for each group I should check the units which are selected
|
|
|
|
foreach(RadTreeNode node in treeViewUnits.Nodes[0].Nodes)
|
|
|
|
foreach(RadTreeNode unit in node.Nodes)
|
|
|
|
if (unit.Checked)
|
|
|
|
count++;
|
|
|
|
|
|
|
|
|
|
|
|
/* if (count > 1)
|
|
|
|
MainForm2.HistContinu = true;
|
|
|
|
else MainForm2.HistContinu = false;*/
|
|
|
|
addrDecision = rcbComputeAddress.Checked;
|
|
|
|
rbSearchHistory.Enabled = false;
|
|
|
|
rcbComputeAddress.Enabled = false;
|
|
|
|
|
|
|
|
Cursor = Cursors.WaitCursor;
|
|
|
|
mapControl.MousePointer = GeoPointerx.geoPointerHourglass;
|
|
|
|
HistroyProgBar.Visible = true;
|
|
|
|
HistroyProgBar.Value1 = 0;
|
|
|
|
HistoryPanel.Visible = true;
|
|
|
|
txProgStatus.Visible = true;
|
|
|
|
txProgStatus.Clear();
|
|
|
|
|
|
|
|
if (docLoad)
|
|
|
|
{
|
|
|
|
mapGoogles.ExecuteScript("window.GWTcallback('" + "reset" + "');");
|
|
|
|
if (rcbShowGeofence.Checked) ForceShowZone();
|
|
|
|
}
|
|
|
|
|
|
|
|
mapControl.ListShapeCMD.Clear();
|
|
|
|
WorkerHead.RunWorkerAsync();
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
SM.Debug("Error on start heading" + ex.Message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (this.mapControl == null)
|
|
|
|
return;
|
|
|
|
|
|
|
|
parent.isCanceled[tabName] = false;
|
|
|
|
if (e.Cancelled)
|
|
|
|
SM.Debug("File: HistoryTab.cs Meth: backgroundWorker1_RunWorkerCompleted You cancelled!");
|
|
|
|
else if (e.Error != null)
|
|
|
|
SM.Debug("File: HistoryTab.cs Meth: backgroundWorker1_RunWorkerCompleted Worker exception: " + e.Error.ToString());
|
|
|
|
else
|
|
|
|
SM.Debug("File: HistoryTab.cs Meth: backgroundWorker1_RunWorkerCompleted Complete - " + e.Result); // from DoWork
|
|
|
|
|
|
|
|
while (this.WorkerHead.IsBusy)
|
|
|
|
{
|
|
|
|
Thread.Sleep(100);
|
|
|
|
}
|
|
|
|
this.mapControl.ActiveMap.Saved = true;
|
|
|
|
if (this.app != null)
|
|
|
|
{
|
|
|
|
app.Quit();
|
|
|
|
app = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
Killtimer.Enabled = true;
|
|
|
|
Killtimer.Start();
|
|
|
|
this.mapControl.ActiveMap.Saved = true;
|
|
|
|
Killtimer.Stop();
|
|
|
|
|
|
|
|
this.mapControl = null;
|
|
|
|
GC.Collect();
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
SM.Debug("Final RunCompleted Worker History Error" + ex.Message);
|
|
|
|
}
|
|
|
|
if ((MainForm2.ClosingApp)&&(!KillTimerActive))
|
|
|
|
{
|
|
|
|
SM.Debug("Worker History : " + tabName + " FINISHED");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ************************************************************************************ */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum PS
|
|
|
|
{
|
|
|
|
BACK = 0,
|
|
|
|
PLAY,
|
|
|
|
PAUSE,
|
|
|
|
STOP,
|
|
|
|
FORWARD
|
|
|
|
}
|
|
|
|
PS ePlayStatus = PS.STOP;
|
|
|
|
PS ePrevPlayStatus = PS.STOP;
|
|
|
|
|
|
|
|
private void btBack_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
rsePositionDisplay.Enabled = true;
|
|
|
|
rseSkipSeconds.Enabled = true;
|
|
|
|
|
|
|
|
//expando1.Enabled = false;
|
|
|
|
ePrevPlayStatus = ePlayStatus;
|
|
|
|
ePlayStatus = PS.BACK;
|
|
|
|
|
|
|
|
rbPrev.Enabled = true;
|
|
|
|
rbPlay.Enabled = true;
|
|
|
|
rbPause.Enabled = false;
|
|
|
|
rbStop.Enabled = true;
|
|
|
|
rbNext.Enabled = true;
|
|
|
|
|
|
|
|
Thread.Sleep(200);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void btPlay_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
rsePositionDisplay.Enabled = false;
|
|
|
|
rseSkipSeconds.Enabled = false;
|
|
|
|
|
|
|
|
|
|
|
|
if (ePrevPlayStatus == PS.STOP)
|
|
|
|
{
|
|
|
|
if (docLoad)
|
|
|
|
{
|
|
|
|
mapGoogles.ExecuteScript("window.GWTcallback('" + "removeDataset,heading_positions" + "');");
|
|
|
|
FirstGoogle = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ePrevPlayStatus = ePlayStatus;
|
|
|
|
ePlayStatus = PS.PLAY;
|
|
|
|
|
|
|
|
|
|
|
|
rbPrev.Enabled = false;
|
|
|
|
rbPlay.Enabled = false;
|
|
|
|
rbPause.Enabled = true;
|
|
|
|
rbStop.Enabled = true;
|
|
|
|
rbNext.Enabled = false;
|
|
|
|
|
|
|
|
|
|
|
|
rbSearchHistory.Enabled = false;
|
|
|
|
rcbComputeAddress.Enabled = false;
|
|
|
|
Thread.Sleep(200);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void btPause_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
|
|
|
|
rsePositionDisplay.Enabled = true;
|
|
|
|
rseSkipSeconds.Enabled = true;
|
|
|
|
|
|
|
|
ePrevPlayStatus = ePlayStatus;
|
|
|
|
ePlayStatus = PS.PAUSE;
|
|
|
|
|
|
|
|
|
|
|
|
rbPrev.Enabled = true;
|
|
|
|
rbPlay.Enabled = true;
|
|
|
|
rbPause.Enabled = false;
|
|
|
|
rbStop.Enabled = true;
|
|
|
|
rbNext.Enabled = true;
|
|
|
|
|
|
|
|
rbSearchHistory.Enabled = true;
|
|
|
|
rcbComputeAddress.Enabled = true;
|
|
|
|
Thread.Sleep(200);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void btStopInvoke(string text)
|
|
|
|
{
|
|
|
|
rbStop.PerformClick();
|
|
|
|
}
|
|
|
|
|
|
|
|
public delegate void btStopInvokeCallBack(String text);
|
|
|
|
|
|
|
|
private void btStop_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
|
|
|
|
rsePositionDisplay.Enabled = true;
|
|
|
|
rseSkipSeconds.Enabled = true;
|
|
|
|
ePrevPlayStatus = ePlayStatus;
|
|
|
|
ePlayStatus = PS.STOP;
|
|
|
|
|
|
|
|
rbPrev.Enabled = false;
|
|
|
|
rbPlay.Enabled = true;
|
|
|
|
rbPause.Enabled = false;
|
|
|
|
rbStop.Enabled = false;
|
|
|
|
rbNext.Enabled = false;
|
|
|
|
|
|
|
|
rbSearchHistory.Enabled = true;
|
|
|
|
rcbComputeAddress.Enabled = true;
|
|
|
|
Thread.Sleep(200);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void btForward_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
rsePositionDisplay.Enabled = true;
|
|
|
|
rseSkipSeconds.Enabled = true;
|
|
|
|
|
|
|
|
ePrevPlayStatus = ePlayStatus;
|
|
|
|
ePlayStatus = PS.FORWARD;
|
|
|
|
|
|
|
|
rbPrev.Enabled = true;
|
|
|
|
rbPlay.Enabled = true;
|
|
|
|
rbPause.Enabled = false;
|
|
|
|
rbStop.Enabled = true;
|
|
|
|
rbNext.Enabled = true;
|
|
|
|
|
|
|
|
Thread.Sleep(200);
|
|
|
|
}
|
|
|
|
|
|
|
|
public String GetSymbName(Int32 id)
|
|
|
|
{
|
|
|
|
String s = "";
|
|
|
|
if (id > 1)
|
|
|
|
{
|
|
|
|
foreach (Symbolx obj in mapControl.ActiveMap.Symbols)
|
|
|
|
if (obj.ID == id)
|
|
|
|
{
|
|
|
|
s = obj.Name;
|
|
|
|
s = s.ToLower();
|
|
|
|
s = s.Replace(".ico", ".png");
|
|
|
|
s = s.Replace(".bmp", ".png");
|
|
|
|
if ((s.Length > 3) && (s[2] == '_')) s = s.Remove(0, 3);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (id== 0) s = "STOP.png";
|
|
|
|
else if (id == 1) s = "PIN.png";
|
|
|
|
}
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private volatile String vehSelect = "";
|
|
|
|
private volatile Int32 Index_to_play = 0;
|
|
|
|
long Computation(BackgroundWorker worker, DoWorkEventArgs e)
|
|
|
|
{
|
|
|
|
pp = null;
|
|
|
|
Pushpinx pp1 = null;
|
|
|
|
SMposition tempPos;
|
|
|
|
//ConvertDT convDT = new ConvertDT();
|
|
|
|
//timeTemp = 0;
|
|
|
|
first = true;
|
|
|
|
|
|
|
|
while (MainForm2.isRunning)
|
|
|
|
{
|
|
|
|
if (FirstPlay)
|
|
|
|
{
|
|
|
|
FirstPlay = false;
|
|
|
|
Index_to_play = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Thread.Sleep(10);
|
|
|
|
if ((parent.isCanceled[tabName] != null && (bool)parent.isCanceled[tabName])
|
|
|
|
|| MainForm2.ClosingApp)
|
|
|
|
{
|
|
|
|
SM.Debug("Hist: CancellationPending tabName: " + tabName);
|
|
|
|
e.Cancel = true;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (ePlayStatus == ePrevPlayStatus)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
switch (ePlayStatus)
|
|
|
|
{
|
|
|
|
case PS.PLAY:
|
|
|
|
{
|
|
|
|
if (first)
|
|
|
|
{
|
|
|
|
Index_to_play = 0;
|
|
|
|
first = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ePrevPlayStatus == PS.STOP)
|
|
|
|
{
|
|
|
|
// for each group I should check the units which are selected
|
|
|
|
|
|
|
|
FirstGoogle = true;
|
|
|
|
SMposition tmpos = (SMposition)Point_for_play[0];
|
2024-06-05 11:00:51 +00:00
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
worker.ReportProgress(3);
|
2024-06-05 11:00:51 +00:00
|
|
|
updatecomand = FormatUpdateCommand(tmpos, FirstGoogle);
|
2024-02-22 16:43:59 +00:00
|
|
|
|
2024-06-05 11:00:51 +00:00
|
|
|
latitude = tmpos.m_lat;
|
|
|
|
longitude = tmpos.m_lng;
|
|
|
|
|
|
|
|
if (FirstGoogle)
|
|
|
|
{
|
|
|
|
Thread.Sleep(2000);
|
2024-02-22 16:43:59 +00:00
|
|
|
FirstGoogle = false;
|
2024-06-05 11:00:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
worker.ReportProgress(1, tmpos.m_evnt_id);
|
2024-02-22 16:43:59 +00:00
|
|
|
Index_to_play++;
|
|
|
|
|
2024-06-05 11:00:51 +00:00
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
}// end if prev state is STOP
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
while ((Index_to_play < Point_for_play.Count) && (ePlayStatus == PS.PLAY))
|
|
|
|
{
|
|
|
|
tempPos = ((SMposition)Point_for_play[Index_to_play]);
|
2024-06-05 11:00:51 +00:00
|
|
|
|
|
|
|
// convert to km
|
|
|
|
volSpeedString = ConvertToKm(tempPos);
|
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
|
|
|
|
Index_to_play++;
|
2024-06-05 11:00:51 +00:00
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
if (ePlayStatus == PS.PLAY)
|
|
|
|
{
|
2024-06-05 11:00:51 +00:00
|
|
|
|
|
|
|
updatecomand = FormatUpdateCommand(tempPos, FirstGoogle);
|
|
|
|
FirstGoogle = false;
|
2024-02-22 16:43:59 +00:00
|
|
|
|
|
|
|
latitude = tempPos.m_lat;
|
|
|
|
longitude = tempPos.m_lng;
|
2024-06-05 11:00:51 +00:00
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
worker.ReportProgress(1,tempPos.m_evnt_id);
|
|
|
|
}
|
|
|
|
else
|
2024-06-05 11:00:51 +00:00
|
|
|
break;
|
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
Thread.Sleep(10);
|
|
|
|
|
|
|
|
if ((parent.isCanceled[tabName] != null && (bool)parent.isCanceled[tabName])
|
|
|
|
|| MainForm2.ClosingApp)
|
|
|
|
{
|
|
|
|
e.Cancel = true;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rsePositionDisplay.Value > 200)
|
|
|
|
{
|
|
|
|
for (int mk = 0; mk < rsePositionDisplay.Value / 200; mk++)
|
|
|
|
{
|
|
|
|
if ((parent.isCanceled[tabName] != null && (bool)parent.isCanceled[tabName])
|
|
|
|
|| MainForm2.ClosingApp)
|
|
|
|
{
|
|
|
|
e.Cancel = true;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
Thread.Sleep(200);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else Thread.Sleep((Int32)rsePositionDisplay.Value);
|
|
|
|
|
|
|
|
Thread.Sleep(10);
|
|
|
|
}
|
|
|
|
if ((parent.isCanceled[tabName] != null && (bool)parent.isCanceled[tabName])
|
|
|
|
|| MainForm2.ClosingApp)
|
|
|
|
{
|
|
|
|
e.Cancel = true;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
if (Index_to_play >= Point_for_play.Count)
|
|
|
|
{
|
|
|
|
lock (this)
|
|
|
|
{
|
|
|
|
rbStop.Invoke(new btStopInvokeCallBack(this.btStopInvoke), new object[] { "test" });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
SM.Debug("Exception in play: " + ex.ToString());
|
|
|
|
}
|
|
|
|
ePrevPlayStatus = PS.PLAY;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
case PS.STOP:
|
|
|
|
{
|
|
|
|
StopProced();
|
|
|
|
}
|
|
|
|
ePrevPlayStatus = PS.STOP;
|
|
|
|
break;
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
case PS.BACK:
|
|
|
|
{
|
|
|
|
if (Index_to_play > 0)
|
|
|
|
Index_to_play = Index_to_play - 1;// just to be undercurent time
|
|
|
|
else
|
|
|
|
Index_to_play = 0;
|
|
|
|
tempPos = (SMposition)Point_for_play[Index_to_play];
|
|
|
|
vehSelect = tempPos.m_vehName + "_" + tempPos.m_posID.ToString();
|
|
|
|
worker.ReportProgress(2, tempPos.m_evnt_id);
|
|
|
|
}
|
|
|
|
ePlayStatus = PS.PAUSE;
|
|
|
|
break;
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
case PS.PAUSE:
|
|
|
|
break;
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
case PS.FORWARD:
|
|
|
|
{
|
|
|
|
Boolean onthelimit = false;
|
|
|
|
if (Index_to_play < (Point_for_play.Count - 1))
|
|
|
|
Index_to_play = Index_to_play + 1;//just to over curent time
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Index_to_play = (Point_for_play.Count - 1);
|
|
|
|
onthelimit = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
tempPos = (SMposition)Point_for_play[Index_to_play];
|
|
|
|
|
|
|
|
if (onthelimit)
|
|
|
|
worker.ReportProgress(2, tempPos.m_evnt_id);
|
|
|
|
else
|
|
|
|
{
|
2024-06-05 11:00:51 +00:00
|
|
|
|
|
|
|
updatecomand = FormatUpdateCommand(tempPos, false);
|
2024-02-22 16:43:59 +00:00
|
|
|
worker.ReportProgress(1, tempPos.m_evnt_id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ePlayStatus = PS.PAUSE;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
SM.Debug("File: HistoryTab.cs Meth: compuation Ex:"+ex.ToString());
|
|
|
|
StopProced();
|
|
|
|
|
|
|
|
}
|
|
|
|
} // end while (true)
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2024-06-05 11:00:51 +00:00
|
|
|
|
|
|
|
private string FormatUpdateCommand(SMposition tempPos, bool firstGoogle)
|
|
|
|
{
|
|
|
|
|
|
|
|
// Convert To Km
|
|
|
|
string volSpeedString = ConvertToKm(tempPos);
|
|
|
|
string vehSelect = $"{tempPos.m_vehName}_{tempPos.m_posID}";
|
|
|
|
|
|
|
|
string command = firstGoogle ? "setDataset" : "updateDataset";
|
|
|
|
|
|
|
|
string updateComand = $"{command},heading_positions"
|
|
|
|
+ "," + MainForm2.FixDoubleLAT(tempPos.m_lat.ToString())
|
|
|
|
+ "," + MainForm2.FixDoubleLNG(tempPos.m_lng.ToString())
|
|
|
|
+ "," + (tempPos.m_time).ConvertGMTToLocal().GetDTFromSeconds().ToString("yyyy-MM-dd HH:mm:ss")
|
|
|
|
+ "," + tempPos.m_vehName + "_" + tempPos.m_posID
|
|
|
|
+ "," + volSpeedString + (MainForm2.isInMile ? "mph" : "kph")
|
|
|
|
+ "," + tempPos.m_alt
|
|
|
|
+ "," + MainForm2.FixComma(tempPos.m_address) + ","
|
|
|
|
+ "history/" + GetSymbName(busSymb.GetSymbolFromOrientation(tempPos.m_heading)) + ","
|
|
|
|
+ "false" + "," + "false" + "," + "false";
|
|
|
|
|
|
|
|
|
|
|
|
return updateComand;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private string ConvertToKm(SMposition obj)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (MainForm2.isInMile)
|
|
|
|
return Convert.ToString((int)Math.Round(obj.m_speed * 0.621371192));
|
|
|
|
|
|
|
|
return Convert.ToString((int)(obj.m_speed));
|
|
|
|
}
|
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
// Mihai
|
|
|
|
private bool changeTrackbarValueFromCode = false;
|
|
|
|
/// <summary>
|
|
|
|
/// Changes the value of the timeTrackBar without invoking the associated event
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="value">the new value</param>
|
|
|
|
private void ChangeTrackBarValue(int value)
|
|
|
|
{
|
|
|
|
if (timeTrackBar.InvokeRequired)
|
|
|
|
{
|
|
|
|
timeTrackBar.Invoke(new Action<int>(ChangeTrackBarValueOnThread), value);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ChangeTrackBarValueOnThread(value);
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// Don't call this, call ChangeTrackBarValue instead
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="value"></param>
|
|
|
|
private void ChangeTrackBarValueOnThread(int value)
|
|
|
|
{
|
|
|
|
changeTrackbarValueFromCode = true;
|
|
|
|
timeTrackBar.Value = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void StopProced()
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Index_to_play = 0;
|
|
|
|
first = true;
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
SM.Debug("Erorr on stop procedure:"+ex.ToString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private volatile Int32 volTest = 0;
|
|
|
|
|
|
|
|
public ArrayList List_of_Name_for_History = new ArrayList();
|
|
|
|
public Double MaxLAT = -90;
|
|
|
|
public Double MaxLNG = -180;
|
|
|
|
public Double MinLAT = 90;
|
|
|
|
public Double MinLNG = 180;
|
|
|
|
public ArrayList SliderPosition = new ArrayList();
|
|
|
|
private Int32 SliderCount = 0;
|
|
|
|
|
|
|
|
long ComputHead(BackgroundWorker worker, DoWorkEventArgs e, AxMappointControlx mapControl)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
hitLimit = false;
|
|
|
|
string proc1 = MainForm2.returnLNGString("Update"),
|
2024-06-05 11:00:51 +00:00
|
|
|
proc2 = MainForm2.returnLNGString("Retriev"),
|
|
|
|
proc3 = MainForm2.returnLNGString("Computing"),
|
|
|
|
proc4 = MainForm2.returnLNGString("DelOld");
|
2024-02-22 16:43:59 +00:00
|
|
|
|
|
|
|
txProgStatus.Invoke(new UpdateStatusBarCallBack(this.UpdateStatusBar),proc4);
|
2024-06-05 11:00:51 +00:00
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
Thread.Sleep(5000);
|
2024-06-05 11:00:51 +00:00
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
Pushpinx pp1 = null;
|
|
|
|
Locationx[] posTemp = null;
|
|
|
|
Shapex shp = null;
|
|
|
|
int i = 0;
|
|
|
|
headingMode = true;
|
|
|
|
waitResponse = false;
|
|
|
|
String SpeedData = "mile";
|
|
|
|
String AddressData = "";
|
|
|
|
IdReportHS.Clear();
|
2024-06-05 11:00:51 +00:00
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
if (closeTabThread)
|
|
|
|
{
|
|
|
|
e.Cancel = true;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (closeTabThread)
|
|
|
|
{
|
|
|
|
e.Cancel = true;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
//delete all shapes before drawing the new ones
|
|
|
|
List_of_Name_for_History.Clear();
|
|
|
|
shapes = mapControl.ActiveMap.Shapes;
|
|
|
|
foreach (Shapex s in shapes)
|
|
|
|
if (s.Name.Contains("History"))
|
|
|
|
s.Delete();
|
|
|
|
|
|
|
|
if (closeTabThread)
|
|
|
|
{
|
|
|
|
e.Cancel = true;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
corners[0] = corners[2] = 181.00;
|
|
|
|
corners[1] = corners[3] = -181.00;
|
|
|
|
|
|
|
|
txProgStatus.Invoke(new UpdateStatusBarCallBack(this.UpdateStatusBar), proc2);
|
|
|
|
|
|
|
|
if (closeTabThread)
|
|
|
|
{
|
|
|
|
e.Cancel = true;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
GetPositionsAndAlarms(vehicleListNames);
|
|
|
|
if (actualNOfPositions > 2000)
|
|
|
|
{
|
|
|
|
WorkerHead.ReportProgress(-2);
|
|
|
|
WorkerHead.ReportProgress(-1);
|
|
|
|
while (!waitResponse)
|
|
|
|
{
|
|
|
|
Thread.Sleep(10);
|
|
|
|
}
|
|
|
|
if (!respQuest)
|
|
|
|
{
|
|
|
|
if (GisAddressWorker.IsBusy) GisAddressWorker.CancelAsync();
|
|
|
|
e.Cancel = true;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (closeTabThread)
|
|
|
|
{
|
|
|
|
e.Cancel = true;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
txProgStatus.Invoke(new UpdateStatusBarCallBack(this.UpdateStatusBar), proc1);
|
|
|
|
|
|
|
|
HistroyProgBar.Invoke(new UpdateProgressBarCallBack(this.UpdateProgressBar), actualNOfPositions / 250);
|
|
|
|
|
|
|
|
//delete all shapes before drawing the new ones
|
|
|
|
//RadMessageBox.Show(mapControl.ActiveMap.Shapes.Count.ToString());
|
|
|
|
if (closeTabThread) return 1;
|
|
|
|
shapes = mapControl.ActiveMap.Shapes;
|
|
|
|
foreach (Shapex s in shapes)
|
|
|
|
if (s.Name.Contains("History"))
|
|
|
|
s.Delete();
|
|
|
|
|
|
|
|
//checks for each vehicle if there is any defined route
|
|
|
|
//there_are_routes is true if there are routes, and false otherwise
|
|
|
|
bool there_are_routes = false;
|
|
|
|
actualNOfPositions = 0;
|
|
|
|
minTime = Int32.MaxValue;
|
|
|
|
maxTime = 0;
|
|
|
|
|
|
|
|
txProgStatus.Invoke(new UpdateStatusBarCallBack(this.UpdateStatusBar), proc3);
|
|
|
|
|
|
|
|
int progStep = 0;
|
|
|
|
// for each group I should check the units which are selected
|
|
|
|
foreach (RadTreeNode node in treeViewUnits.Nodes[0].Nodes)
|
|
|
|
foreach (RadTreeNode unit in node.Nodes)
|
|
|
|
if(unit.Checked)
|
|
|
|
{
|
|
|
|
List_of_Name_for_History.Add(unit.Text);
|
|
|
|
int contRoute = -1;
|
|
|
|
Int32 number = 0;
|
2024-06-05 11:00:51 +00:00
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
ArrayList POSList = new ArrayList();
|
|
|
|
SM.Debug("value for name:" + unit.Text);
|
|
|
|
if (DataPos[unit.Text] != null)
|
|
|
|
{
|
|
|
|
POSList = ((SimpleRoute)DataPos[unit.Text]).PositionList;
|
|
|
|
number = POSList.Count;
|
|
|
|
}
|
|
|
|
if (number > 0) there_are_routes = true;
|
|
|
|
Locationx[] pos = new Locationx[number];
|
|
|
|
Locationx lastPos = null;
|
|
|
|
Int32 Headingtmp = 0;
|
|
|
|
//i = 0;
|
|
|
|
i = -1;
|
|
|
|
int cont = -1;
|
|
|
|
|
|
|
|
foreach (SMposition obj3 in POSList)
|
|
|
|
{
|
|
|
|
i++;
|
|
|
|
obj3.m_posID = i;
|
|
|
|
if ((Math.Round(obj3.m_lat) == 0) && (Math.Round(obj3.m_lng) == 0)) continue;
|
|
|
|
if ((progStep % 250) == 0)
|
|
|
|
HistroyProgBar.Invoke(new UpdateProgressBarCallBack(this.UpdateProgressBar), -1);
|
|
|
|
cont++;
|
|
|
|
if (lastPos != null)
|
|
|
|
//if (obj3.m_speed > 0)
|
|
|
|
Headingtmp = CalcHead(obj3.m_lng, obj3.m_lat, lastPos.Longitude, lastPos.Latitude, Headingtmp);
|
|
|
|
obj3.m_heading = Headingtmp;
|
|
|
|
|
|
|
|
if (closeTabThread)
|
|
|
|
{
|
|
|
|
e.Cancel = true;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
lastPos = mapControl.ActiveMap.GetLocation(obj3.m_lat, obj3.m_lng, 10);
|
|
|
|
pos[cont] = lastPos;
|
|
|
|
//name
|
|
|
|
string headtitle = unit.Text + " - " + i.ToString();
|
|
|
|
if (obj3.m_evnt_id != 0)
|
|
|
|
headtitle += " (ALARM)";
|
|
|
|
|
|
|
|
if (closeTabThread)
|
|
|
|
{
|
|
|
|
e.Cancel = true;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
pp1 = mapControl.ActiveMap.AddPushpin(lastPos, headtitle);
|
|
|
|
|
|
|
|
if (closeTabThread)
|
|
|
|
{
|
|
|
|
e.Cancel = true;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
pp1.Symbol = busSymb.GetSymbolFromOrientation(Headingtmp);
|
|
|
|
pp1.Location = lastPos;
|
|
|
|
//note
|
|
|
|
if (MainForm2.isInMile) SpeedData = " ;" + MainForm2.langSpeed + " " + Convert.ToString((int)Math.Round(obj3.m_speed * 0.621371192)) + MainForm2.milesh;
|
|
|
|
else SpeedData = " ;" + MainForm2.langSpeed + " " + Convert.ToString(obj3.m_speed) + MainForm2.kmh;
|
2024-06-05 11:00:51 +00:00
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
if ((obj3.m_address != "") && (obj3.m_address != " "))
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
volTest = Convert.ToInt32(obj3.m_address);
|
|
|
|
AddressData = "";
|
|
|
|
}
|
|
|
|
catch
|
|
|
|
{
|
|
|
|
AddressData = "<br>" + obj3.m_address;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else AddressData = "";
|
2024-06-05 11:00:51 +00:00
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
pp1.Note = MainForm2.langTime + " " + obj3.m_time.DateTimeOfDayHHMMLocal() + SpeedData + AddressData;
|
|
|
|
pp1.BalloonState = GeoBalloonStatex.geoDisplayNone;
|
|
|
|
if (closeTabThread)
|
|
|
|
{
|
|
|
|
e.Cancel = true;
|
|
|
|
return 1;
|
|
|
|
}
|
2024-06-05 11:00:51 +00:00
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
// pp1.MoveTo(vehiclesDataSet2);
|
|
|
|
progStep++;
|
|
|
|
|
|
|
|
if (minTime > obj3.m_time)
|
|
|
|
minTime = obj3.m_time;
|
2024-06-05 11:00:51 +00:00
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
if (maxTime < obj3.m_time)
|
|
|
|
maxTime = obj3.m_time;
|
|
|
|
}
|
|
|
|
|
|
|
|
///HISTORY COPY PASTE
|
|
|
|
if (cont >= 0)
|
|
|
|
{
|
|
|
|
ArrayList latlnt = new ArrayList();
|
|
|
|
posTemp = new Locationx[cont + 1];
|
|
|
|
for (int k = 0; k <= cont; k++)
|
|
|
|
{
|
|
|
|
posTemp[k] = pos[k];
|
|
|
|
latlnt.Add(pos[k].Latitude);
|
|
|
|
latlnt.Add(pos[k].Longitude);
|
|
|
|
}
|
2024-06-05 11:00:51 +00:00
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
if (posTemp.Length > 1)
|
|
|
|
{
|
|
|
|
if (closeTabThread) return 1;
|
|
|
|
shp = mapControl.ActiveMap.Shapes.AddPolyline(posTemp);
|
|
|
|
shp.Line.Weight = 3;
|
|
|
|
shp.Line.color = ((Vehicle)MainForm2.vehicleHT[unit.Text]).histcolor;
|
|
|
|
shp.Line.ForeColor = ColorTranslator.ToOle(((Vehicle)MainForm2.vehicleHT[unit.Text]).histcolor);
|
|
|
|
shp.Fill.ForeColor = ColorTranslator.ToOle(((Vehicle)MainForm2.vehicleHT[unit.Text]).histcolor);
|
|
|
|
shp.Name = "History";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (closeTabThread) return 1;
|
|
|
|
shp = mapControl.ActiveMap.Shapes.AddLine(posTemp[0], posTemp[0]);
|
|
|
|
shp.Name = "History";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
retrynew = true;
|
|
|
|
inwhile = false;
|
|
|
|
int cntmax = 0;
|
|
|
|
Int32 limitstay = 0;
|
|
|
|
if (IdReportHS.Keys.Count > 0)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
txProgStatus.Invoke(new UpdateStatusBarCallBack(this.UpdateStatusBar), calcADDr);
|
|
|
|
txProgStatus.Invoke(new UpdateStatusBarCallBack(this.UpdateChangeSize), calcADDr);
|
|
|
|
//HistroyProgBar.Maximum = IdReportHS.Keys.Count;
|
|
|
|
HistroyProgBar.Invoke(new UpdateProgressBarCallBack(this.UpdateProgressBar), IdReportHS.Keys.Count + (Int32)Math.Round(IdReportHS.Keys.Count*0.25));
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
SM.Debug("Error on put on screen calc address:"+ex.ToString());
|
|
|
|
}
|
|
|
|
Int32 contNR = IdReportHS.Keys.Count;
|
|
|
|
if (cntmax >= contNR)
|
|
|
|
{
|
|
|
|
retrynew = false;
|
|
|
|
inwhile = false;
|
|
|
|
}
|
|
|
|
while (retrynew)
|
|
|
|
{
|
|
|
|
inwhile = true;
|
|
|
|
Thread.Sleep(1000);
|
|
|
|
SM.Debug("Wait 1 second to update");
|
|
|
|
HistroyProgBar.Invoke(new UpdateProgressBarCallBack(this.UpdateProgressBar), -1);
|
|
|
|
cntmax++;
|
|
|
|
if (cntmax > contNR) retrynew = false;
|
|
|
|
}
|
|
|
|
if (GisAddressWorker.IsBusy) GisAddressWorker.CancelAsync();
|
|
|
|
}
|
|
|
|
try
|
|
|
|
{
|
|
|
|
foreach (SMposition obj3 in selectedPositions)
|
|
|
|
{
|
|
|
|
if (IdReportHS[obj3.m_address] != null)
|
|
|
|
{
|
|
|
|
obj3.m_address = (String)IdReportHS[obj3.m_address];
|
|
|
|
if (obj3.m_address != "no address") smdbObj.Update_address_hist(obj3.m_imei, obj3.m_scevMSSQL, obj3.m_address);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
SM.Debug("Exception on add address data in DB:"+ex.ToString());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (there_are_routes)
|
|
|
|
{
|
|
|
|
ListforGrid.Clear();
|
|
|
|
int contx = -1;
|
|
|
|
foreach (SMposition obj in selectedPositions)
|
|
|
|
{
|
|
|
|
contx++;
|
2024-06-05 11:00:51 +00:00
|
|
|
// convert to km
|
|
|
|
volSpeedString = ConvertToKm(obj);
|
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
volAddress = obj.m_address;
|
2024-06-05 11:00:51 +00:00
|
|
|
if ((volAddress == "") || (volAddress == " "))
|
|
|
|
volAddress = "LAT:" + Math.Round(obj.m_lat, 5).ToString() + " , LNG:" + Math.Round(obj.m_lng, 5).ToString();
|
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
ListforGrid.Add(new DataforGRID(contx.ToString(), obj.m_vehName, (obj.m_time).ConvertGMTToLocal().GetDTFromSeconds(), volAddress, volSpeedString, "", "",
|
|
|
|
Math.Round(obj.m_lat, 5).ToString(), Math.Round(obj.m_lng, 5).ToString(), Math.Round(obj.m_alt, 5).ToString(),obj.m_heading));
|
2024-06-05 11:00:51 +00:00
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
obj.m_evnt_id = contx;
|
2024-06-05 11:00:51 +00:00
|
|
|
SliderPosition.Add(SliderCount);
|
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
if ((obj.m_lat != 0) && (obj.m_lng != 0))
|
|
|
|
{
|
|
|
|
Point_for_play.Add(obj);
|
|
|
|
SliderCount++;
|
|
|
|
MaxLAT = Math.Max(MaxLAT, obj.m_lat);
|
|
|
|
MinLAT = Math.Min(MinLAT, obj.m_lat);
|
|
|
|
MaxLNG = Math.Max(MaxLNG, obj.m_lng);
|
|
|
|
MinLNG = Math.Min(MinLNG, obj.m_lng);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
worker.ReportProgress(1,-1);
|
|
|
|
}
|
|
|
|
else worker.ReportProgress(0);
|
|
|
|
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
SM.Debug("Ex on thread:" + ex.ToString());
|
|
|
|
//this.Dispose();
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void WorkerHead_DoWork(object sender, DoWorkEventArgs e)
|
|
|
|
{
|
|
|
|
//Thread.Sleep(5000);
|
|
|
|
BackgroundWorker worker = sender as BackgroundWorker;
|
|
|
|
e.Result = ComputHead(worker, e, mapControl);
|
|
|
|
}
|
|
|
|
|
|
|
|
private volatile Boolean respQuest = false;
|
|
|
|
private volatile Boolean waitResponse = false;
|
|
|
|
|
|
|
|
private void WorkerHead_ProgressChanged(object sender, ProgressChangedEventArgs e)
|
|
|
|
{
|
|
|
|
if (e.ProgressPercentage > -1)//if (e.ProgressPercentage != -1)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
//HISTORY
|
|
|
|
foreach (String obj in mapControl.ListShapeCMD)
|
|
|
|
{
|
|
|
|
if (docLoad)
|
|
|
|
{
|
2024-06-05 11:00:51 +00:00
|
|
|
ExecuteScript(obj);
|
|
|
|
ExecuteScript($"removelabels,{((String [])obj.Split(",".ToCharArray()))[4]}");
|
2024-02-22 16:43:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
//end history
|
|
|
|
Console.WriteLine("MAXlat:"+MaxLAT+" Minlat:"+MinLAT+" MAXlng:"+MaxLNG+" Minlng:"+MinLNG);
|
|
|
|
String corner = "setDataset,corner_positions,"
|
|
|
|
+ MainForm2.FixDoubleLAT(MaxLAT.ToString()) + ","
|
|
|
|
+ MainForm2.FixDoubleLNG(MaxLNG.ToString()) + ","
|
|
|
|
+ DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ",,,,,,false,false,false,"
|
|
|
|
+ MainForm2.FixDoubleLAT(MinLAT.ToString()) + ","
|
|
|
|
+ MainForm2.FixDoubleLNG(MaxLNG.ToString()) + ","
|
|
|
|
+ DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ",,,,,,false,false,false,"
|
|
|
|
+ MainForm2.FixDoubleLAT(MinLAT.ToString()) + ","
|
|
|
|
+ MainForm2.FixDoubleLNG(MinLNG.ToString()) + ","
|
|
|
|
+ DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ",,,,,,false,false,false,"
|
|
|
|
+ MainForm2.FixDoubleLAT(MaxLAT.ToString()) + ","
|
|
|
|
+ MainForm2.FixDoubleLNG(MinLNG.ToString()) + ","
|
|
|
|
+ DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ",,,,,,false,false,false";
|
|
|
|
|
|
|
|
|
2024-06-05 11:00:51 +00:00
|
|
|
ExecuteScript(corner);
|
|
|
|
ExecuteScript("putOnMap,once,corner_positions");
|
|
|
|
ExecuteScript("removelabels,corner_positions");
|
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
/* SM.Debug("Face ZOOM pe un dataset");
|
|
|
|
if (vehiclesDataSet2.RecordCount > 0)
|
|
|
|
vehiclesDataSet2.ZoomTo();*/
|
|
|
|
|
|
|
|
Boolean there_are_routes = (e.ProgressPercentage == 1) ? true : false;
|
|
|
|
string s1 = MainForm2.returnLNGString("showTraceCB");
|
|
|
|
|
|
|
|
populateTableVehiclesList();
|
|
|
|
if (there_are_routes)
|
|
|
|
{
|
|
|
|
AniStateExpande = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
SM.Debug("Erorr Worker Heading ProgressChanged: " + ex.ToString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else //-1 when asking for stop reports
|
|
|
|
{
|
|
|
|
if (e.ProgressPercentage == -1)
|
|
|
|
{
|
|
|
|
if ((MainForm2.radioType == RADIOTYPE.HARRIS) || (MainForm2.radioType == RADIOTYPE.ATLAS)) ((RadLabel)RadMessageBox.Instance.Controls[1]).LabelElement.ForeColor = MainForm2.HarTextColor;
|
|
|
|
//DialogResult dr2 = RadMessageBox.Show(string.Format(youhave, actualNOfPositions.ToString()) + "\n" + googleWork + "\n" + contorsmall, "Info", MessageBoxButtons.YesNo, RadMessageIcon.Info);
|
|
|
|
//DialogResult dr2 = RadMessageBox.Show(string.Format(youhave, actualNOfPositions.ToString()) + "\n" + outsideBrowser +"\n"+ setdefault + "\n" + contorsmall, "Info", MessageBoxButtons.YesNo, RadMessageIcon.Info);
|
|
|
|
//DialogResult dr2 = RadMessageBox.Show(string.Format(youhave, actualNOfPositions.ToString()) + "\n" + outsideBrowser + "\n<html><size=6><b>" + setdefault + "</b>\n" + contorsmall, "Info", MessageBoxButtons.YesNo, RadMessageIcon.Info);
|
|
|
|
DialogResult dr2 = RadMessageBox.Show("<html>" + string.Format(youhave, actualNOfPositions.ToString()) + "\n" +selectinterval, "Info", MessageBoxButtons.OK, RadMessageIcon.Info);
|
|
|
|
//if (dr2 == DialogResult.Yes) respQuest = true;
|
|
|
|
//else respQuest = false;
|
|
|
|
respQuest = false;
|
|
|
|
waitResponse = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void WorkerHead_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (!closeTabThread)
|
|
|
|
{
|
|
|
|
Cursor = Cursors.Arrow;
|
|
|
|
mapControl.MousePointer = GeoPointerx.geoPointerDefault;
|
|
|
|
HistroyProgBar.Visible = false;
|
|
|
|
HistoryPanel.Visible = false;
|
|
|
|
HistoryPanel.Update();
|
|
|
|
txProgStatus.Visible = false;
|
|
|
|
txProgStatus.Update();
|
|
|
|
rbSearchHistory.Enabled = true;
|
|
|
|
rcbComputeAddress.Enabled = true;
|
|
|
|
FirstGoogle = true;
|
|
|
|
timeTrackBar.Maximum = Point_for_play.Count-1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
SM.Debug("Erorr Worker Heading Complete: " + ex.ToString());
|
|
|
|
}
|
|
|
|
if (MainForm2.Connfailed)
|
|
|
|
{
|
2024-06-05 11:00:51 +00:00
|
|
|
if ((MainForm2.radioType == RADIOTYPE.HARRIS)||(MainForm2.radioType == RADIOTYPE.ATLAS))
|
|
|
|
((RadLabel)RadMessageBox.Instance.Controls[1]).LabelElement.ForeColor = MainForm2.HarTextColor;
|
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
RadMessageBox.Show(MainForm2.returnLNGString("database"), MainForm2.returnLNGString("war"), MessageBoxButtons.OK, RadMessageIcon.Exclamation);
|
|
|
|
MainForm2.Connfailed = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void HistoryTab_Load(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
backgroundWorker1.RunWorkerAsync();
|
|
|
|
VisualSettings.loadUserVisualSettings(this.Name, this.toolWindow4, MainForm2.HashVal);
|
2024-06-05 11:00:51 +00:00
|
|
|
|
|
|
|
// convert in km
|
2024-02-22 16:43:59 +00:00
|
|
|
if (MainForm2.isInMile)
|
|
|
|
{
|
|
|
|
rseSpeedLower.Value = (int)Math.Round(Convert.ToInt32(rseSpeedLower.Value) * 0.621371192);
|
|
|
|
rseSpeedUpper.Value = (int)Math.Round(Convert.ToInt32(rseSpeedUpper.Value) * 0.621371192);
|
|
|
|
}
|
|
|
|
|
|
|
|
isLoaded = true;
|
|
|
|
rseSpeedLower.Value = MainForm2.HistSpeedLimit;
|
|
|
|
rcbComputeAddress.Checked = MainForm2.ComputeAddress;
|
|
|
|
rsePositionDisplay.Value = MainForm2.PlayTime > rsePositionDisplay.Minimum && MainForm2.PlayTime < rsePositionDisplay.Maximum ? MainForm2.PlayTime : rsePositionDisplay.Maximum;
|
|
|
|
rseSkipSeconds.Value = MainForm2.PauseTime > rseSkipSeconds.Minimum && MainForm2.PauseTime < rseSkipSeconds.Maximum ? MainForm2.PauseTime : rseSkipSeconds.Maximum;
|
|
|
|
//VisualSettings.loadUserVisualSettings(this.Name, this.windowHistoryResult, MainForm2.HashVal);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void Killtimer_Tick(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
if (MainForm2.ClosingApp)
|
|
|
|
KillTimerActive = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
private double latitude = 0;
|
|
|
|
private double longitude = 0;
|
|
|
|
|
|
|
|
private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
|
|
|
|
{
|
|
|
|
if (docLoad)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (e.ProgressPercentage == 3)
|
2024-06-05 11:00:51 +00:00
|
|
|
ExecuteScript("removeDataset,heading_positions");
|
2024-02-22 16:43:59 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
Int32 index = (Int32)e.UserState;
|
|
|
|
Console.WriteLine(" Indexul :" + index);
|
|
|
|
if (index >= 0)
|
|
|
|
{
|
|
|
|
// idx
|
|
|
|
gridHistoryPoints.Rows[index].IsSelected = true;
|
|
|
|
gridHistoryPoints.Rows[index].IsCurrent = true;
|
|
|
|
ChangeTrackBarValue((Int32)SliderPosition[index]);
|
|
|
|
}
|
|
|
|
if (e.ProgressPercentage == 1)
|
|
|
|
{
|
2024-06-05 11:00:51 +00:00
|
|
|
|
|
|
|
ExecuteScript(updatecomand);
|
2024-02-22 16:43:59 +00:00
|
|
|
if (updatecomand.StartsWith("setDataset,heading_positions"))
|
|
|
|
{
|
|
|
|
if (rcbShowLabels.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On)
|
2024-06-05 11:00:51 +00:00
|
|
|
ExecuteScript("putlabels,heading_positions");
|
|
|
|
else
|
|
|
|
mapControl.mapGoogles.ExecuteScript("window.GWTcallback('" + "removelabels,heading_positions" + "');");
|
2024-02-22 16:43:59 +00:00
|
|
|
}
|
2024-06-05 11:00:51 +00:00
|
|
|
ExecuteScript("putOnMap,none,heading_positions");
|
2024-02-22 16:43:59 +00:00
|
|
|
}
|
2024-06-05 11:00:51 +00:00
|
|
|
|
|
|
|
ExecuteScript($"openInfo,{vehSelect}");
|
|
|
|
ExecuteScript($"centerzoom,{latitude},{longitude},-1");
|
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
SM.Debug("Error send data for play: "+ex.ToString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-06-05 11:00:51 +00:00
|
|
|
private void ExecuteScript(string command)
|
|
|
|
{
|
|
|
|
mapGoogles?.ExecuteScript($"window.GWTcallback('{command}');");
|
|
|
|
}
|
2024-02-22 16:43:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void StartBasicHistory_Tick(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
if (docLoad)
|
|
|
|
{
|
|
|
|
StartBasicHistory.Stop();
|
|
|
|
StartBasicHistory.Enabled = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void btStopCalc_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
retrynew = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void toolWindow2_Resize(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
int diffHeight, diffWidth;
|
|
|
|
Control control = (Control)sender;
|
|
|
|
diffHeight = control.Size.Height / 2;
|
|
|
|
diffWidth = control.Size.Width / 2;
|
|
|
|
diffHeight = diffHeight - 50;
|
|
|
|
diffWidth = diffWidth - 170;
|
|
|
|
if ((diffHeight > 0) && (diffWidth > 0))
|
|
|
|
HistoryPanel.Location = new System.Drawing.Point(diffWidth, diffHeight);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private Color getcolorFromID(Int32 id)
|
|
|
|
{
|
|
|
|
Color tmp = Color.Black;
|
|
|
|
switch (id)
|
|
|
|
{
|
|
|
|
case 0: tmp = Color.Cyan; break;
|
|
|
|
case 1: tmp = Color.Magenta; break;
|
|
|
|
case 2: tmp = Color.Red; break;
|
|
|
|
case 3: tmp = Color.Green; break;
|
|
|
|
case 4: tmp = Color.Blue; break;
|
|
|
|
}
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Set the type of data which will be displayed inside the points grid
|
|
|
|
/// </summary>
|
|
|
|
private void gridHistoryPoints_CreateCell(object sender, GridViewCreateCellEventArgs e)
|
|
|
|
{
|
|
|
|
// format Ticket Log table
|
|
|
|
if (e.Row is GridDataRowElement)
|
|
|
|
{
|
|
|
|
// increase row height
|
|
|
|
//e.Row.RowInfo.Height = 53;
|
|
|
|
|
|
|
|
if (e.Column.Name.Equals("history"))
|
|
|
|
{
|
|
|
|
e.CellType = typeof(HistoryGridColumn);
|
|
|
|
e.CellElement = new HistoryGridCellElement(e.Column, e.Row);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Format the cells of history points to the custom format, including padding
|
|
|
|
/// </summary>
|
|
|
|
private void gridHistoryPoints_CellFormatting(object sender, CellFormattingEventArgs e)
|
|
|
|
{
|
|
|
|
GridCellElement cellElement = e.CellElement;
|
|
|
|
GridViewDataColumn columnInfo = e.CellElement.ColumnInfo as GridViewDataColumn;
|
|
|
|
|
|
|
|
// set padding and force the content adding
|
|
|
|
if (cellElement is HistoryGridCellElement && columnInfo.Name == "history")
|
|
|
|
{
|
|
|
|
cellElement.Padding = new Padding(0, 0, 0, 0);
|
|
|
|
cellElement.SetContent();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Display the point on the map when doubled click a point from the grid
|
|
|
|
/// </summary>
|
|
|
|
private void gridHistoryPoints_CellDoubleClick(object sender, GridViewCellEventArgs e)
|
|
|
|
{
|
|
|
|
if (e.Row.DataBoundItem != null && e.Row.DataBoundItem is DataforGRID)
|
|
|
|
{
|
|
|
|
DataforGRID gridData = e.Row.DataBoundItem as DataforGRID;
|
|
|
|
// display the bubble for a history point
|
|
|
|
DisplayHistoryBuble(gridData);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Display the bubble when a point is selected in the points list
|
|
|
|
/// </summary>
|
|
|
|
private void gridHistoryPoints_SelectionChanged(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
if(gridHistoryPoints.SelectedRows.Count > 0)
|
|
|
|
{
|
|
|
|
DataforGRID gridData = gridHistoryPoints.SelectedRows[0].DataBoundItem as DataforGRID;
|
|
|
|
// display the bubble for a history point
|
|
|
|
|
|
|
|
// DisplayHistoryBuble(gridData);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Display a bubble on the map for a specific history point
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="gridData">Object containing all the informations for a point</param>
|
|
|
|
private void DisplayHistoryBuble(DataforGRID gridData)
|
|
|
|
{
|
|
|
|
// if (!MainForm2.HistContinu && (gridData.Lat.CompareTo("0") != 0) && (gridData.Lng.CompareTo("0") != 0))
|
|
|
|
Boolean PutonMap = false;
|
|
|
|
if ((gridData.Lat.CompareTo("0") != 0) && (gridData.Lng.CompareTo("0") != 0))
|
|
|
|
{
|
|
|
|
if (FirstGoogle)
|
|
|
|
{
|
2024-06-05 11:00:51 +00:00
|
|
|
|
|
|
|
ExecuteScript("removeDataset,heading_positions");
|
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
|
|
|
|
updatecomand = "setDataset,heading_positions,";
|
|
|
|
FirstGoogle = false;
|
|
|
|
PutonMap = true;
|
|
|
|
}
|
|
|
|
else updatecomand = "updateDataset,heading_positions,";
|
|
|
|
updatecomand+= MainForm2.FixDoubleLAT(gridData.Lat) + ","
|
|
|
|
+ MainForm2.FixDoubleLNG(gridData.Lng) + ","
|
|
|
|
+ gridData.Datatime.ToString("yyyy-MM-dd HH:mm:ss") + ","
|
|
|
|
+ gridData.VehName +"_"+gridData.Id+","
|
|
|
|
+ gridData.Speed + (MainForm2.isInMile ? "mph" : "kph") + ","
|
|
|
|
+ gridData.Alt + ","
|
|
|
|
+ MainForm2.FixComma(gridData.Address) + ","
|
|
|
|
+ "history/" + GetSymbName(busSymb.GetSymbolFromOrientation(gridData.Heading_int)) + ","
|
|
|
|
+ "false" + "," + "false" + "," + "false";
|
|
|
|
Utils.WriteLine(updatecomand,ConsoleColor.Blue);
|
|
|
|
if (docLoad)
|
|
|
|
{
|
2024-06-05 11:00:51 +00:00
|
|
|
|
|
|
|
ExecuteScript(updatecomand);
|
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
if (PutonMap)
|
2024-06-05 11:00:51 +00:00
|
|
|
ExecuteScript("putOnMap,none,heading_positions");
|
|
|
|
|
|
|
|
ExecuteScript($"openInfo,{gridData.VehName}_{gridData.Id}");
|
|
|
|
ExecuteScript($"centerzoom,{gridData.Lat},{gridData.Lng},-1");
|
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void checkBox2_ToggleStateChanged(object sender, StateChangedEventArgs args)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (docLoad)
|
|
|
|
{
|
2024-06-05 11:00:51 +00:00
|
|
|
ExecuteScript($"openInfo,{pp.Name}");
|
2024-02-22 16:43:59 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
SM.Debug("Error change Balone state on play interval" + ex.Message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private volatile Queue AddrGISQueue = new Queue();
|
|
|
|
private volatile Boolean findaddress;
|
|
|
|
private volatile AddrAndID tmpAddrAndID;
|
|
|
|
private Double valHash;
|
|
|
|
private volatile String AddrtmpX;
|
|
|
|
private volatile ReverseGeocoding volltmpGo2 = new ReverseGeocoding(MainForm2.cfg.ReverseGeoOSM);
|
|
|
|
|
|
|
|
private void GisAddressWorker_DoWork(object sender, DoWorkEventArgs e)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
BackgroundWorker worker = sender as BackgroundWorker;
|
|
|
|
|
|
|
|
while (AddrGISQueue.Count > 0)
|
|
|
|
{
|
|
|
|
if ((worker.CancellationPending == true))
|
|
|
|
{
|
|
|
|
e.Cancel = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
tmpAddrAndID = (AddrAndID)AddrGISQueue.Dequeue();
|
|
|
|
findaddress = false;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
tmpAddrAndID.LNG = Math.Round(tmpAddrAndID.LNG, 4);
|
|
|
|
tmpAddrAndID.LAT = Math.Round(tmpAddrAndID.LAT, 4);
|
2024-06-05 11:00:51 +00:00
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
valHash = tmpAddrAndID.LNG + tmpAddrAndID.LAT * 0.000001;
|
|
|
|
if (MainForm2.AddrHass[valHash] != null)
|
|
|
|
{
|
|
|
|
tmpAddrAndID.Address = (String)MainForm2.AddrHass[valHash];
|
|
|
|
findaddress = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
AddrtmpX = smdbObj.get_address(tmpAddrAndID.LAT, tmpAddrAndID.LNG);
|
|
|
|
if (AddrtmpX != "")
|
|
|
|
{
|
|
|
|
MainForm2.AddrHass.Add(valHash, AddrtmpX);
|
|
|
|
tmpAddrAndID.Address = AddrtmpX;
|
|
|
|
findaddress = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception ex)
|
|
|
|
{
|
|
|
|
Utils.WriteLine(ex.ToString(), ConsoleColor.Red);
|
|
|
|
}
|
2024-06-05 11:00:51 +00:00
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
if (!findaddress)
|
|
|
|
{
|
|
|
|
tmpAddrAndID.Address = volltmpGo2.getAddressLATLNG(tmpAddrAndID.LAT, tmpAddrAndID.LNG);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((tmpAddrAndID.Address != "") && (tmpAddrAndID.Address != " "))
|
|
|
|
{
|
|
|
|
if (!findaddress)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (tmpAddrAndID.Address != "N/A")
|
|
|
|
{
|
|
|
|
valHash = tmpAddrAndID.LNG + tmpAddrAndID.LAT * 0.000001;
|
|
|
|
MainForm2.AddrHass.Add(valHash, tmpAddrAndID.Address);
|
|
|
|
AddrtmpX = smdbObj.get_address(tmpAddrAndID.LAT, tmpAddrAndID.LNG); //just for avoid Error from Event Viewer
|
|
|
|
if (AddrtmpX == "") smdbObj.Insert_Address(tmpAddrAndID.Address, tmpAddrAndID.LAT, tmpAddrAndID.LNG);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
SM.Debug("Error: " + ex.ToString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
IdReportHS[tmpAddrAndID.ID.ToString()] = tmpAddrAndID.Address;
|
|
|
|
if (inwhile)
|
|
|
|
HistroyProgBar.Invoke(new UpdateProgressBarCallBack(this.UpdateProgressBar), -1);
|
2024-06-05 11:00:51 +00:00
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
SM.Debug("Baga google in hash ID:" + tmpAddrAndID.ID.ToString() + "Addr:" + tmpAddrAndID.Address);
|
|
|
|
}
|
2024-06-05 11:00:51 +00:00
|
|
|
//else
|
|
|
|
//{
|
|
|
|
// //dau in open street maps si apoi ies prin prin cene
|
|
|
|
// Thread.Sleep(1100);
|
|
|
|
// tmpAddrAndID.Address = volltmpGo2.getAddressLATLNG2(tmpAddrAndID.LAT, tmpAddrAndID.LNG);
|
|
|
|
// if ((tmpAddrAndID.Address != "") && (tmpAddrAndID.Address != " "))
|
|
|
|
// {
|
|
|
|
// if (!findaddress)
|
|
|
|
// {
|
|
|
|
// try
|
|
|
|
// {
|
|
|
|
// if (tmpAddrAndID.Address != "N/A")
|
|
|
|
// {
|
|
|
|
// valHash = tmpAddrAndID.LNG + tmpAddrAndID.LAT * 0.000001;
|
|
|
|
// MainForm2.AddrHass.Add(valHash, tmpAddrAndID.Address);
|
|
|
|
// AddrtmpX = smdbObj.get_address(tmpAddrAndID.LAT, tmpAddrAndID.LNG); //just for avoid Error from Event Viewer
|
|
|
|
// if (AddrtmpX == "") smdbObj.Insert_Address(tmpAddrAndID.Address, tmpAddrAndID.LAT, tmpAddrAndID.LNG);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// catch (Exception ex)
|
|
|
|
// {
|
|
|
|
// SM.Debug("Error: " + ex.ToString());
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
// IdReportHS[tmpAddrAndID.ID.ToString()] = tmpAddrAndID.Address;
|
|
|
|
// if (inwhile) HistroyProgBar.Invoke(new UpdateProgressBarCallBack(this.UpdateProgressBar), -1);
|
|
|
|
// SM.Debug("Baga open street maps in hash ID:"+tmpAddrAndID.ID.ToString() + "Addr:" + tmpAddrAndID.Address);
|
|
|
|
// }
|
|
|
|
// else
|
|
|
|
// {
|
|
|
|
// SM.Debug("Iese prin Cene cu nimic");
|
|
|
|
// }
|
|
|
|
//}
|
2024-02-22 16:43:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
SM.Debug("Error retrive address:" + ex.ToString());
|
|
|
|
}
|
|
|
|
Thread.Sleep(10);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void GisAddressWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
|
|
|
|
{
|
|
|
|
retrynew = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void TimerToLoadMap_Tick(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
String safemobileDirPath = System.Windows.Forms.Application.StartupPath.Replace('\\', '/').Replace(" ", "%20");
|
|
|
|
safemobileDirPath = safemobileDirPath.Replace("#", "%23");
|
|
|
|
|
|
|
|
mapGoogles.LoadWebPage("file:///" + safemobileDirPath + "/resource/" + MainForm2.MapHtmlName);
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
SM.Debug("Ex:" + ex.ToString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void mapGoogles_KeyDown(object sender, KeyEventArgs e)
|
|
|
|
{
|
|
|
|
if ((e.KeyValue > 36) && (e.KeyValue < 41)) e.Handled = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void mapGoogles_KeyPress(object sender, KeyPressEventArgs e)
|
|
|
|
{
|
|
|
|
if ((e.KeyChar > 36) && (e.KeyChar < 41)) e.Handled = true;
|
|
|
|
}
|
|
|
|
private WaitToLoad WaitWindow = null;
|
|
|
|
private void MessageScreen_Tick(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
MessageScreen.Stop();
|
|
|
|
MessageScreen.Enabled = false;
|
|
|
|
WaitWindow = new WaitToLoad(false);
|
|
|
|
WaitWindow.ShowDialog();
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
SM.Debug("Ex10:" + ex.ToString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Int32 nrtrys = 0;
|
|
|
|
private void ForceRefreshTimer_Tick(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
nrtrys++;
|
|
|
|
if (nrtrys > 3)
|
|
|
|
{
|
|
|
|
ForceRefreshTimer.Stop();
|
|
|
|
ForceRefreshTimer.Enabled = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void ckShowZone_ToggleStateChanged(object sender, StateChangedEventArgs args)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
//mapGoogles.ExecuteScript("window.GWTcallback('" + "showconsole,true" + "');");
|
|
|
|
if (rcbShowGeofence.Checked)
|
|
|
|
ForceShowZone();
|
|
|
|
else ForceHideZone();
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
SM.Debug("ExLive13:" + ex.ToString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public Int32 nrNavigatecnt = 0;
|
|
|
|
public void ForceShowZone()
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (docLoad)
|
|
|
|
{
|
2024-06-05 11:00:51 +00:00
|
|
|
|
|
|
|
ExecuteScript("deletePolygon,ALL");
|
2024-02-22 16:43:59 +00:00
|
|
|
nrNavigatecnt++;
|
|
|
|
}
|
|
|
|
|
|
|
|
List<GeofenceUI> allGeofences = smdbObj.GetAllGeofences();
|
|
|
|
|
|
|
|
foreach(GeofenceUI geofence in allGeofences)
|
|
|
|
{
|
|
|
|
String datasetCMD = "";
|
|
|
|
foreach (GeofencePoint point in geofence.points)
|
|
|
|
{
|
|
|
|
datasetCMD = datasetCMD
|
|
|
|
+ MainForm2.FixDoubleLAT(point.Latitude + "") + ","
|
|
|
|
+ MainForm2.FixDoubleLNG(point.Longitude + "") + ",";
|
|
|
|
}
|
|
|
|
|
|
|
|
// get geofence fill color
|
|
|
|
String hexFillColor = "#" + geofence.FillColor.R.ToString("X2") + geofence.FillColor.G.ToString("X2") + geofence.FillColor.B.ToString("X2");
|
|
|
|
String hexBorderColor = "#" + geofence.BorderColor.R.ToString("X2") + geofence.BorderColor.G.ToString("X2") + geofence.BorderColor.B.ToString("X2");
|
|
|
|
try
|
|
|
|
{
|
|
|
|
datasetCMD = datasetCMD.Remove(datasetCMD.Length - 1);
|
|
|
|
}
|
|
|
|
catch (Exception ex) { SM.Debug("Ex:" + ex.ToString()); }
|
|
|
|
|
|
|
|
if (docLoad)
|
|
|
|
{
|
|
|
|
mapGoogles.ExecuteScript("window.GWTcallback('" + "setPolygon,"
|
|
|
|
+ geofence.Name + ","
|
|
|
|
+ hexFillColor + ","
|
|
|
|
+ MainForm2.FixDoubleLAT(geofence.FillOpacity.ToString()) + ","
|
|
|
|
+ hexBorderColor + ","
|
|
|
|
+ MainForm2.FixDoubleLAT(geofence.BorderOpacity.ToString()) + ","
|
|
|
|
+ MainForm2.FixDoubleLAT(geofence.BorderWidth.ToString()) + ","
|
|
|
|
+ datasetCMD + "');");
|
|
|
|
}
|
|
|
|
System.Threading.Thread.Sleep(10);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
SM.Debug("Error zone preview:" + ex.ToString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private Int32 ZoneGoogle = 0;
|
|
|
|
public void ForceHideZone()
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (docLoad)
|
|
|
|
{
|
2024-06-05 11:00:51 +00:00
|
|
|
|
|
|
|
ExecuteScript("deletePolygon,ALL");
|
2024-02-22 16:43:59 +00:00
|
|
|
nrNavigatecnt++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
SM.Debug("Unable to remove zones from map " + ex.ToString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public delegate void ProcessResponseFromMapInvokeCallBack(String url);
|
|
|
|
|
|
|
|
/*private void mapGoogles_Navigating(object sender, WebBrowserNavigatingEventArgs e)
|
|
|
|
{
|
|
|
|
string url = e.Url.ToString();*/
|
|
|
|
private void ProcessResponseFromMap(String url)
|
|
|
|
{
|
|
|
|
if (url.IndexOf("app://") > -1)
|
|
|
|
{
|
|
|
|
Utils.WriteLine(url);
|
|
|
|
//URL-ul: app://map-loaded/
|
|
|
|
if (url.IndexOf("map-loaded") > -1)
|
|
|
|
{
|
|
|
|
if (WaitWindow != null)
|
|
|
|
WaitWindow.Close();
|
|
|
|
this.Invoke((MethodInvoker)delegate()
|
|
|
|
{
|
|
|
|
VisualSettings.loadUserVisualSettings(this.Name, this.windowHistoryResult, MainForm2.HashVal);
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
else if (url.IndexOf("street-view-open") > -1)
|
|
|
|
{
|
|
|
|
String tmpstr = url.Remove(0, url.IndexOf("street-view-open") + 17);
|
|
|
|
Utils.WriteLine("parsare:" + tmpstr);
|
|
|
|
tmpstr = tmpstr.Trim();
|
|
|
|
if (tmpstr.ToUpper().CompareTo("TRUE") == 0) StreetViewOpened = true;
|
|
|
|
else StreetViewOpened = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//rsePositionDisplay.Value = MainForm2.PlayTime;
|
|
|
|
//rseSkipSeconds.Value = MainForm2.PauseTime;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void rbInterSel_ToggleStateChanged(object sender, StateChangedEventArgs args)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private void radLabel3_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private void compAddress_ToggleStateChanged(object sender, StateChangedEventArgs args)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private void radSplitContainer2_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private void radCheckBox1_ToggleStateChanged(object sender, StateChangedEventArgs args)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private void StartGoogleMap_Tick(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
StartGoogleMap.Stop();
|
|
|
|
StartGoogleMap.Enabled = false;
|
|
|
|
|
|
|
|
String safemobileDirPath = System.Windows.Forms.Application.StartupPath.Replace('\\', '/').Replace(" ", "%20");
|
|
|
|
safemobileDirPath = safemobileDirPath.Replace("#", "%23");
|
|
|
|
|
|
|
|
mapGoogles.LoadWebPage("file:///" + safemobileDirPath + "/resource/" + MainForm2.MapHtmlName);
|
|
|
|
docLoad = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Enable/disable the speed spinners when the combobox are selected
|
|
|
|
/// </summary>
|
|
|
|
private void speedLimit_CheckStateChanged(object sender, EventArgs e)
|
|
|
|
{
|
2024-06-05 11:00:51 +00:00
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
if ((RadCheckBox)sender == rcbSpeedLower)
|
|
|
|
rseSpeedLower.Enabled = ((RadCheckBox)sender).Checked;
|
|
|
|
else if ((RadCheckBox)sender == rcbSpeedUpper)
|
|
|
|
rseSpeedUpper.Enabled = ((RadCheckBox)sender).Checked;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region 24H
|
|
|
|
/// <summary>
|
|
|
|
/// Enable/Disable the date pickers for history stand and
|
|
|
|
/// end date. The icon for the 24H will be changed depanding
|
|
|
|
/// on it's state
|
|
|
|
/// </summary>
|
|
|
|
private void pb24H_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
if(pb24H.Tag.Equals("selected"))
|
|
|
|
{
|
|
|
|
pb24H.Tag = "unselected";
|
|
|
|
rdpEndTime.Enabled = true;
|
|
|
|
rdpStartTime.Enabled = true;
|
|
|
|
pb24H.Image = global::Dispatcher.Properties.Resources.h_24h_w;
|
|
|
|
}
|
|
|
|
else if (pb24H.Tag.Equals("unselected"))
|
|
|
|
{
|
|
|
|
pb24H.Tag = "selected";
|
|
|
|
rdpEndTime.Enabled = false;
|
|
|
|
rdpStartTime.Enabled = false;
|
|
|
|
pb24H.Image = theme24H_Image;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Display the tooltip when the mouse enters the 24H picture box
|
|
|
|
/// </summary>
|
|
|
|
private void pb24H_MouseEnter(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
toolTipHelp.ToolTipTitle = MainForm2.returnLNGString("dispLast24") + (pb24H.Tag.Equals("selected") ? MainForm2.returnLNGString("active") : MainForm2.returnLNGString("inactive"));
|
|
|
|
toolTipHelp.Show(
|
|
|
|
String.Format(MainForm2.returnLNGString("dispLast24det"))
|
|
|
|
, pb24H, 150000);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Hide the tooltip when the mouse leaves the 24H picture box
|
|
|
|
/// </summary>
|
|
|
|
private void pb24H_MouseLeave(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
toolTipHelp.Hide(pb24H);
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region UNITS FILTER
|
|
|
|
/// <summary>
|
|
|
|
/// Display the tooltip when the mouse enters the Filter picture box
|
|
|
|
/// </summary>
|
|
|
|
private void pbFilter_MouseEnter(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
toolTipHelp.ToolTipTitle = "Filter units: " + (pbFilter.Tag.Equals("selected") ? "Active" : "Inactive");
|
|
|
|
toolTipHelp.Show(
|
|
|
|
String.Format("Filter the units list when the text box value changes")
|
|
|
|
, pbFilter, 150000);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Hide the tooltip when the mouse leaves the Filter picture box
|
|
|
|
/// </summary>
|
|
|
|
private void pbFilter_MouseLeave(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
toolTipHelp.Hide(pbFilter);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Hide or show the filter for the units tree view
|
|
|
|
/// </summary>
|
|
|
|
private void pbFilter_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
// activate the filter and show the text box
|
|
|
|
if (pbFilter.Tag.Equals("unselected"))
|
|
|
|
{
|
|
|
|
pbFilter.Image = themelFilter_Image;
|
|
|
|
pbFilter.Tag = "selected";
|
|
|
|
rtbFilterUnits.Visible = true;
|
|
|
|
}
|
|
|
|
else if (pbFilter.Tag.Equals("selected"))
|
|
|
|
{
|
|
|
|
pbFilter.Image = global::Dispatcher.Properties.Resources.h_filter_w;
|
|
|
|
pbFilter.Tag = "unselected";
|
|
|
|
rtbFilterUnits.Visible = false;
|
|
|
|
rtbFilterUnits.Text = "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Filter the tree view in order for the units to be find faster
|
|
|
|
/// </summary>
|
|
|
|
private void rtbFilterUnits_TextChanged(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
treeViewUnits.Filter = null;
|
|
|
|
treeViewUnits.Filter = rtbFilterUnits.Text;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="node"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
private bool FilterNode(RadTreeNode node)
|
|
|
|
{
|
|
|
|
// add Group and 'All units' Nodes
|
|
|
|
if (node.Level < 2)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
// add unit if no filtering is required
|
|
|
|
if (!rtbFilterUnits.Visible || (rtbFilterUnits.Visible && rtbFilterUnits.Text.Length == 0))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
// add unit if the name contains the desired text
|
|
|
|
if (node.Text.ToUpper().Contains(rtbFilterUnits.Text.Trim().ToUpper()))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Set the type of the item inside the tree view to be
|
|
|
|
/// a Custom Tree Node which will hav the Color in the right
|
|
|
|
/// and as a property of the object
|
|
|
|
/// </summary>
|
|
|
|
private void treeViewUnits_CreateNodeElement(object sender, CreateTreeNodeElementEventArgs e)
|
|
|
|
{
|
|
|
|
e.NodeElement = new CustomTreeNodeElement();
|
|
|
|
if (e.NodeElement.ContentElement is ColorTreeContentElement)
|
|
|
|
{
|
|
|
|
ColorTreeContentElement treeElement = e.NodeElement.ContentElement as ColorTreeContentElement;
|
|
|
|
treeElement.OnColorChanged += delegate(object s2, ColorTreeContentElement.ColorChangedEventArgs e2)
|
|
|
|
{
|
|
|
|
if (e2.unitName != null && e2.unitName.Length > 0)
|
|
|
|
{
|
|
|
|
((Vehicle)MainForm2.vehicleHT[e2.unitName]).histcolor = e2.newColor;
|
|
|
|
|
|
|
|
String imageColor = "#" + e2.newColor.R.ToString("X2") + e2.newColor.G.ToString("X2") + e2.newColor.B.ToString("X2");
|
|
|
|
VisualSettings.InsertUpdateHTforVisualItems("histColor", ((Vehicle)MainForm2.vehicleHT[e2.unitName]).sc_id+"", imageColor);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Format the ticks color
|
|
|
|
/// </summary>
|
|
|
|
private void timeTrackBar_TickFormatting(object sender, TickFormattingEventArgs e)
|
|
|
|
{
|
|
|
|
e.TickElement.Line1.BackColor = Color.Red;
|
|
|
|
e.TickElement.Line2.BackColor = Color.Orange;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Change the text which is displayed in the timeTrackBar
|
|
|
|
/// It will display the start and the end date on the
|
|
|
|
/// sides of the track bar
|
|
|
|
/// </summary>
|
|
|
|
private void timeTrackBar_LabelFormatting(object sender, LabelFormattingEventArgs e)
|
|
|
|
{
|
|
|
|
if (e.LabelElement.IsTopLeft && e.LabelElement.TrackBarElement != null)
|
|
|
|
{
|
|
|
|
//Utils.WriteLine("val : " + e.LabelElement.Text, ConsoleColor.Red);
|
|
|
|
e.LabelElement.Text = (Int32.Parse(e.LabelElement.Text) + 1) + "";
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
DateTime start = DateTime.Now.AddDays(-1);
|
|
|
|
DateTime end = DateTime.Now;
|
|
|
|
|
|
|
|
// if not last 24 hours is selected
|
|
|
|
if (rdpStartTime.Enabled)
|
|
|
|
{
|
|
|
|
start = rdpStartTime.Value;
|
|
|
|
end = rdpEndTime.Value;
|
|
|
|
}
|
|
|
|
|
|
|
|
//make the top left display the start date
|
|
|
|
if (e.LabelElement.IsTopLeft)
|
|
|
|
{
|
|
|
|
if (e.LabelElement.Text.Equals("0"))
|
|
|
|
{
|
|
|
|
e.LabelElement.Text = String.Format("{0:HH:mm:ss}", start);
|
|
|
|
}
|
|
|
|
else if (e.LabelElement.Text.Equals(ListforGrid.Count+""))
|
|
|
|
{
|
|
|
|
e.LabelElement.Text = String.Format("{0:HH:mm:ss}", end);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
e.LabelElement.Text = "";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// bottom row
|
|
|
|
if(e.LabelElement.Text.Equals("0"))
|
|
|
|
{
|
|
|
|
e.LabelElement.Text = String.Format("{0:MM/dd/yyyy}", start);
|
|
|
|
}
|
|
|
|
else if (e.LabelElement.Text.Equals(ListforGrid.Count + ""))
|
|
|
|
{
|
|
|
|
e.LabelElement.Text = String.Format("{0:MM/dd/yyyy}", end);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
e.LabelElement.Text = "";
|
|
|
|
}*/
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Change the position which is displayed on the history
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
/// <param name="e"></param>
|
|
|
|
private void timeTrackBar_ValueChanged(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
Utils.WriteLine(timeTrackBar.Value.ToString(), ConsoleColor.Yellow);
|
2024-06-05 11:00:51 +00:00
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
if (changeTrackbarValueFromCode)
|
|
|
|
{
|
|
|
|
changeTrackbarValueFromCode = false;
|
|
|
|
return;
|
|
|
|
}
|
2024-06-05 11:00:51 +00:00
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
SMposition tmpos = (SMposition)Point_for_play[(Int32)timeTrackBar.Value];
|
2024-06-05 11:00:51 +00:00
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
Index_to_play = (Int32)timeTrackBar.Value;
|
|
|
|
|
2024-06-05 11:00:51 +00:00
|
|
|
updatecomand = FormatUpdateCommand(tmpos, FirstGoogle);
|
|
|
|
if (FirstGoogle)
|
2024-02-22 16:43:59 +00:00
|
|
|
FirstGoogle = false;
|
|
|
|
|
|
|
|
Int32 index = tmpos.m_evnt_id;
|
|
|
|
if ((index >= 0) && (index < gridHistoryPoints.RowCount))
|
|
|
|
{
|
|
|
|
// idx
|
|
|
|
gridHistoryPoints.Rows[index].IsSelected = true;
|
|
|
|
gridHistoryPoints.Rows[index].IsCurrent = true;
|
|
|
|
}
|
2024-06-05 11:00:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
updatecomand = FormatUpdateCommand(tmpos, FirstGoogle);
|
|
|
|
|
|
|
|
ExecuteScript(updatecomand);
|
|
|
|
ExecuteScript("putOnMap,none,heading_positions");
|
|
|
|
ExecuteScript($"openInfo,{vehSelect}");
|
|
|
|
ExecuteScript($"centerzoom,{tmpos.m_lat},{tmpos.m_lng},-1");
|
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
Utils.WriteLine("Exception on timetrack bar: "+ex.ToString(),ConsoleColor.Red);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Reset the visual UI for the history tab, including speeds,
|
|
|
|
/// times, grids and animation
|
|
|
|
/// </summary>
|
|
|
|
private void rbResetHistory_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
// remove old dataset points
|
|
|
|
if (docLoad)
|
|
|
|
{
|
2024-06-05 11:00:51 +00:00
|
|
|
ExecuteScript("reset");
|
2024-02-22 16:43:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MaxLAT = -90;
|
|
|
|
MaxLNG = -180;
|
|
|
|
MinLAT = 90;
|
|
|
|
MinLNG = 180;
|
|
|
|
Index_to_play = 0;
|
|
|
|
FirstGoogle = true;
|
|
|
|
selectedPositions.Clear();
|
2024-06-05 11:00:51 +00:00
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
if (gridHistoryPoints.Rows.Count > 0)
|
|
|
|
gridHistoryPoints.Rows.Clear();
|
2024-06-05 11:00:51 +00:00
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
gridHistoryPoints.DataSource = null;
|
|
|
|
|
|
|
|
|
|
|
|
// uncheck all units
|
|
|
|
foreach (RadTreeNode node in treeViewUnits.Nodes)
|
|
|
|
node.Checked = false;
|
|
|
|
|
2024-06-05 11:00:51 +00:00
|
|
|
|
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
// clear speed values
|
|
|
|
rseSpeedLower.Value = 0;
|
|
|
|
rseSpeedUpper.Value = 0;
|
|
|
|
|
|
|
|
// clear time values
|
|
|
|
rdpStartTime.Value = DateTime.Now.AddDays(-1);
|
|
|
|
rdpEndTime.Value = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Point_for_play.Clear();
|
|
|
|
ListforGrid.Clear();
|
|
|
|
if (timeTrackBar.Maximum > 0)
|
|
|
|
{
|
|
|
|
changeTrackbarValueFromCode = true;
|
|
|
|
timeTrackBar.Value = 0;
|
|
|
|
timeTrackBar.Maximum = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
Utils.WriteLine("Exception put all elements on 0: " + ex.ToString(), ConsoleColor.Red);
|
|
|
|
}
|
|
|
|
|
|
|
|
// reset the animation
|
|
|
|
rbStop.PerformClick();
|
|
|
|
|
|
|
|
rlAnimation.Text = MainForm2.returnLNGString("histAnimation");
|
|
|
|
|
|
|
|
// disable the history result window
|
|
|
|
foreach (Control ctr in windowHistoryResult.Controls)
|
|
|
|
ctr.Enabled = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Show or hide labels of history points that are displayed on the map
|
|
|
|
/// </summary>
|
|
|
|
private void rcbShowLabels_ToggleStateChanged(object sender, StateChangedEventArgs args)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (rcbShowLabels.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On)
|
2024-06-05 11:00:51 +00:00
|
|
|
|
|
|
|
ExecuteScript("putlabels, heading_positions");
|
|
|
|
else
|
|
|
|
ExecuteScript("removelabels, heading_positions");
|
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
Thread.Sleep(1);
|
2024-06-05 11:00:51 +00:00
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
checkbox_UpdateHT(sender, args);
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
SM.Debug("ExLive13:" + ex.ToString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Show or hide the geofences on the map
|
|
|
|
/// </summary>
|
|
|
|
private void rcbShowGeofence_ToggleStateChanged(object sender, StateChangedEventArgs args)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (rcbShowGeofence.Checked)
|
|
|
|
ForceShowZone();
|
|
|
|
else ForceHideZone();
|
2024-06-05 11:00:51 +00:00
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
checkbox_UpdateHT(sender, args);
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
SM.Debug("ExLive13:" + ex.ToString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Change the buttons background color for the animation buttons depending on their enabled/disabled
|
|
|
|
/// state
|
|
|
|
/// </summary>
|
|
|
|
private void rbtAnimation_EnabledChanged(object sender, EventArgs e)
|
|
|
|
{
|
2024-06-05 11:00:51 +00:00
|
|
|
Color bkColor = ((RadButton)sender).Enabled ? MainForm2.ButtonColor : MainForm2.ButtonColorDisabled;
|
|
|
|
((RadButton)sender).ButtonElement.ButtonFillElement.BackColor = bkColor;
|
2024-02-22 16:43:59 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Event handler for when the left tab panel needs to be docked/transfor in floating state.
|
|
|
|
/// This will cancel this event in order to prevent the stupid case with hiding the dock window
|
|
|
|
/// </summary>
|
|
|
|
private void radDock1_DockStateChanging(object sender, DockStateChangingEventArgs e)
|
|
|
|
{
|
|
|
|
e.Cancel = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Change background color for the row according to its state and theme
|
|
|
|
/// </summary>
|
|
|
|
private void treeViewUnits_NodeFormatting(object sender, TreeNodeFormattingEventArgs e)
|
|
|
|
{
|
|
|
|
if (e.NodeElement.IsSelected)
|
|
|
|
{
|
|
|
|
e.NodeElement.DrawFill = true;
|
|
|
|
e.NodeElement.BackColor = MainForm2.GridSelectedRow;
|
|
|
|
e.NodeElement.NumberOfColors = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
e.NodeElement.DrawFill = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Change background color for the row according to its state and theme
|
|
|
|
/// </summary>
|
|
|
|
private void gridHistoryPoints_RowFormatting(object sender, RowFormattingEventArgs e)
|
|
|
|
{
|
|
|
|
if (e.RowElement.IsSelected)
|
|
|
|
{
|
|
|
|
e.RowElement.DrawFill = true;
|
|
|
|
e.RowElement.BackColor = MainForm2.GridSelectedRow;
|
|
|
|
e.RowElement.NumberOfColors = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
e.RowElement.DrawFill = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
|
|
|
private void checkbox_UpdateHT(object sender, StateChangedEventArgs args)
|
|
|
|
{
|
|
|
|
VisualSettings.InsertUpdateHTforVisualItems(this.Name, ((RadCheckBox)sender).Name, ((RadCheckBox)sender).Checked.ToString());
|
|
|
|
}
|
|
|
|
|
|
|
|
private void rse_ValueChanged(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
if (isLoaded)
|
|
|
|
{
|
2024-06-05 11:00:51 +00:00
|
|
|
|
|
|
|
RadSpinEditor spinEditor = sender as RadSpinEditor;
|
|
|
|
|
|
|
|
int value = Convert.ToInt32(spinEditor.Value);
|
|
|
|
if (spinEditor.Name.Equals("rseSpeedLower") || spinEditor.Name.Equals("rseSpeedUpper"))
|
2024-02-22 16:43:59 +00:00
|
|
|
{
|
|
|
|
if (MainForm2.isInMile) value = (int)(value * 1.60934);
|
|
|
|
}
|
|
|
|
|
2024-06-05 11:00:51 +00:00
|
|
|
VisualSettings.InsertUpdateHTforVisualItems(this.Name, spinEditor.Name, value.ToString());
|
|
|
|
|
|
|
|
string spinEditorName = string.Empty;
|
|
|
|
|
|
|
|
if (spinEditor.Name.Equals("rsePositionDisplay"))
|
|
|
|
spinEditorName = "hisPlayTime";
|
|
|
|
else if (spinEditor.Name.Equals("rseSkipSeconds"))
|
|
|
|
spinEditorName = "hisPauseTime";
|
|
|
|
|
|
|
|
if(!string.IsNullOrEmpty(spinEditorName))
|
|
|
|
VisualSettings.InsertUpdateHTforVisualItems(spinEditorName, value.ToString());
|
|
|
|
|
2024-02-22 16:43:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// Prevent the context menu to be shown for this grid
|
|
|
|
/// </summary>
|
|
|
|
private void gridHistoryPoints_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e)
|
|
|
|
{
|
|
|
|
// do not display the context menu
|
|
|
|
e.Cancel = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void windowHistoryResult_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|