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;
}