530 lines
23 KiB
C#
530 lines
23 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.ComponentModel;
|
|||
|
using System.Drawing;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using System.Windows.Forms;
|
|||
|
using Safedispatch_4_0;
|
|||
|
using SafeMobileLib;
|
|||
|
using Telerik.WinControls.Layouts;
|
|||
|
using Telerik.WinControls.UI;
|
|||
|
|
|||
|
namespace Dispatcher.maptab.UIClasses
|
|||
|
{
|
|||
|
public class LiveAddressGridCellElement : GridDataCellElement
|
|||
|
{
|
|||
|
|
|||
|
private LightVisualElement unitNameElement;
|
|||
|
private LightVisualElement coordinatesNameElement;
|
|||
|
private LightVisualElement addressElement;
|
|||
|
private LightVisualElement timeElement;
|
|||
|
private LightVisualElement speedElement;
|
|||
|
private LightVisualElement directionElement;
|
|||
|
|
|||
|
private StackLayoutElement stackH;
|
|||
|
private StackLayoutElement stackTop;
|
|||
|
private StackLayoutElement stackContainer;
|
|||
|
|
|||
|
private StackLayoutElement stackBottom;
|
|||
|
private StackLayoutElement stackHTopAndBottom;
|
|||
|
private StackLayoutElement stackRight;
|
|||
|
private DockLayoutPanel dockLayout;
|
|||
|
|
|||
|
public LiveAddressGridCellElement(GridViewColumn column, GridRowElement row)
|
|||
|
: base(column, row)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
protected override void CreateChildElements()
|
|||
|
{
|
|||
|
base.CreateChildElements();
|
|||
|
|
|||
|
this.dockLayout = new DockLayoutPanel();
|
|||
|
this.dockLayout.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.WrapAroundChildren;
|
|||
|
this.dockLayout.StretchHorizontally = true;
|
|||
|
this.dockLayout.StretchVertically = true;
|
|||
|
this.dockLayout.AutoSize = true;
|
|||
|
this.dockLayout.ShouldHandleMouseInput = false;
|
|||
|
this.dockLayout.Padding = new Padding(0, 0, 0, 0);
|
|||
|
this.AutoToolTip = true;
|
|||
|
|
|||
|
|
|||
|
stackRight = new StackLayoutElement();
|
|||
|
stackRight.ElementSpacing = 0;
|
|||
|
stackRight.Orientation = Orientation.Vertical;
|
|||
|
stackRight.TextAlignment = ContentAlignment.MiddleLeft;
|
|||
|
stackRight.Alignment = ContentAlignment.MiddleLeft;
|
|||
|
stackRight.StretchHorizontally = true;
|
|||
|
stackRight.StretchVertically = false;
|
|||
|
stackRight.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
|||
|
//stackRight.AutoSize = true;
|
|||
|
//stackRight.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.WrapAroundChildren;
|
|||
|
/*
|
|||
|
stackRight.MinSize = new System.Drawing.Size(107, stackRight.Size.Height);
|
|||
|
stackRight.MaxSize = new System.Drawing.Size(107, stackRight.Size.Height);
|
|||
|
stackRight.Size = new System.Drawing.Size(107, stackRight.Size.Height);*/
|
|||
|
|
|||
|
|
|||
|
stackTop = new StackLayoutElement();
|
|||
|
stackTop.StretchHorizontally = false;
|
|||
|
stackTop.StretchVertically = false;
|
|||
|
stackTop.AutoSize = true;
|
|||
|
stackTop.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.WrapAroundChildren;
|
|||
|
stackTop.ElementSpacing = 0;
|
|||
|
stackTop.Orientation = Orientation.Vertical;
|
|||
|
stackTop.TextAlignment = ContentAlignment.MiddleLeft;
|
|||
|
stackTop.Alignment = ContentAlignment.MiddleLeft;
|
|||
|
stackTop.MaxSize = new System.Drawing.Size(225, 0);
|
|||
|
stackTop.MinSize = new System.Drawing.Size(225, 0);
|
|||
|
|
|||
|
|
|||
|
stackH = new StackLayoutElement();
|
|||
|
stackH.StretchHorizontally = true;
|
|||
|
stackH.StretchVertically = false;
|
|||
|
stackH.AutoSize = true;
|
|||
|
stackH.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.FitToAvailableSize;
|
|||
|
stackH.ElementSpacing = 0;
|
|||
|
stackH.Orientation = Orientation.Horizontal;
|
|||
|
stackH.TextAlignment = ContentAlignment.MiddleLeft;
|
|||
|
stackH.Alignment = ContentAlignment.MiddleLeft;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
unitNameElement = new LightVisualElement();
|
|||
|
|
|||
|
Font font = new Font(
|
|||
|
unitNameElement.Font.FontFamily,
|
|||
|
11,
|
|||
|
FontStyle.Bold,
|
|||
|
GraphicsUnit.Pixel);
|
|||
|
unitNameElement.Font = font;
|
|||
|
unitNameElement.ForeColor = Color.FromArgb(0, 0, 0);
|
|||
|
unitNameElement.StretchHorizontally = true;
|
|||
|
unitNameElement.StretchVertically= false;
|
|||
|
unitNameElement.AutoSize = true;
|
|||
|
unitNameElement.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.WrapAroundChildren;
|
|||
|
unitNameElement.Alignment = ContentAlignment.MiddleLeft;
|
|||
|
unitNameElement.TextAlignment = ContentAlignment.MiddleLeft;
|
|||
|
unitNameElement.MaxSize = new System.Drawing.Size(140, 15);
|
|||
|
//unitNameElement.MinSize = new System.Drawing.Size(140, 12);
|
|||
|
|
|||
|
|
|||
|
speedElement = new LightVisualElement();
|
|||
|
speedElement.StretchHorizontally = true;
|
|||
|
speedElement.StretchVertically = false;
|
|||
|
speedElement.AutoSize = true;
|
|||
|
//speedElement.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.FitToAvailableSize;
|
|||
|
speedElement.Alignment = ContentAlignment.MiddleRight;
|
|||
|
speedElement.TextAlignment = ContentAlignment.MiddleRight;
|
|||
|
speedElement.Padding = new System.Windows.Forms.Padding(0, 0, 0, 0);
|
|||
|
speedElement.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
|
|||
|
speedElement.ForeColor = Color.FromArgb(99, 99, 99);
|
|||
|
speedElement.TextWrap = true;
|
|||
|
|
|||
|
|
|||
|
addressElement = new LightVisualElement();
|
|||
|
addressElement.StretchHorizontally = false;
|
|||
|
addressElement.StretchVertically = false;
|
|||
|
//addressElement.AutoSize = true;
|
|||
|
//addressElement.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.WrapAroundChildren;
|
|||
|
addressElement.Alignment = ContentAlignment.MiddleLeft;
|
|||
|
addressElement.TextAlignment = ContentAlignment.MiddleLeft;
|
|||
|
//addressElement.Padding = new System.Windows.Forms.Padding(0, 3, 3, 0);
|
|||
|
addressElement.Margin = new System.Windows.Forms.Padding(0,0,0,0);
|
|||
|
addressElement.ForeColor = Color.FromArgb(99, 99, 99);
|
|||
|
addressElement.TextWrap = true;
|
|||
|
|
|||
|
//addressElement.MinSize = new System.Drawing.Size(dockLayout.MaxSize.Width - 30, 0);
|
|||
|
|
|||
|
stackH.Children.Add(unitNameElement);
|
|||
|
stackH.Children.Add(speedElement);
|
|||
|
// add crt number and address element to the top stack
|
|||
|
stackTop.Children.Add(stackH);
|
|||
|
stackTop.Children.Add(addressElement);
|
|||
|
|
|||
|
|
|||
|
stackHTopAndBottom = new StackLayoutElement();
|
|||
|
stackHTopAndBottom.StretchHorizontally = true;
|
|||
|
stackHTopAndBottom.StretchVertically = true;
|
|||
|
stackHTopAndBottom.AutoSize = true;
|
|||
|
stackHTopAndBottom.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.FitToAvailableSize;
|
|||
|
stackHTopAndBottom.ElementSpacing = 0;
|
|||
|
stackHTopAndBottom.Orientation = Orientation.Horizontal;
|
|||
|
stackHTopAndBottom.TextAlignment = ContentAlignment.TopLeft;
|
|||
|
stackHTopAndBottom.Alignment = ContentAlignment.TopLeft;
|
|||
|
|
|||
|
|
|||
|
directionElement = new LightVisualElement();
|
|||
|
directionElement.StretchHorizontally = true;
|
|||
|
directionElement.AutoSize = true;
|
|||
|
//directionElement.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.WrapAroundChildren;
|
|||
|
directionElement.Alignment = ContentAlignment.TopRight;
|
|||
|
directionElement.TextAlignment = ContentAlignment.TopRight;
|
|||
|
directionElement.Padding = new System.Windows.Forms.Padding(0, 0, 0, 0);
|
|||
|
directionElement.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
|||
|
directionElement.MaxSize = new System.Drawing.Size(32, 0);
|
|||
|
directionElement.MinSize = new System.Drawing.Size(32, 0);
|
|||
|
/*
|
|||
|
// add image to the dictionary if not exists
|
|||
|
if (!MainForm2.imagesDictionary.ContainsKey("l_direction_u"))
|
|||
|
MainForm2.imagesDictionary.Add("l_direction_u", global::Dispatcher.Properties.Resources.l_direction_u);
|
|||
|
|
|||
|
// set image for the list grid
|
|||
|
directionElement.Image = MainForm2.imagesDictionary["l_direction_u"];*/
|
|||
|
directionElement.ImageAlignment = ContentAlignment.MiddleLeft;
|
|||
|
directionElement.ImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
|||
|
directionElement.DrawText = false;
|
|||
|
|
|||
|
// add the top containers and the direction image
|
|||
|
stackHTopAndBottom.Children.Add(stackTop);
|
|||
|
stackHTopAndBottom.Children.Add(directionElement);
|
|||
|
|
|||
|
// create the middle stack
|
|||
|
stackBottom = new StackLayoutElement();
|
|||
|
stackBottom.StretchHorizontally = true;
|
|||
|
stackBottom.StretchVertically = false;
|
|||
|
//stackBottom.AutoSize = true;
|
|||
|
//stackBottom.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.FitToAvailableSize;
|
|||
|
stackBottom.ElementSpacing = 0;
|
|||
|
stackBottom.Orientation = Orientation.Horizontal;
|
|||
|
stackBottom.TextAlignment = ContentAlignment.MiddleLeft;
|
|||
|
stackBottom.Alignment = ContentAlignment.MiddleLeft;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
Font fontNumber3 = new Font(
|
|||
|
addressElement.Font.FontFamily,
|
|||
|
9,
|
|||
|
FontStyle.Regular,
|
|||
|
GraphicsUnit.Pixel);
|
|||
|
|
|||
|
|
|||
|
coordinatesNameElement = new LightVisualElement();
|
|||
|
coordinatesNameElement.Font = fontNumber3;
|
|||
|
coordinatesNameElement.ForeColor = Color.FromArgb(0, 0, 0);
|
|||
|
coordinatesNameElement.StretchHorizontally = false;
|
|||
|
coordinatesNameElement.AutoSize = true;
|
|||
|
coordinatesNameElement.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.FitToAvailableSize;
|
|||
|
coordinatesNameElement.Alignment = ContentAlignment.MiddleLeft;
|
|||
|
coordinatesNameElement.TextAlignment = ContentAlignment.MiddleLeft;
|
|||
|
|
|||
|
|
|||
|
timeElement = new LightVisualElement();
|
|||
|
timeElement.StretchHorizontally = true;
|
|||
|
timeElement.AutoSize = true;
|
|||
|
timeElement.Alignment = ContentAlignment.MiddleRight;
|
|||
|
timeElement.TextAlignment = ContentAlignment.MiddleRight;
|
|||
|
timeElement.MaxSize = new System.Drawing.Size(110, 12);
|
|||
|
timeElement.Padding = new System.Windows.Forms.Padding(0, 0, 3, 0);
|
|||
|
timeElement.Font = fontNumber3;
|
|||
|
timeElement.ForeColor = Color.FromArgb(161, 161, 161);
|
|||
|
|
|||
|
|
|||
|
// add coordinates and time to bottom stack
|
|||
|
stackBottom.Children.Add(coordinatesNameElement);
|
|||
|
stackBottom.Children.Add(timeElement);
|
|||
|
|
|||
|
|
|||
|
// add top, middle and bottom stacks to the right stack
|
|||
|
stackRight.Children.Add(stackHTopAndBottom);
|
|||
|
stackRight.Children.Add(stackBottom);
|
|||
|
|
|||
|
|
|||
|
// add stack to the dock
|
|||
|
dockLayout.Children.Add(stackRight);
|
|||
|
|
|||
|
//DockLayoutPanel.SetDock(this.stackRight, Telerik.WinControls.Layouts.Dock.Right);
|
|||
|
|
|||
|
this.Children.Add(dockLayout);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
protected override Type ThemeEffectiveType
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return typeof(GridDataCellElement);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public override bool IsCompatible(GridViewColumn data, object context)
|
|||
|
{
|
|||
|
return data is HistoryGridColumn && context is GridDataRowElement;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
private bool createdEventListener = false;
|
|||
|
public override void SetContent()
|
|||
|
{
|
|||
|
GridViewDataRowInfo row = this.RowInfo as GridViewDataRowInfo;
|
|||
|
if (row != null)
|
|||
|
{
|
|||
|
DataforGRID gridData = row.DataBoundItem as DataforGRID;
|
|||
|
|
|||
|
// create event listener for when something is changed
|
|||
|
if (!createdEventListener)
|
|||
|
{
|
|||
|
gridData.PropertyChanged += gridData_PropertyChanged;
|
|||
|
createdEventListener = true;
|
|||
|
}
|
|||
|
|
|||
|
// update the ui elements
|
|||
|
updateUIElements(gridData);
|
|||
|
}
|
|||
|
|
|||
|
this.Text = string.Empty;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Listener and event handler for when a property changes value in
|
|||
|
/// the gridData object. This will cause the grid element to redraw
|
|||
|
/// with new values
|
|||
|
/// </summary>
|
|||
|
void gridData_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
|||
|
{
|
|||
|
switch (e.PropertyName)
|
|||
|
{
|
|||
|
case "nrOfUpdates":
|
|||
|
{
|
|||
|
// get row
|
|||
|
GridViewDataRowInfo row = this.RowInfo as GridViewDataRowInfo;
|
|||
|
if (row != null)
|
|||
|
{
|
|||
|
// get row data
|
|||
|
DataforGRID gridData = row.DataBoundItem as DataforGRID;
|
|||
|
|
|||
|
// update the ui elements
|
|||
|
updateUIElements(gridData);
|
|||
|
}
|
|||
|
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Update all UI elements with the ones received in gridData object
|
|||
|
/// </summary>
|
|||
|
/// <param name="gridData">Object containing all infos for the UI elements</param>
|
|||
|
private void updateUIElements(DataforGRID gridData)
|
|||
|
{
|
|||
|
if (gridData != null)
|
|||
|
{
|
|||
|
// set the vehicle name
|
|||
|
unitNameElement.Text = gridData.VehName;
|
|||
|
|
|||
|
// set position time
|
|||
|
if (gridData.Datatime.Year > 2000)
|
|||
|
{
|
|||
|
string timeAgo = LiveGridCellElement.GetDateTimeAgo(gridData.Datatime);
|
|||
|
timeElement.Text = timeAgo.Equals(MainForm2.returnLNGString("scheduled")) ? MainForm2.returnLNGString("inTheFuture") : timeAgo;
|
|||
|
}
|
|||
|
|
|||
|
if (gridData.Address.Length > 0 && !gridData.Address.Equals("N/A"))
|
|||
|
{
|
|||
|
// set the addres
|
|||
|
addressElement.Text = gridData.Address;
|
|||
|
|
|||
|
// add speed to the addres field
|
|||
|
speedElement.Text = gridData.Speed + (MainForm2.isInMile ? " " + MainForm2.milesh : " " + MainForm2.kmh);
|
|||
|
|
|||
|
// add coordinates if available
|
|||
|
if (gridData.Lng.Length > 0 && !gridData.Lng.Equals("N/A"))
|
|||
|
coordinatesNameElement.Text = "[" + gridData.Lat + "," + gridData.Lng + "]";
|
|||
|
|
|||
|
// set the tooltip text which will be displayed
|
|||
|
this.ToolTipText = addressElement.Text;
|
|||
|
|
|||
|
directionElement.Image = GetDirectionImage(SafeMobileLib.Utils.Direction.GetDirection(gridData.Head));
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
addressElement.Text = MainForm2.returnLNGString("noAddress");
|
|||
|
stackBottom.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Get the bullet image for the current state of the unit
|
|||
|
/// based on its position time, speed and status
|
|||
|
/// </summary>
|
|||
|
/// <param name="positionTime">Time of the position</param>
|
|||
|
/// <param name="status">Unit status as decided bt the system</param>
|
|||
|
/// <param name="speed">Speed of the unit</param>
|
|||
|
/// <returns>Image representing the state of the unit</returns>
|
|||
|
public Image GetDirectionImage(SafeMobileLib.Utils.Direction direction)
|
|||
|
{
|
|||
|
if (direction == SafeMobileLib.Utils.Direction.E)
|
|||
|
{
|
|||
|
// add image to the dictionary if not exists
|
|||
|
if (!MainForm2.imagesDictionary.ContainsKey("l_direction_e"))
|
|||
|
MainForm2.imagesDictionary.Add("l_direction_e", global::Dispatcher.Properties.Resources.l_direction_e);
|
|||
|
|
|||
|
// return the desired image
|
|||
|
return MainForm2.imagesDictionary["l_direction_e"];
|
|||
|
}
|
|||
|
else if (direction == SafeMobileLib.Utils.Direction.ENE)
|
|||
|
{
|
|||
|
// add image to the dictionary if not exists
|
|||
|
if (!MainForm2.imagesDictionary.ContainsKey("l_direction_ene"))
|
|||
|
MainForm2.imagesDictionary.Add("l_direction_ene", global::Dispatcher.Properties.Resources.l_direction_ene);
|
|||
|
|
|||
|
// return the desired image
|
|||
|
return MainForm2.imagesDictionary["l_direction_ene"];
|
|||
|
}
|
|||
|
else if (direction == SafeMobileLib.Utils.Direction.ESE)
|
|||
|
{
|
|||
|
// add image to the dictionary if not exists
|
|||
|
if (!MainForm2.imagesDictionary.ContainsKey("l_direction_ese"))
|
|||
|
MainForm2.imagesDictionary.Add("l_direction_ese", global::Dispatcher.Properties.Resources.l_direction_ese);
|
|||
|
|
|||
|
// return the desired image
|
|||
|
return MainForm2.imagesDictionary["l_direction_ese"];
|
|||
|
}
|
|||
|
else if (direction == SafeMobileLib.Utils.Direction.N)
|
|||
|
{
|
|||
|
// add image to the dictionary if not exists
|
|||
|
if (!MainForm2.imagesDictionary.ContainsKey("l_direction_n"))
|
|||
|
MainForm2.imagesDictionary.Add("l_direction_n", global::Dispatcher.Properties.Resources.l_direction_n);
|
|||
|
|
|||
|
// return the desired image
|
|||
|
return MainForm2.imagesDictionary["l_direction_n"];
|
|||
|
}
|
|||
|
else if (direction == SafeMobileLib.Utils.Direction.NE)
|
|||
|
{
|
|||
|
// add image to the dictionary if not exists
|
|||
|
if (!MainForm2.imagesDictionary.ContainsKey("l_direction_ne"))
|
|||
|
MainForm2.imagesDictionary.Add("l_direction_ne", global::Dispatcher.Properties.Resources.l_direction_ne);
|
|||
|
|
|||
|
// return the desired image
|
|||
|
return MainForm2.imagesDictionary["l_direction_ne"];
|
|||
|
}
|
|||
|
else if (direction == SafeMobileLib.Utils.Direction.NNE)
|
|||
|
{
|
|||
|
// add image to the dictionary if not exists
|
|||
|
if (!MainForm2.imagesDictionary.ContainsKey("l_direction_nne"))
|
|||
|
MainForm2.imagesDictionary.Add("l_direction_nne", global::Dispatcher.Properties.Resources.l_direction_nne);
|
|||
|
|
|||
|
// return the desired image
|
|||
|
return MainForm2.imagesDictionary["l_direction_nne"];
|
|||
|
}
|
|||
|
else if (direction == SafeMobileLib.Utils.Direction.NNW)
|
|||
|
{
|
|||
|
// add image to the dictionary if not exists
|
|||
|
if (!MainForm2.imagesDictionary.ContainsKey("l_direction_nnw"))
|
|||
|
MainForm2.imagesDictionary.Add("l_direction_nnw", global::Dispatcher.Properties.Resources.l_direction_nnw);
|
|||
|
|
|||
|
// return the desired image
|
|||
|
return MainForm2.imagesDictionary["l_direction_nnw"];
|
|||
|
}
|
|||
|
else if (direction == SafeMobileLib.Utils.Direction.NW)
|
|||
|
{
|
|||
|
// add image to the dictionary if not exists
|
|||
|
if (!MainForm2.imagesDictionary.ContainsKey("l_direction_nw"))
|
|||
|
MainForm2.imagesDictionary.Add("l_direction_nw", global::Dispatcher.Properties.Resources.l_direction_nw);
|
|||
|
|
|||
|
// return the desired image
|
|||
|
return MainForm2.imagesDictionary["l_direction_nw"];
|
|||
|
}
|
|||
|
else if (direction == SafeMobileLib.Utils.Direction.S)
|
|||
|
{
|
|||
|
// add image to the dictionary if not exists
|
|||
|
if (!MainForm2.imagesDictionary.ContainsKey("l_direction_s"))
|
|||
|
MainForm2.imagesDictionary.Add("l_direction_s", global::Dispatcher.Properties.Resources.l_direction_s);
|
|||
|
|
|||
|
// return the desired image
|
|||
|
return MainForm2.imagesDictionary["l_direction_s"];
|
|||
|
}
|
|||
|
else if (direction == SafeMobileLib.Utils.Direction.SE)
|
|||
|
{
|
|||
|
// add image to the dictionary if not exists
|
|||
|
if (!MainForm2.imagesDictionary.ContainsKey("l_direction_se"))
|
|||
|
MainForm2.imagesDictionary.Add("l_direction_se", global::Dispatcher.Properties.Resources.l_direction_se);
|
|||
|
|
|||
|
// return the desired image
|
|||
|
return MainForm2.imagesDictionary["l_direction_se"];
|
|||
|
}
|
|||
|
else if (direction == SafeMobileLib.Utils.Direction.SSE)
|
|||
|
{
|
|||
|
// add image to the dictionary if not exists
|
|||
|
if (!MainForm2.imagesDictionary.ContainsKey("l_direction_sse"))
|
|||
|
MainForm2.imagesDictionary.Add("l_direction_sse", global::Dispatcher.Properties.Resources.l_direction_sse);
|
|||
|
|
|||
|
// return the desired image
|
|||
|
return MainForm2.imagesDictionary["l_direction_sse"];
|
|||
|
}
|
|||
|
else if (direction == SafeMobileLib.Utils.Direction.SSW)
|
|||
|
{
|
|||
|
// add image to the dictionary if not exists
|
|||
|
if (!MainForm2.imagesDictionary.ContainsKey("l_direction_ssw"))
|
|||
|
MainForm2.imagesDictionary.Add("l_direction_ssw", global::Dispatcher.Properties.Resources.l_direction_ssw);
|
|||
|
|
|||
|
// return the desired image
|
|||
|
return MainForm2.imagesDictionary["l_direction_ssw"];
|
|||
|
}
|
|||
|
else if (direction == SafeMobileLib.Utils.Direction.SW)
|
|||
|
{
|
|||
|
// add image to the dictionary if not exists
|
|||
|
if (!MainForm2.imagesDictionary.ContainsKey("l_direction_sw"))
|
|||
|
MainForm2.imagesDictionary.Add("l_direction_sw", global::Dispatcher.Properties.Resources.l_direction_sw);
|
|||
|
|
|||
|
// return the desired image
|
|||
|
return MainForm2.imagesDictionary["l_direction_sw"];
|
|||
|
}
|
|||
|
else if (direction == SafeMobileLib.Utils.Direction.UNKNOWN)
|
|||
|
{
|
|||
|
// add image to the dictionary if not exists
|
|||
|
if (!MainForm2.imagesDictionary.ContainsKey("l_direction_u"))
|
|||
|
MainForm2.imagesDictionary.Add("l_direction_u", global::Dispatcher.Properties.Resources.l_direction_u);
|
|||
|
|
|||
|
// return the desired image
|
|||
|
return MainForm2.imagesDictionary["l_direction_u"];
|
|||
|
}
|
|||
|
else if (direction == SafeMobileLib.Utils.Direction.W)
|
|||
|
{
|
|||
|
// add image to the dictionary if not exists
|
|||
|
if (!MainForm2.imagesDictionary.ContainsKey("l_direction_w"))
|
|||
|
MainForm2.imagesDictionary.Add("l_direction_w", global::Dispatcher.Properties.Resources.l_direction_w);
|
|||
|
|
|||
|
// return the desired image
|
|||
|
return MainForm2.imagesDictionary["l_direction_w"];
|
|||
|
}
|
|||
|
else if (direction == SafeMobileLib.Utils.Direction.WNW)
|
|||
|
{
|
|||
|
// add image to the dictionary if not exists
|
|||
|
if (!MainForm2.imagesDictionary.ContainsKey("l_direction_wnw"))
|
|||
|
MainForm2.imagesDictionary.Add("l_direction_wnw", global::Dispatcher.Properties.Resources.l_direction_wnw);
|
|||
|
|
|||
|
// return the desired image
|
|||
|
return MainForm2.imagesDictionary["l_direction_wnw"];
|
|||
|
}
|
|||
|
else if (direction == SafeMobileLib.Utils.Direction.WSW)
|
|||
|
{
|
|||
|
// add image to the dictionary if not exists
|
|||
|
if (!MainForm2.imagesDictionary.ContainsKey("l_direction_wsw"))
|
|||
|
MainForm2.imagesDictionary.Add("l_direction_wsw", global::Dispatcher.Properties.Resources.l_direction_wsw);
|
|||
|
|
|||
|
// return the desired image
|
|||
|
return MainForm2.imagesDictionary["l_direction_wsw"];
|
|||
|
}
|
|||
|
|
|||
|
return null;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
}
|