public static void Build(ref GMapOverlay OverlayOut) { /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Display defined radars // string FileName = @"C:\ASTERIX\IMAGES\radar.jpg"; Image RadarImage = Image.FromFile(FileName); // Get radar display attributes DisplayAttributes.DisplayAttributesType RadarDisplayAttribute = DisplayAttributes.GetDisplayAttribute(DisplayAttributes.DisplayItemsType.Radar); RadarImage = GraphicUtilities.ResizeImage(RadarImage, new Size(RadarDisplayAttribute.ImageSize.Width, RadarDisplayAttribute.ImageSize.Height), false); // Here loop through defined radars and display them on the map foreach (SystemAdaptationDataSet.Radar Radar in SystemAdaptationDataSet.RadarDataSet) { // Image properties GMapMarkerImage MyMarkerImage = new GMapMarkerImage(new PointLatLng(Radar.RadarPosition.GetLatLongDecimal().LatitudeDecimal, Radar.RadarPosition.GetLatLongDecimal().LongitudeDecimal), RadarImage); MyMarkerImage.ToolTipMode = MarkerTooltipMode.Never; System.Drawing.SolidBrush myBrush; myBrush = new System.Drawing.SolidBrush(RadarDisplayAttribute.TextColor); // Get radar marker image WaypointMarker WPT_Marker = new WaypointMarker(new PointLatLng(Radar.RadarPosition.GetLatLongDecimal().LatitudeDecimal, Radar.RadarPosition.GetLatLongDecimal().LongitudeDecimal), Radar.RadarName, new Font(RadarDisplayAttribute.TextFont, RadarDisplayAttribute.TextSize, FontStyle.Bold, GraphicsUnit.Pixel), myBrush); // Load radar marker and label to overlay OverlayOut.Markers.Add(MyMarkerImage); OverlayOut.Markers.Add(WPT_Marker); } }
public static void Load() { string DisplayAdaptationDataLine; string FileName; char[] delimiterChars = { ',', '\t' }; StreamReader MyStreamReader; FileName = @"C:\ASTERIX\ADAPTATION\DisplayAttributes.txt"; if (System.IO.File.Exists(FileName)) { MyStreamReader = System.IO.File.OpenText(FileName); while (MyStreamReader.Peek() >= 0) { DisplayAdaptationDataLine = MyStreamReader.ReadLine(); string[] words = DisplayAdaptationDataLine.Split(delimiterChars); if (words[0][0] != '#') { DisplayAttributes.DisplayAttributesType DisplayAttribute = new DisplayAttributes.DisplayAttributesType(); DisplayAttribute.ItemName = words[0]; DisplayAttribute.TextSize = int.Parse(words[1]); DisplayAttribute.TextFont = new FontFamily(words[2]); DisplayAttribute.TextColor = Color.FromName(words[3]); DisplayAttribute.LineWidth = int.Parse(words[4]); DisplayAttribute.LineColor = Color.FromName(words[5]); DisplayAttribute.LineStyle = DisplayAttributes.GetLineStypefromString(words[6]); DisplayAttribute.AreaPolygonColor = Color.FromName(words[7]); DisplayAttribute.ImageSize = new Size(int.Parse(words[8]), int.Parse((words[9]))); DisplayAttributes.SetDisplayAttribute((DisplayAttributes.DisplayItemsType)Enum.Parse(typeof(DisplayAttributes.DisplayItemsType), DisplayAttribute.ItemName, true), DisplayAttribute); } } } }
private void SyncFormData() { // First get all the display attributes for the selected data item DisplayAttributes.DisplayAttributesType DisplayAttribute = DisplayAttributes.GetDisplayAttribute((DisplayAttributes.DisplayItemsType)Enum.Parse(typeof(DisplayAttributes.DisplayItemsType), this.comboBoxDataItem.Text, true)); ///////////////////////////////////////////////////////////// // TEXT ATTRIBUTES ///////////////////////////////////////////////////////////// // Text Attributes Color this.comboBoxTextColorChoice.SelectedIndex = this.comboBoxTextColorChoice.FindStringExact(DisplayAttribute.TextColor.Name); // Text Attributes Font this.comboBoxTextFontChoice.SelectedIndex = this.comboBoxTextFontChoice.FindStringExact(DisplayAttribute.TextFont.Name); // Text Attributes Size this.comboBoxTextSizeChoice.SelectedIndex = DisplayAttribute.TextSize - 1; ///////////////////////////////////////////////////////////// // LINE ATTRIBUTES ///////////////////////////////////////////////////////////// // Line Attributes Color this.comboBoxLineColorChoice.SelectedIndex = this.comboBoxLineColorChoice.FindStringExact(DisplayAttribute.LineColor.Name); // Line Attributes Type this.comboBoxLineStyleChoice.SelectedIndex = this.comboBoxLineStyleChoice.FindStringExact(DisplayAttribute.LineStyle.ToString()); // Line Attributes Size. this.comboBoxLineWidth.SelectedIndex = DisplayAttribute.LineWidth - 1; ///////////////////////////////////////////////////////////// // AREA/POLYGON ATTRIBUTES ///////////////////////////////////////////////////////////// this.comboBoxAreaPolygonColorChoice.SelectedIndex = this.comboBoxAreaPolygonColorChoice.FindStringExact(DisplayAttribute.AreaPolygonColor.Name); ///////////////////////////////////////////////////////////// // IMAGE ATTRIBUTES ///////////////////////////////////////////////////////////// this.numericUpDown_X.Value = DisplayAttribute.ImageSize.Width; this.numericUpDown_Y.Value = DisplayAttribute.ImageSize.Height; this.pictureBox.BackColor = Color.FromName(this.comboBoxBackgroundColor.Text); UpdateSampleLine(); UpdateSampleText(); UpdateAreaPolygonSample(); UpdatePictureSample(); }
private void btnUpdate_Click(object sender, EventArgs e) { DisplayAttributes.DisplayAttributesType NewDisplayAttribute = new DisplayAttributes.DisplayAttributesType(); NewDisplayAttribute.ItemName = this.comboBoxDataItem.Text; NewDisplayAttribute.TextSize = int.Parse(this.comboBoxTextSizeChoice.Text); NewDisplayAttribute.TextFont = new FontFamily(this.comboBoxTextFontChoice.Text); NewDisplayAttribute.TextColor = Color.FromName(this.comboBoxTextColorChoice.Text); NewDisplayAttribute.LineWidth = int.Parse(this.comboBoxLineWidth.Text); NewDisplayAttribute.LineColor = Color.FromName(this.comboBoxLineColorChoice.Text); NewDisplayAttribute.LineStyle = DisplayAttributes.GetLineStypefromString(this.comboBoxLineStyleChoice.Text); NewDisplayAttribute.AreaPolygonColor = Color.FromName(this.comboBoxAreaPolygonColorChoice.Text); NewDisplayAttribute.ImageSize = new Size((int)this.numericUpDown_X.Value, (int)this.numericUpDown_Y.Value); DisplayAttributes.SetDisplayAttribute((DisplayAttributes.DisplayItemsType)Enum.Parse(typeof(DisplayAttributes.DisplayItemsType), NewDisplayAttribute.ItemName, true), NewDisplayAttribute); // Always update the background color as well NewDisplayAttribute = new DisplayAttributes.DisplayAttributesType(); NewDisplayAttribute.TextColor = Color.FromName(this.comboBoxBackgroundColor.Text); NewDisplayAttribute.ItemName = "BackgroundColor"; DisplayAttributes.SetDisplayAttribute(DisplayAttributes.DisplayItemsType.BackgroundColor, NewDisplayAttribute); // Populate the display origin GeoCordSystemDegMinSecUtilities.LatLongPrefix LatPrefix; GeoCordSystemDegMinSecUtilities.LatLongPrefix LoNPrefix; if (this.comboBoxLatDirection.SelectedIndex == 0) { LatPrefix = GeoCordSystemDegMinSecUtilities.LatLongPrefix.N; } else { LatPrefix = GeoCordSystemDegMinSecUtilities.LatLongPrefix.W; } if (this.comboBoxLonDirection.SelectedIndex == 0) { LoNPrefix = GeoCordSystemDegMinSecUtilities.LatLongPrefix.E; } else { LoNPrefix = GeoCordSystemDegMinSecUtilities.LatLongPrefix.S; } GeoCordSystemDegMinSecUtilities.LatLongClass LatLon = new GeoCordSystemDegMinSecUtilities.LatLongClass(int.Parse(this.txtLatDDD.Text), int.Parse(this.txtLatMM.Text), int.Parse(this.txtLatSS.Text), LatPrefix, int.Parse(this.txtLonDDD.Text), int.Parse(this.txtLonMM.Text), int.Parse(this.txtLonSS.Text), LoNPrefix); SystemAdaptationDataSet.SystemOrigin = new GMap.NET.PointLatLng(LatLon.GetLatLongDecimal().LatitudeDecimal, LatLon.GetLatLongDecimal().LongitudeDecimal); }
public static void Build(ref GMapOverlay OverlayOut) { // Here loop through defined state borders and display them on the map foreach (SystemAdaptationDataSet.StateBorder State in SystemAdaptationDataSet.StateBorderDataSet) { System.Collections.Generic.List <PointLatLng> SectorPointList = new System.Collections.Generic.List <PointLatLng>(); foreach (GeoCordSystemDegMinSecUtilities.LatLongClass SectorPoint in State.StateBorderPoints) { SectorPointList.Add(new PointLatLng(SectorPoint.GetLatLongDecimal().LatitudeDecimal, SectorPoint.GetLatLongDecimal().LongitudeDecimal)); } GMapRoute StateBoundaryData = new GMapRoute(SectorPointList, State.StateName); StateBoundaryData.Stroke.Width = DisplayAttributes.GetDisplayAttribute(DisplayAttributes.DisplayItemsType.StateBorder).LineWidth; StateBoundaryData.Stroke.DashStyle = DisplayAttributes.GetDisplayAttribute(DisplayAttributes.DisplayItemsType.StateBorder).LineStyle; StateBoundaryData.Stroke.Color = DisplayAttributes.GetDisplayAttribute(DisplayAttributes.DisplayItemsType.StateBorder).LineColor; OverlayOut.Routes.Add(StateBoundaryData); } }
private void btnUpdate_Click(object sender, EventArgs e) { // Label text attributes LabelAttributes.TextColor = Color.FromName(this.comboBoxTextColorChoice.Text); LabelAttributes.TextFont = new FontFamily(this.comboBoxTextFontChoice.Text); LabelAttributes.TextSize = int.Parse(this.comboBoxTextSizeChoice.Text); // Label Box and leader line attributes LabelAttributes.LineColor = Color.FromName(this.comboBoxLineColorChoice.Text); LabelAttributes.LineStyle = DisplayAttributes.GetLineStypefromString(this.comboBoxLineStyleChoice.Text); LabelAttributes.LineWidth = int.Parse(this.comboBoxLineWidth.Text); // Label background color LabelAttributes.BackgroundColor = Color.FromName(this.comboBoxBackroundColor.Text); // Target Symbol Attributes LabelAttributes.TargetColor = Color.FromName(this.comboBoxTargetColor.Text); LabelAttributes.TargetStyle = DisplayAttributes.GetLineStypefromString(this.comboBoxTargetStyle.Text); LabelAttributes.TargetSize = int.Parse(this.comboBoxTargetSize.Text); }
private void UpdateSampleLine() { if (this.comboBoxLineColorChoice.Text.Length > 0 && this.comboBoxLineWidth.Text.Length > 0 && this.comboBoxLineStyleChoice.Text.Length > 0) { // Create pen. Pen MyPen = new Pen(Color.FromName(this.comboBoxLineColorChoice.Text), int.Parse(this.comboBoxLineWidth.Text)); // Set line style MyPen.DashStyle = DisplayAttributes.GetLineStypefromString(this.comboBoxLineStyleChoice.Text); int x1 = panelLineAttributes.Width / int.Parse(this.comboBoxTextSizeChoice.Text); int y1 = panelLineAttributes.Height / int.Parse(this.comboBoxTextSizeChoice.Text); // Draw line to screen. Graphics MyGraphics = this.panelLineAttributes.CreateGraphics(); panelLineAttributes.Refresh(); MyGraphics.DrawLine(MyPen, 0, 0, panelLineAttributes.Width, panelLineAttributes.Height); MyGraphics.Dispose(); MyPen.Dispose(); } }
private void PopulateForm() { // Populate the display origin GeoCordSystemDegMinSecUtilities.LatLongClass LatLon = new GeoCordSystemDegMinSecUtilities.LatLongClass(SystemAdaptationDataSet.SystemOriginPoint.Lat, SystemAdaptationDataSet.SystemOriginPoint.Lng); this.txtLatDDD.Text = LatLon.GetDegMinSec().Latitude.Deg.ToString(); this.txtLatMM.Text = LatLon.GetDegMinSec().Latitude.Min.ToString(); int Int_Sec = (int)LatLon.GetDegMinSec().Latitude.Sec; this.txtLatSS.Text = Int_Sec.ToString(); if (LatLon.GetDegMinSec().Latitude.Prefix == GeoCordSystemDegMinSecUtilities.LatLongPrefix.N) { this.comboBoxLatDirection.SelectedIndex = 0; } else { this.comboBoxLatDirection.SelectedIndex = 1; } this.txtLonDDD.Text = LatLon.GetDegMinSec().Longitude.Deg.ToString(); this.txtLonMM.Text = LatLon.GetDegMinSec().Longitude.Min.ToString(); Int_Sec = (int)LatLon.GetDegMinSec().Longitude.Sec; this.txtLonSS.Text = Int_Sec.ToString(); if (LatLon.GetDegMinSec().Longitude.Prefix == GeoCordSystemDegMinSecUtilities.LatLongPrefix.E) { this.comboBoxLonDirection.SelectedIndex = 0; } else { this.comboBoxLonDirection.SelectedIndex = 1; } // Load all display items and set it to the first one in the list // and it will cause the selected index to change that will then trigger // a call to sync data function foreach (DisplayAttributes.DisplayAttributesType DataItem in DisplayAttributes.GetAllDisplayAttributes()) { if (DataItem.ItemName != "BackgroundColor") { comboBoxDataItem.Items.Add(DataItem.ItemName); } } // Background Color Type colorType = typeof(System.Drawing.Color); PropertyInfo[] propInfoList = colorType.GetProperties(BindingFlags.Static | BindingFlags.DeclaredOnly | BindingFlags.Public); foreach (PropertyInfo c in propInfoList) { this.comboBoxBackgroundColor.Items.Add(c.Name); } // Now set the index of the background color to the currently set background color. this.comboBoxBackgroundColor.SelectedIndex = this.comboBoxBackgroundColor.FindStringExact(DisplayAttributes.GetDisplayAttribute(DisplayAttributes.DisplayItemsType.BackgroundColor).TextColor.Name); ///////////////////////////////////////////////////////////// // TEXT ATTRIBUTES ///////////////////////////////////////////////////////////// // Text Attributes Color foreach (PropertyInfo c in propInfoList) { this.comboBoxTextColorChoice.Items.Add(c.Name); } // Text Attributes Font FontFamily[] ffArray = FontFamily.Families; foreach (FontFamily ff in ffArray) { this.comboBoxTextFontChoice.Items.Add(ff.Name); } for (int Index = 0; Index < this.comboBoxTextFontChoice.Items.Count; Index++) { try { Font TestFOnt = new Font(this.comboBoxTextFontChoice.Items[Index].ToString(), 7); } catch { this.comboBoxTextFontChoice.Items.RemoveAt(Index); } } ///////////////////////////////////////////////////////////// // LINE ATTRIBUTES ///////////////////////////////////////////////////////////// // Line Attributes Color foreach (PropertyInfo c in propInfoList) { this.comboBoxLineColorChoice.Items.Add(c.Name); } // Line Attributes Type // Hard coded ///////////////////////////////////////////////////////////// // AREA/POLYGON ATTRIBUTES ///////////////////////////////////////////////////////////// // Area/Polygon Attributes foreach (PropertyInfo c in propInfoList) { this.comboBoxAreaPolygonColorChoice.Items.Add(c.Name); } ///////////////////////////////////////////////////////////// // IMAGE ATTRIBUTES ///////////////////////////////////////////////////////////// // Now set index to the first display item this.comboBoxDataItem.SelectedIndex = 0; }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////// public static void InitializeData() { DisplayAttributes.Load(); LoadAdaptationData.Load(); }
public static void Build(ref GMapOverlay OverlayOut) { // Here loop through defined Runways and display them on the map foreach (SystemAdaptationDataSet.RunwayBorder Runway in SystemAdaptationDataSet.RunwayBorderDataSet) { System.Collections.Generic.List <PointLatLng> RunwayPointList = new System.Collections.Generic.List <PointLatLng>(); foreach (GeoCordSystemDegMinSecUtilities.LatLongClass RunwayPoint in Runway.RunwayBorderPoints) { RunwayPointList.Add(new PointLatLng(RunwayPoint.GetLatLongDecimal().LatitudeDecimal, RunwayPoint.GetLatLongDecimal().LongitudeDecimal)); } // Get Runway border display attributes DisplayAttributes.DisplayAttributesType RunwayBorderDisplayAttribute = DisplayAttributes.GetDisplayAttribute(DisplayAttributes.DisplayItemsType.RunwayBorder); GMapPolygon RunwayPolygon = new GMapPolygon(RunwayPointList, Runway.RunwayName); RunwayPolygon.Stroke = new Pen(RunwayBorderDisplayAttribute.LineColor, RunwayBorderDisplayAttribute.LineWidth); Type brushType = typeof(Brushes); Brush myBrush = (Brush)brushType.InvokeMember(RunwayBorderDisplayAttribute.AreaPolygonColor.Name, BindingFlags.Public | BindingFlags.Static | BindingFlags.GetProperty, null, null, new object[] { }); RunwayPolygon.Fill = myBrush; OverlayOut.Polygons.Add(RunwayPolygon); } }
public static void Load() { string DisplayAdaptationDataLine; string FileName; char[] delimiterChars = { ',', '\t' }; StreamReader MyStreamReader; FileName = @"C:\ASTERIX\ADAPTATION\LabelAttributes.txt"; if (System.IO.File.Exists(FileName)) { MyStreamReader = System.IO.File.OpenText(FileName); while (MyStreamReader.Peek() >= 0) { DisplayAdaptationDataLine = MyStreamReader.ReadLine(); string[] words = DisplayAdaptationDataLine.Split(delimiterChars); if (words[0][0] != '#') { switch (words[0]) { case "TEXT_COLOR": TextColor = Color.FromName(words[1]); break; case "TEXT_FONT": TextFont = new FontFamily(words[1]); break; case "TEXT_SIZE": TextSize = int.Parse(words[1]); break; case "LINE_COLOR": LineColor = Color.FromName(words[1]); break; case "LINE_STYLE": LineStyle = DisplayAttributes.GetLineStypefromString(words[1]); break; case "LINE_WIDTH": LineWidth = int.Parse(words[1]); break; case "TARGET_COLOR": TargetColor = Color.FromName(words[1]); break; case "TARGET_STYLE": TargetStyle = DisplayAttributes.GetLineStypefromString(words[1]); break; case "TARGET_SIZE": TargetSize = int.Parse(words[1]); break; default: MessageBox.Show("Bad format of LabelAttributes.txt"); break; } } } } }
public static void Save() { string BackgroundColor = "Black"; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // HANLDE Display Attributes First ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// string FileName; FileName = @"C:\ASTERIX\ADAPTATION\DisplayAttributes.txt"; DisplayAttributes.DisplayAttributesType DisplayAttribute = new DisplayAttributes.DisplayAttributesType(); string DisplayAttributesStream = "#ITEM_NAME,TEXT_SIZE,TEXT_FONT,TEXT_COLOR,LINE_WIDTH,LINE_COLOR,LINE_STYLE,AREA_COLOR,IMAGE_SIZE" + Environment.NewLine; System.Collections.Generic.List <DisplayAttributes.DisplayAttributesType> AllDisplayAtributes = DisplayAttributes.GetAllDisplayAttributes(); foreach (DisplayAttributes.DisplayAttributesType DataItem in DisplayAttributes.GetAllDisplayAttributes()) { if (DataItem.ItemName != "BackgroundColor") { DisplayAttributesStream = DisplayAttributesStream + DataItem.ItemName + ','; DisplayAttributesStream = DisplayAttributesStream + DataItem.TextSize.ToString() + ','; DisplayAttributesStream = DisplayAttributesStream + DataItem.TextFont.Name + ','; DisplayAttributesStream = DisplayAttributesStream + DataItem.TextColor.Name + ','; DisplayAttributesStream = DisplayAttributesStream + DataItem.LineWidth.ToString() + ','; DisplayAttributesStream = DisplayAttributesStream + DataItem.LineColor.Name + ','; DisplayAttributesStream = DisplayAttributesStream + DataItem.LineStyle.ToString() + ','; DisplayAttributesStream = DisplayAttributesStream + DataItem.AreaPolygonColor.Name + ','; DisplayAttributesStream = DisplayAttributesStream + DataItem.ImageSize.Width.ToString() + ','; DisplayAttributesStream = DisplayAttributesStream + DataItem.ImageSize.Height.ToString() + Environment.NewLine; } else { BackgroundColor = DataItem.TextColor.Name; } } // Remove the last character, which is the new line. DisplayAttributesStream.Remove(DisplayAttributesStream.Length - 1); // create a writer and open the file TextWriter tw = new StreamWriter(FileName); try { // write a line of text to the file tw.Write(DisplayAttributesStream); MessageBox.Show("DisplayAttributes succefully saved"); } catch (System.IO.IOException e) { MessageBox.Show(e.Message); } // close the stream tw.Close(); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // HANLDE MainSettings First ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// FileName = @"C:\ASTERIX\ADAPTATION\Main_Settings.txt"; DisplayAttributesStream = "# System center is : Deg (int), Min (int), Sec (int), Prefix (E/W/N/S)" + Environment.NewLine; GeoCordSystemDegMinSecUtilities.LatLongClass LatLon = new GeoCordSystemDegMinSecUtilities.LatLongClass(SystemAdaptationDataSet.SystemOriginPoint.Lat, SystemAdaptationDataSet.SystemOriginPoint.Lng); int Int_Lat_Sec = (int)LatLon.GetDegMinSec().Latitude.Sec; string LatPrefix = "N"; if (LatLon.GetDegMinSec().Latitude.Prefix == GeoCordSystemDegMinSecUtilities.LatLongPrefix.S) { LatPrefix = "S"; } int Int_Lon_Sec = (int)LatLon.GetDegMinSec().Longitude.Sec; string LonPrefix = "E"; if (LatLon.GetDegMinSec().Longitude.Prefix == GeoCordSystemDegMinSecUtilities.LatLongPrefix.W) { LonPrefix = "W"; } // 44,6,0,N,20,0,0,E DisplayAttributesStream = DisplayAttributesStream + "SYS_ORIGIN," + LatLon.GetDegMinSec().Latitude.Deg.ToString() + ',' + LatLon.GetDegMinSec().Latitude.Min.ToString() + ',' + Int_Lat_Sec.ToString() + ',' + LatPrefix + ',' + LatLon.GetDegMinSec().Longitude.Deg.ToString() + ',' + LatLon.GetDegMinSec().Longitude.Min.ToString() + ',' + Int_Lon_Sec.ToString() + ',' + LonPrefix + Environment.NewLine;; DisplayAttributesStream = DisplayAttributesStream + "BACKGROUND," + BackgroundColor; // create a writer and open the file tw = new StreamWriter(FileName); try { // write a line of text to the file tw.Write(DisplayAttributesStream); MessageBox.Show("Main_Settings succefully saved"); } catch (System.IO.IOException e) { MessageBox.Show(e.Message); } // close the stream tw.Close(); }
public static void Load() { string ConfigurationData; string FileName; char[] delimiterChars = { ',', '\t' }; StreamReader MyStreamReader; string ItemName; int LatDeg; int LatMin; int LatSec; GeoCordSystemDegMinSecUtilities.LatLongPrefix LatPrefix; int LonDeg; int LonMin; int LonSec; GeoCordSystemDegMinSecUtilities.LatLongPrefix LonPrefix; ///////////////////////////////////////////////////////////////////////// // First set the system origin ///////////////////////////////////////////////////////////////////////// FileName = @"C:\ASTERIX\ADAPTATION\Main_Settings.txt"; Exception Bad_Main_Settings = new Exception("Bad Main_Settings.txt file"); if (System.IO.File.Exists(FileName)) { MyStreamReader = System.IO.File.OpenText(FileName); while (MyStreamReader.Peek() >= 0) { ConfigurationData = MyStreamReader.ReadLine(); string[] words = ConfigurationData.Split(delimiterChars); if (words[0][0] != '#') { switch (words[0]) { case "SYS_ORIGIN": ItemName = words[0]; // Get Latitude if (int.TryParse(words[1], out LatDeg) == false) { throw Bad_Main_Settings; } if (int.TryParse(words[2], out LatMin) == false) { throw Bad_Main_Settings; } if (int.TryParse(words[3], out LatSec) == false) { throw Bad_Main_Settings; } switch (words[4]) { case "E": LatPrefix = GeoCordSystemDegMinSecUtilities.LatLongPrefix.E; break; case "W": LatPrefix = GeoCordSystemDegMinSecUtilities.LatLongPrefix.W; break; case "N": LatPrefix = GeoCordSystemDegMinSecUtilities.LatLongPrefix.N; break; case "S": LatPrefix = GeoCordSystemDegMinSecUtilities.LatLongPrefix.S; break; default: throw Bad_Main_Settings; } // Get Longitude if (int.TryParse(words[5], out LonDeg) == false) { throw Bad_Main_Settings; } if (int.TryParse(words[6], out LonMin) == false) { throw Bad_Main_Settings; } if (int.TryParse(words[7], out LonSec) == false) { throw Bad_Main_Settings; } switch (words[8]) { case "E": LonPrefix = GeoCordSystemDegMinSecUtilities.LatLongPrefix.E; break; case "W": LonPrefix = GeoCordSystemDegMinSecUtilities.LatLongPrefix.W; break; case "N": LonPrefix = GeoCordSystemDegMinSecUtilities.LatLongPrefix.N; break; case "S": LonPrefix = GeoCordSystemDegMinSecUtilities.LatLongPrefix.S; break; default: throw Bad_Main_Settings; } GeoCordSystemDegMinSecUtilities.LatLongClass T = new GeoCordSystemDegMinSecUtilities.LatLongClass(LatDeg, LatMin, LatSec, LatPrefix, LonDeg, LonMin, LonSec, LonPrefix); SystemAdaptationDataSet.SystemOrigin = new GMap.NET.PointLatLng(T.GetLatLongDecimal().LatitudeDecimal, T.GetLatLongDecimal().LongitudeDecimal); break; case "BACKGROUND": DisplayAttributes.DisplayAttributesType DisplayAttributeBackground = DisplayAttributes.GetDisplayAttribute(DisplayAttributes.DisplayItemsType.BackgroundColor); DisplayAttributeBackground.TextColor = System.Drawing.Color.FromName(words[1]); DisplayAttributes.SetDisplayAttribute(DisplayAttributes.DisplayItemsType.BackgroundColor, DisplayAttributeBackground); break; } } } } else { // Here is it initialized to the center of Bosnia and Herzegovina. SystemAdaptationDataSet.SystemOrigin = new GMap.NET.PointLatLng(44.05267, 17.6769); } }