Professional Applications Programmers/Consultants برمجة واستشارات تطبيقات الإنترنت
Skip Navigation LinksHome » Code Library » ApplicationInformation

Public general use code classes and xml files that we've compiled and used over the years:

ApplicationInformation Support class for TentPlay Trek data model

   1:  using System;
   2:  using System.Collections.Generic;
   3:  using System.Linq;
   4:  using System.Text.RegularExpressions;
   5:  using System.Xml.Linq;
   6:  using System.IO;
   7:  using System.Reflection;
   8:  using System.Web;
   9:   
  10:  namespace Ia.TentPlay.Cl.Model.Data.Trek
  11:  {
  12:      ////////////////////////////////////////////////////////////////////////////
  13:   
  14:      /// <summary publish="true">
  15:      /// ApplicationInformation Support class for TentPlay Trek data model
  16:      /// </summary>
  17:      /// 
  18:      /// <remarks> 
  19:      /// Copyright © 2006-2018 Jasem Y. Al-Shamlan (info@ia.com.kw), Internet Applications - Kuwait. All Rights Reserved.
  20:      ///
  21:      /// This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
  22:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  23:      ///
  24:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  25:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  26:      /// 
  27:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  28:      /// 
  29:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  30:      /// </remarks> 
  31:      public class ApplicationInformation
  32:      {
  33:          private static XDocument xDocument;
  34:          private static List<Country> countryList;
  35:          private static List<Translation> translationList;
  36:   
  37:          ////////////////////////////////////////////////////////////////////////////
  38:   
  39:          /// <summary>
  40:          ///
  41:          /// </summary>
  42:          public ApplicationInformation() { }
  43:   
  44:          ////////////////////////////////////////////////////////////////////////////
  45:          ////////////////////////////////////////////////////////////////////////////
  46:   
  47:          /// <summary>
  48:          ///
  49:          /// </summary>
  50:          public class Country
  51:          {
  52:              private List<Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Translation> translationList;
  53:   
  54:              /// <summary/>
  55:              public Country() { }
  56:   
  57:              /// <summary/>
  58:              public string Iso2 { get; set; }
  59:              /// <summary/>
  60:              public string Name { get; set; }
  61:              /// <summary/>
  62:              public Dictionary<string, string> NameDictionary { get; set; }
  63:              /// <summary/>
  64:              public string ManifestPackagePrefix { get; set; }
  65:   
  66:              /// <summary/>
  67:              public Dictionary<string, string> ApplicationNameDictionary { get; set; }
  68:              /// <summary/>
  69:              public string WhatsNew { get; set; }
  70:              /// <summary/>
  71:              public string VersionName { get; set; }
  72:              /// <summary/>
  73:              public string CopyrightYear { get; set; }
  74:              /// <summary/>
  75:              public string ManifestPackage { get; set; }
  76:   
  77:              /// <summary/>
  78:              public string ApplicationDownloadLink { get; set; }
  79:   
  80:              /// <summary/>
  81:              public string GoogleMapsDebugApiKey { get; set; }
  82:              /// <summary/>
  83:              public string GoogleMapsProductionApiKey { get; set; }
  84:   
  85:              /// <summary/>
  86:              public string GoogleAdMobAdUnitDebugId { get; set; }
  87:              /// <summary/>
  88:              public string GoogleAdMobAppId { get; set; }
  89:              /// <summary/>
  90:              public string GoogleAdMobAdUnitProductionId { get; set; }
  91:   
  92:              /// <summary/>
  93:              public DateTime Published { get; set; }
  94:   
  95:              /// <summary/>
  96:              public int FeatureCount { get; set; }
  97:              /// <summary/>
  98:              public int AdministrativeFeatureCount { get; set; }
  99:              /// <summary/>
 100:              public int PopulatedFeatureCount { get; set; }
 101:              /// <summary/>
 102:              public int VegetationFeatureCount { get; set; }
 103:              /// <summary/>
 104:              public int LocalityFeatureCount { get; set; }
 105:              /// <summary/>
 106:              public int UnderseaFeatureCount { get; set; }
 107:              /// <summary/>
 108:              public int StreetFeatureCount { get; set; }
 109:              /// <summary/>
 110:              public int HypsographicFeatureCount { get; set; }
 111:              /// <summary/>
 112:              public int HydrographicFeatureCount { get; set; }
 113:              /// <summary/>
 114:              public int SpotFeatureCount { get; set; }
 115:   
 116:              /// <summary/>
 117:              public string ColorPrimary { get; set; }
 118:              /// <summary/>
 119:              public string ColorPrimaryDark { get; set; }
 120:              /// <summary/>
 121:              public string ColorAccent { get; set; }
 122:   
 123:              /// <summary/>
 124:              public bool LanguageListMatchesTranslationList
 125:              {
 126:                  get
 127:                  {
 128:                      bool b;
 129:   
 130:                      if (Languages != null && Translations != null)
 131:                      {
 132:                          b = Languages.All(u => Translations.Any(y => y.Iso6391 == u.Iso6391)) && Translations.All(u => Languages.Any(y => y.Iso6391 == u.Iso6391)) && Languages.Count == Translations.Count;
 133:                      }
 134:                      else b = false;
 135:   
 136:                      return b;
 137:                  }
 138:              }
 139:              /// <summary/>
 140:              public virtual List<Image> NavigationHeaderImages { get; set; }
 141:              /// <summary/>
 142:              public virtual List<Ia.Cl.Model.Language> Languages { get; set; }
 143:              /// <summary/>
 144:              public virtual ICollection<Translation> Translations
 145:              {
 146:                  get
 147:                  {
 148:                      if (translationList == null || translationList.Count == 0)
 149:                      {
 150:                          translationList = TranslationList(this);
 151:                      }
 152:   
 153:                      return translationList;
 154:                  }
 155:              }
 156:          }
 157:   
 158:          ////////////////////////////////////////////////////////////////////////////    
 159:   
 160:          public class Image
 161:          {
 162:              /// <summary/>
 163:              //public string Caption { get; set; }
 164:              /// <summary/>
 165:              //public string Photographer { get; set; }
 166:              /// <summary/>
 167:              //public string Source { get; set; }
 168:              /// <summary/>
 169:              public string AndroidFileName { get; set; }
 170:              /// <summary/>
 171:              public string FileName { get; set; }
 172:          }
 173:   
 174:          ////////////////////////////////////////////////////////////////////////////    
 175:   
 176:          public class Translation
 177:          {
 178:              /// <summary/>
 179:              public Translation() { }
 180:   
 181:              /// <summary/>
 182:              public string CountryIso2 { get; set; }
 183:              /// <summary/>
 184:              public string Iso6391 { get; set; }
 185:              /// <summary/>
 186:              public string SiteName { get; set; }
 187:              /// <summary/>
 188:              public string CompanyName { get; set; }
 189:              /// <summary/>
 190:              public string ShortDescription { get; set; }
 191:              /// <summary/>
 192:              public string LongDescription { get; set; }
 193:   
 194:              /// <summary/>
 195:              public string About { get; set; }
 196:              /// <summary/>
 197:              public string AboutTitle { get; set; }
 198:              /// <summary/>
 199:              public string SearchSearchHint { get; set; }
 200:              /// <summary/>
 201:              public string Statistic { get; set; }
 202:              /// <summary/>
 203:              public string StatisticTitle { get; set; }
 204:              /// <summary/>
 205:              public string Setting { get; set; }
 206:              /// <summary/>
 207:              public string SettingTitle { get; set; }
 208:   
 209:              /// <summary/>
 210:              public string ShareTitle { get; set; }
 211:              /// <summary/>
 212:              public string ShareApplication { get; set; }
 213:              /// <summary/>
 214:              public string ShareTrek { get; set; }
 215:              /// <summary/>
 216:              public string ShareNoEmailClientInstalled { get; set; }
 217:              /// <summary/>
 218:              public string ShareContactUs { get; set; }
 219:   
 220:              /// <summary/>
 221:              public string HelpFeedbackTitle { get; set; }
 222:              /// <summary/>
 223:              public string Help { get; set; }
 224:              /// <summary/>
 225:              public string HelpTitle { get; set; }
 226:              /// <summary/>
 227:              public string HelpMagnifiyingGlass { get; set; }
 228:              /// <summary/>
 229:              public string HelpMainListOrder { get; set; }
 230:              /// <summary/>
 231:              public string HelpMapType { get; set; }
 232:              /// <summary/>
 233:              public string HelpGoogleMapRoute { get; set; }
 234:              /// <summary/>
 235:              public string HelpGoogleMapMarker { get; set; }
 236:              /// <summary/>
 237:              public string Feedback { get; set; }
 238:              /// <summary/>
 239:              public string FeedbackTitle { get; set; }
 240:              /// <summary/>
 241:              public string FeedbackEmailSubject { get; set; }
 242:   
 243:              /// <summary/>
 244:              public string Legal { get; set; }
 245:              /// <summary/>
 246:              public string LegalTitle { get; set; }
 247:              /// <summary/>
 248:              public string FeatureClassName { get; set; }
 249:              /// <summary/>
 250:              public string FeatureClassCaption { get; set; }
 251:              /// <summary/>
 252:              public string FeatureClassDescription { get; set; }
 253:              /// <summary/>
 254:              public string FeatureClassAdministrativeName { get; set; }
 255:              /// <summary/>
 256:              public string FeatureClassAdministrativeCaption { get; set; }
 257:              /// <summary/>
 258:              public string FeatureClassAdministrativeClassId { get; set; }
 259:              /// <summary/>
 260:              public string FeatureClassAdministrativeDescription { get; set; }
 261:              /// <summary/>
 262:              public string FeatureClassPopulatedName { get; set; }
 263:              /// <summary/>
 264:              public string FeatureClassPopulatedCaption { get; set; }
 265:              /// <summary/>
 266:              public string FeatureClassPopulatedClassId { get; set; }
 267:              /// <summary/>
 268:              public string FeatureClassPopulatedDescription { get; set; }
 269:              /// <summary/>
 270:              public string FeatureClassVegetationName { get; set; }
 271:              /// <summary/>
 272:              public string FeatureClassVegetationCaption { get; set; }
 273:              /// <summary/>
 274:              public string FeatureClassVegetationClassId { get; set; }
 275:              /// <summary/>
 276:              public string FeatureClassVegetationDescription { get; set; }
 277:              /// <summary/>
 278:              public string FeatureClassLocalityName { get; set; }
 279:              /// <summary/>
 280:              public string FeatureClassLocalityCaption { get; set; }
 281:              /// <summary/>
 282:              public string FeatureClassLocalityClassId { get; set; }
 283:              /// <summary/>
 284:              public string FeatureClassLocalityDescription { get; set; }
 285:              /// <summary/>
 286:              public string FeatureClassUnderseaName { get; set; }
 287:              /// <summary/>
 288:              public string FeatureClassUnderseaCaption { get; set; }
 289:              /// <summary/>
 290:              public string FeatureClassUnderseaClassId { get; set; }
 291:              /// <summary/>
 292:              public string FeatureClassUnderseaDescription { get; set; }
 293:              /// <summary/>
 294:              public string FeatureClassStreetName { get; set; }
 295:              /// <summary/>
 296:              public string FeatureClassStreetCaption { get; set; }
 297:              /// <summary/>
 298:              public string FeatureClassStreetClassId { get; set; }
 299:              /// <summary/>
 300:              public string FeatureClassStreetDescription { get; set; }
 301:              /// <summary/>
 302:              public string FeatureClassHypsographicName { get; set; }
 303:              /// <summary/>
 304:              public string FeatureClassHypsographicCaption { get; set; }
 305:              /// <summary/>
 306:              public string FeatureClassHypsographicClassId { get; set; }
 307:              /// <summary/>
 308:              public string FeatureClassHypsographicDescription { get; set; }
 309:              /// <summary/>
 310:              public string FeatureClassHydrographicName { get; set; }
 311:              /// <summary/>
 312:              public string FeatureClassHydrographicCaption { get; set; }
 313:              /// <summary/>
 314:              public string FeatureClassHydrographicClassId { get; set; }
 315:              /// <summary/>
 316:              public string FeatureClassHydrographicDescription { get; set; }
 317:              /// <summary/>
 318:              public string FeatureClassSpotName { get; set; }
 319:              /// <summary/>
 320:              public string FeatureClassSpotCaption { get; set; }
 321:              /// <summary/>
 322:              public string FeatureClassSpotClassId { get; set; }
 323:              /// <summary/>
 324:              public string FeatureClassSpotDescription { get; set; }
 325:              /// <summary/>
 326:              public virtual ICollection<Country> Countries
 327:              {
 328:                  get
 329:                  {
 330:                      return (from c in CountryList where c.Languages.Any(u => u.Iso6391 == this.Iso6391) select c).ToList();
 331:                  }
 332:              }
 333:              /// <summary/>
 334:              public List<Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass> FeatureClassList
 335:              {
 336:                  get
 337:                  {
 338:                      Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass fc;
 339:                      List<Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass> list;
 340:   
 341:                      list = new List<Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass>();
 342:   
 343:                      fc = new Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass();
 344:   
 345:                      fc.Id = this.FeatureClassAdministrativeClassId;
 346:                      fc.Name = this.FeatureClassAdministrativeName;
 347:                      fc.Caption = this.FeatureClassAdministrativeCaption;
 348:                      fc.Description = this.FeatureClassAdministrativeDescription;
 349:   
 350:                      list.Add(fc);
 351:   
 352:   
 353:                      fc = new Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass();
 354:   
 355:                      fc.Id = this.FeatureClassPopulatedClassId;
 356:                      fc.Name = this.FeatureClassPopulatedName;
 357:                      fc.Caption = this.FeatureClassPopulatedCaption;
 358:                      fc.Description = this.FeatureClassPopulatedDescription;
 359:   
 360:                      list.Add(fc);
 361:   
 362:   
 363:                      fc = new Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass();
 364:   
 365:                      fc.Id = this.FeatureClassVegetationClassId;
 366:                      fc.Name = this.FeatureClassVegetationName;
 367:                      fc.Caption = this.FeatureClassVegetationCaption;
 368:                      fc.Description = this.FeatureClassVegetationDescription;
 369:   
 370:                      list.Add(fc);
 371:   
 372:   
 373:                      fc = new Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass();
 374:   
 375:                      fc.Id = this.FeatureClassLocalityClassId;
 376:                      fc.Name = this.FeatureClassLocalityName;
 377:                      fc.Caption = this.FeatureClassLocalityCaption;
 378:                      fc.Description = this.FeatureClassLocalityDescription;
 379:   
 380:                      list.Add(fc);
 381:   
 382:   
 383:                      fc = new Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass();
 384:   
 385:                      fc.Id = this.FeatureClassUnderseaClassId;
 386:                      fc.Name = this.FeatureClassUnderseaName;
 387:                      fc.Caption = this.FeatureClassUnderseaCaption;
 388:                      fc.Description = this.FeatureClassUnderseaDescription;
 389:   
 390:                      list.Add(fc);
 391:   
 392:   
 393:                      fc = new Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass();
 394:   
 395:                      fc.Id = this.FeatureClassStreetClassId;
 396:                      fc.Name = this.FeatureClassStreetName;
 397:                      fc.Caption = this.FeatureClassStreetCaption;
 398:                      fc.Description = this.FeatureClassStreetDescription;
 399:   
 400:                      list.Add(fc);
 401:   
 402:   
 403:                      fc = new Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass();
 404:   
 405:                      fc.Id = this.FeatureClassHypsographicClassId;
 406:                      fc.Name = this.FeatureClassHypsographicName;
 407:                      fc.Caption = this.FeatureClassHypsographicCaption;
 408:                      fc.Description = this.FeatureClassHypsographicDescription;
 409:   
 410:                      list.Add(fc);
 411:   
 412:   
 413:                      fc = new Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass();
 414:   
 415:                      fc.Id = this.FeatureClassHydrographicClassId;
 416:                      fc.Name = this.FeatureClassHydrographicName;
 417:                      fc.Caption = this.FeatureClassHydrographicCaption;
 418:                      fc.Description = this.FeatureClassHydrographicDescription;
 419:   
 420:                      list.Add(fc);
 421:   
 422:   
 423:                      fc = new Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass();
 424:   
 425:                      fc.Id = this.FeatureClassSpotClassId;
 426:                      fc.Name = this.FeatureClassSpotName;
 427:                      fc.Caption = this.FeatureClassSpotCaption;
 428:                      fc.Description = this.FeatureClassSpotDescription;
 429:   
 430:                      list.Add(fc);
 431:   
 432:                      return list;
 433:                  }
 434:              }
 435:          }
 436:   
 437:          ////////////////////////////////////////////////////////////////////////////
 438:   
 439:          /// <summary>
 440:          ///
 441:          /// </summary>
 442:          public static List<Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Country> CountryList
 443:          {
 444:              get
 445:              {
 446:                  if (countryList == null || countryList.Count == 0)
 447:                  {
 448:                      if (HttpContext.Current != null && HttpContext.Current.Application["countryList"] != null)
 449:                      {
 450:                          countryList = (List<Country>)HttpContext.Current.Application["countryList"];
 451:                      }
 452:                      else
 453:                      {
 454:                          countryList = Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation._CountryList;
 455:   
 456:                          if (HttpContext.Current != null) HttpContext.Current.Application["countryList"] = countryList;
 457:                      }
 458:                  }
 459:   
 460:                  return countryList;
 461:              }
 462:          }
 463:   
 464:          ////////////////////////////////////////////////////////////////////////////
 465:   
 466:          /// <summary>
 467:          ///
 468:          /// </summary>
 469:          private static List<Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Country> _CountryList
 470:          {
 471:              get
 472:              {
 473:                  if (countryList == null || countryList.Count == 0)
 474:                  {
 475:                      Country country;
 476:   
 477:                      countryList = new List<Country>(100);
 478:   
 479:                      foreach (XElement x in XDocument.Element("applicationInformation").Element("countryList").Elements("country"))
 480:                      {
 481:                          country = new Country();
 482:                          country.Iso2 = x.Attribute("id").Value;
 483:   
 484:                          country.Name = (from c in Ia.Cl.Model.Country.List where c.Iso2 == country.Iso2.ToUpper() select c.Name).SingleOrDefault();
 485:                          country.NameDictionary = (from c in Ia.Cl.Model.Country.List where c.Iso2 == country.Iso2.ToUpper() select c.NameDictionary).SingleOrDefault();
 486:   
 487:                          country.ManifestPackagePrefix = x.Parent.Parent.Element("manifestPackagePrefix").Value;
 488:   
 489:                          country.GoogleMapsDebugApiKey = x.Parent.Parent.Element("googleMapsDebugApiKey").Value;
 490:                          country.GoogleAdMobAdUnitDebugId = x.Parent.Parent.Element("googleAdMobAdUnitDebugId").Value;
 491:   
 492:                          country.ApplicationNameDictionary = ApplicationNameDictionary(x);
 493:   
 494:                          country.WhatsNew = Regex.Replace(x.Parent.Parent.Element("googleStoreWhatsNew").Value.Trim(), @"\n[ ]+", "\n");
 495:   
 496:                          country.VersionName = x.Element("version").Attribute("name").Value;
 497:                          country.CopyrightYear = x.Element("version").Attribute("copyrightYear").Value;
 498:                          country.ManifestPackage = x.Element("manifestPackage").Value;
 499:   
 500:                          country.ApplicationDownloadLink = ReplaceNameVariableWithName(Ia.TentPlay.Cl.Model.Data.CompanyInformation.ApplicationDownloadLink, country);
 501:   
 502:                          country.GoogleMapsProductionApiKey = x.Element("googleMapsProductionApiKey").Value;
 503:                          country.GoogleAdMobAppId = x.Element("googleAdMobAppId").Value;
 504:                          country.GoogleAdMobAdUnitProductionId = x.Element("googleAdMobAdUnitId").Value;
 505:   
 506:                          country.Published = (x.Attribute("published") != null) ? DateTime.Parse(x.Attribute("published").Value) : DateTime.MinValue;
 507:   
 508:                          country.ColorPrimary = (from e in x.Element("colorTheme").Elements("color") where e.Attribute("name").Value == "colorPrimary" select e.Attribute("value").Value).SingleOrDefault();
 509:                          country.ColorPrimaryDark = (from e in x.Element("colorTheme").Elements("color") where e.Attribute("name").Value == "colorPrimaryDark" select e.Attribute("value").Value).SingleOrDefault();
 510:                          country.ColorAccent = (from e in x.Element("colorTheme").Elements("color") where e.Attribute("name").Value == "colorAccent" select e.Attribute("value").Value).SingleOrDefault();
 511:   
 512:                          country.NavigationHeaderImages = ApplicationImageList(x.Element("navigationHeader").Element("imageList"));
 513:   
 514:                          country.Languages = ApplicationLanguageList(country.Iso2, country.ApplicationNameDictionary);
 515:   
 516:                          countryList.Add(country);
 517:                      }
 518:                  }
 519:   
 520:                  return countryList.ToList();
 521:              }
 522:          }
 523:   
 524:          ////////////////////////////////////////////////////////////////////////////
 525:   
 526:          /// <summary>
 527:          ///
 528:          /// </summary>
 529:          public static void CountryStatisticCalcucation(ref Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Country country)
 530:          {
 531:              int featureCount, administrative, populated, vegetation, locality, undersea, street, hypsographic, hydrographic, spot;
 532:              Ia.Cl.Model.Result result;
 533:   
 534:              Ia.TentPlay.Cl.Model.Data.Trek.Feature.Statistic(country.Iso2, out featureCount, out administrative, out populated, out vegetation, out locality, out undersea, out street, out hypsographic, out hydrographic, out spot, out result);
 535:   
 536:              country.FeatureCount = featureCount;
 537:              country.AdministrativeFeatureCount = administrative;
 538:              country.PopulatedFeatureCount = populated;
 539:              country.VegetationFeatureCount = vegetation;
 540:              country.LocalityFeatureCount = locality;
 541:              country.UnderseaFeatureCount = undersea;
 542:              country.StreetFeatureCount = street;
 543:              country.HypsographicFeatureCount = hypsographic;
 544:              country.HydrographicFeatureCount = hydrographic;
 545:              country.SpotFeatureCount = spot;
 546:          }
 547:   
 548:          ////////////////////////////////////////////////////////////////////////////
 549:   
 550:          /// <summary>
 551:          /// 
 552:          /// </summary>
 553:          private static Dictionary<string, string> ApplicationNameDictionary(XElement xElement)
 554:          {
 555:              XElement xe;
 556:              IEnumerable<XAttribute> list;
 557:              Dictionary<string, string> dictionary;
 558:   
 559:              dictionary = new Dictionary<string, string>();
 560:   
 561:              xe = xElement.Element("applicationName");
 562:   
 563:              if (xe.HasAttributes)
 564:              {
 565:                  list = xe.Attributes();
 566:   
 567:                  foreach (XAttribute xa in list)
 568:                  {
 569:                      dictionary.Add(xa.Name.LocalName, xa.Value);
 570:                  }
 571:              }
 572:   
 573:              return dictionary;
 574:          }
 575:   
 576:          ////////////////////////////////////////////////////////////////////////////
 577:   
 578:          /// <summary>
 579:          /// 
 580:          /// </summary>
 581:          private static List<Ia.Cl.Model.Language> ApplicationLanguageList(string fileCountry, Dictionary<string, string> countryApplicationNameDictionary)
 582:          {
 583:              List<Ia.Cl.Model.Language> list, countrySpokenLanguageList, featureDesignationLanguageList;
 584:   
 585:              list = new List<Ia.Cl.Model.Language>();
 586:   
 587:              if (fileCountry == "uk") fileCountry = "gb";
 588:   
 589:              countrySpokenLanguageList = (from c in Ia.Cl.Model.Country.List where c.Iso2 == fileCountry.ToUpper() select c.SpokenLanguageList).SingleOrDefault();
 590:   
 591:              featureDesignationLanguageList = Ia.TentPlay.Cl.Model.Data.Trek.FeatureDesignation.LanguageList;
 592:   
 593:              // make sure to select only languages defined in application title
 594:   
 595:              list = (from c in countrySpokenLanguageList
 596:                      join n in featureDesignationLanguageList on c.Symbol equals n.Symbol
 597:                      join cand in countryApplicationNameDictionary on n.Symbol equals cand.Key
 598:                      select c).ToList();
 599:   
 600:              // below: add English to all language lists for all countries
 601:              if (list.Find(u => u.Symbol == "en") == null) list.Add(Ia.Cl.Model.Language.List.Single(u => u.Symbol == "en"));
 602:   
 603:              return list;
 604:          }
 605:   
 606:          ////////////////////////////////////////////////////////////////////////////
 607:   
 608:          /// <summary>
 609:          /// 
 610:          /// </summary>
 611:          private static List<Image> ApplicationImageList(XElement imageList)
 612:          {
 613:              Image image;
 614:              List<Image> list;
 615:   
 616:              list = new List<Image>();
 617:   
 618:              foreach (XElement x in imageList.Elements("image"))
 619:              {
 620:                  image = new Image();
 621:   
 622:                  // Attribute
 623:                  //image.Caption = x.Attribute("caption").Value;
 624:                  //image.Photographer = x.Attribute("photographer").Value.Replace(" ", "").ToLower();
 625:                  //image.Source = x.Attribute("source").Value.ToLower();
 626:                  image.FileName = x.Attribute("fileName").Value;
 627:                  image.AndroidFileName = x.Attribute("fileName").Value.Replace("-", "_");
 628:   
 629:                  list.Add(image);
 630:              }
 631:   
 632:              return list;
 633:          }
 634:   
 635:          ////////////////////////////////////////////////////////////////////////////
 636:          ////////////////////////////////////////////////////////////////////////////
 637:   
 638:          /// <summary>
 639:          ///
 640:          /// </summary>
 641:          private static List<Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Translation> TranslationList(Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Country country)
 642:          {
 643:              string s;
 644:              Ia.Cl.Model.Result result;
 645:              Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Translation translation;
 646:              List<Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Translation> translationList;
 647:              List<Ia.TentPlay.Cl.Model.Business.Trek.FeatureDesignation> featureDesignationNameAndCountList;
 648:   
 649:              translationList = new List<Translation>(100);
 650:   
 651:              foreach (Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Translation rawTranslation in RawTranslationList)
 652:              {
 653:                  if (country.Languages.Any(u => u.Iso6391 == rawTranslation.Iso6391))
 654:                  {
 655:                      featureDesignationNameAndCountList = Ia.TentPlay.Cl.Model.Data.Trek.Default.FeatureDesignationNameAndCountWithinDatabaseList(country.Iso2, rawTranslation, out result);
 656:   
 657:                      translation = new Translation();
 658:                      translation.CountryIso2 = country.Iso2;
 659:                      translation.Iso6391 = rawTranslation.Iso6391;
 660:   
 661:                      translation.SiteName = rawTranslation.SiteName;
 662:                      translation.CompanyName = rawTranslation.CompanyName;
 663:   
 664:                      translation.About = ReplaceNameVariableWithName(rawTranslation.About, country, translation.Iso6391);
 665:                      translation.AboutTitle = rawTranslation.AboutTitle;
 666:   
 667:                      translation.ShortDescription = ReplaceNameVariableWithName(rawTranslation.ShortDescription, country, translation.Iso6391);
 668:   
 669:                      translation.LongDescription = ReplaceNameVariableWithName(rawTranslation.LongDescription, country, translation.Iso6391);
 670:                      s = Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.BuildRandomDesignationListString(featureDesignationNameAndCountList);
 671:                      translation.LongDescription = translation.LongDescription.Replace("#randomDesignationList", s);
 672:   
 673:                      translation.SearchSearchHint = rawTranslation.SearchSearchHint;
 674:   
 675:                      translation.Statistic = ReplaceNameVariableWithName(rawTranslation.Statistic, country, translation.Iso6391);
 676:                      translation.StatisticTitle = rawTranslation.StatisticTitle;
 677:                      translation.Setting = rawTranslation.Setting;
 678:                      translation.SettingTitle = rawTranslation.SettingTitle;
 679:   
 680:                      translation.ShareTitle = rawTranslation.ShareTitle;
 681:                      translation.ShareApplication = ReplaceNameVariableWithName(rawTranslation.ShareApplication, country, translation.Iso6391);
 682:                      translation.ShareTrek = ReplaceNameVariableWithName(rawTranslation.ShareTrek, country, translation.Iso6391);
 683:                      translation.ShareNoEmailClientInstalled = rawTranslation.ShareNoEmailClientInstalled;
 684:                      translation.ShareContactUs = rawTranslation.ShareContactUs;
 685:   
 686:                      translation.HelpFeedbackTitle = rawTranslation.HelpFeedbackTitle;
 687:                      translation.Help = rawTranslation.Help;
 688:                      translation.HelpTitle = rawTranslation.HelpTitle;
 689:                      translation.HelpMainListOrder = rawTranslation.HelpMainListOrder;
 690:                      translation.HelpGoogleMapRoute = rawTranslation.HelpGoogleMapRoute;
 691:                      translation.HelpGoogleMapMarker = rawTranslation.HelpGoogleMapMarker;
 692:                      translation.HelpMagnifiyingGlass = rawTranslation.HelpMagnifiyingGlass;
 693:                      translation.HelpMapType = rawTranslation.HelpMapType;
 694:                      translation.Feedback = ReplaceNameVariableWithName(rawTranslation.Feedback, country, translation.Iso6391);
 695:                      translation.FeedbackTitle = rawTranslation.FeedbackTitle;
 696:                      translation.FeedbackEmailSubject = rawTranslation.FeedbackEmailSubject;
 697:   
 698:                      translation.Legal = ReplaceNameVariableWithName(rawTranslation.Legal, country, translation.Iso6391);
 699:                      translation.LegalTitle = rawTranslation.LegalTitle;
 700:   
 701:                      translation.FeatureClassName = rawTranslation.FeatureClassName;
 702:                      translation.FeatureClassDescription = rawTranslation.FeatureClassDescription;
 703:   
 704:                      translation.FeatureClassAdministrativeName = rawTranslation.FeatureClassAdministrativeName;
 705:                      translation.FeatureClassAdministrativeCaption = rawTranslation.FeatureClassAdministrativeCaption;
 706:                      translation.FeatureClassAdministrativeClassId = rawTranslation.FeatureClassAdministrativeClassId;
 707:                      translation.FeatureClassAdministrativeDescription = rawTranslation.FeatureClassAdministrativeDescription;
 708:   
 709:                      translation.FeatureClassPopulatedName = rawTranslation.FeatureClassPopulatedName;
 710:                      translation.FeatureClassPopulatedCaption = rawTranslation.FeatureClassPopulatedCaption;
 711:                      translation.FeatureClassPopulatedClassId = rawTranslation.FeatureClassPopulatedClassId;
 712:                      translation.FeatureClassPopulatedDescription = rawTranslation.FeatureClassPopulatedDescription;
 713:   
 714:                      translation.FeatureClassVegetationName = rawTranslation.FeatureClassVegetationName;
 715:                      translation.FeatureClassVegetationCaption = rawTranslation.FeatureClassVegetationCaption;
 716:                      translation.FeatureClassVegetationClassId = rawTranslation.FeatureClassVegetationClassId;
 717:                      translation.FeatureClassVegetationDescription = rawTranslation.FeatureClassVegetationDescription;
 718:   
 719:                      translation.FeatureClassLocalityName = rawTranslation.FeatureClassLocalityName;
 720:                      translation.FeatureClassLocalityCaption = rawTranslation.FeatureClassLocalityCaption;
 721:                      translation.FeatureClassLocalityClassId = rawTranslation.FeatureClassLocalityClassId;
 722:                      translation.FeatureClassLocalityDescription = rawTranslation.FeatureClassLocalityDescription;
 723:   
 724:                      translation.FeatureClassUnderseaName = rawTranslation.FeatureClassUnderseaName;
 725:                      translation.FeatureClassUnderseaCaption = rawTranslation.FeatureClassUnderseaCaption;
 726:                      translation.FeatureClassUnderseaClassId = rawTranslation.FeatureClassUnderseaClassId;
 727:                      translation.FeatureClassUnderseaDescription = rawTranslation.FeatureClassUnderseaDescription;
 728:   
 729:                      translation.FeatureClassStreetName = rawTranslation.FeatureClassStreetName;
 730:                      translation.FeatureClassStreetCaption = rawTranslation.FeatureClassStreetCaption;
 731:                      translation.FeatureClassStreetClassId = rawTranslation.FeatureClassStreetClassId;
 732:                      translation.FeatureClassStreetDescription = rawTranslation.FeatureClassStreetDescription;
 733:   
 734:                      translation.FeatureClassHypsographicName = rawTranslation.FeatureClassHypsographicName;
 735:                      translation.FeatureClassHypsographicCaption = rawTranslation.FeatureClassHypsographicCaption;
 736:                      translation.FeatureClassHypsographicClassId = rawTranslation.FeatureClassHypsographicClassId;
 737:                      translation.FeatureClassHypsographicDescription = rawTranslation.FeatureClassHypsographicDescription;
 738:   
 739:                      translation.FeatureClassHydrographicName = rawTranslation.FeatureClassHydrographicName;
 740:                      translation.FeatureClassHydrographicCaption = rawTranslation.FeatureClassHydrographicCaption;
 741:                      translation.FeatureClassHydrographicClassId = rawTranslation.FeatureClassHydrographicClassId;
 742:                      translation.FeatureClassHydrographicDescription = rawTranslation.FeatureClassHydrographicDescription;
 743:   
 744:                      translation.FeatureClassSpotName = rawTranslation.FeatureClassSpotName;
 745:                      translation.FeatureClassSpotCaption = rawTranslation.FeatureClassSpotCaption;
 746:                      translation.FeatureClassSpotClassId = rawTranslation.FeatureClassSpotClassId;
 747:                      translation.FeatureClassSpotDescription = rawTranslation.FeatureClassSpotDescription;
 748:   
 749:                      translationList.Add(translation);
 750:                  }
 751:              }
 752:   
 753:              return translationList.ToList();
 754:          }
 755:   
 756:          ////////////////////////////////////////////////////////////////////////////
 757:   
 758:          /// <summary>
 759:          /// 
 760:          /// </summary>
 761:          private static string ReplaceNameVariableWithName(string line, Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Country applicationCountry)
 762:          {
 763:              return ReplaceNameVariableWithName(line, applicationCountry, null);
 764:          }
 765:   
 766:          ////////////////////////////////////////////////////////////////////////////
 767:   
 768:          /// <summary>
 769:          /// 
 770:          /// </summary>
 771:          private static string ReplaceNameVariableWithName(string line, Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Country applicationCountry, string iso6391)
 772:          {
 773:              string s;
 774:   
 775:              s = line;
 776:   
 777:              // this must be before $manifestPackage
 778:              s = Replace(s, "$applicationDownloadLink", applicationCountry.ApplicationDownloadLink);
 779:   
 780:              if (!string.IsNullOrEmpty(iso6391))
 781:              {
 782:                  s = Replace(s, "$applicationName", applicationCountry.ApplicationNameDictionary[iso6391]);
 783:                  s = Replace(s, "$countryName", applicationCountry.NameDictionary[iso6391]);
 784:              }
 785:   
 786:              s = Replace(s, "$countryIso2", applicationCountry.Iso2);
 787:              s = Replace(s, "$version", applicationCountry.VersionName);
 788:              s = Replace(s, "$manifestPackagePrefix", applicationCountry.ManifestPackagePrefix);
 789:              s = Replace(s, "$manifestPackage", applicationCountry.ManifestPackage);
 790:              s = Replace(s, "$copyrightYear", applicationCountry.CopyrightYear);
 791:              s = Replace(s, "$featureCount", applicationCountry.FeatureCount.ToString());
 792:   
 793:              s = Replace(s, "$companyName", Ia.TentPlay.Cl.Model.Data.CompanyInformation.CompanyName);
 794:              s = Replace(s, "$companyEmail", Ia.TentPlay.Cl.Model.Data.CompanyInformation.CompanyEmail);
 795:              s = Replace(s, "$companyUrl", Ia.TentPlay.Cl.Model.Data.CompanyInformation.CompanyUrl);
 796:   
 797:              s = Replace(s, "$applicationCompanyName", Ia.TentPlay.Cl.Model.Data.CompanyInformation.ApplicationCompanyName);
 798:              s = Replace(s, "$applicationCompanyEmail", Ia.TentPlay.Cl.Model.Data.CompanyInformation.ApplicationCompanyEmail);
 799:              s = Replace(s, "$applicationCompanyUrl", Ia.TentPlay.Cl.Model.Data.CompanyInformation.ApplicationCompanyUrl);
 800:   
 801:              return s;
 802:          }
 803:   
 804:          ////////////////////////////////////////////////////////////////////////////
 805:   
 806:          /// <summary>
 807:          /// 
 808:          /// </summary>
 809:          private static string Replace(string content, string term, string replacementTerm)
 810:          {
 811:              return content.Replace(term, replacementTerm);
 812:          }
 813:   
 814:          ////////////////////////////////////////////////////////////////////////////
 815:   
 816:          /// <summary>
 817:          /// 
 818:          /// </summary>
 819:          public static string BuildRandomDesignationListString(List<Ia.TentPlay.Cl.Model.Business.Trek.FeatureDesignation> featureDesignationNameAndCountList)
 820:          {
 821:              string s;
 822:   
 823:              s = string.Join(", ", (from f in featureDesignationNameAndCountList where f.Name.Length < 16 select Ia.Cl.Model.Language.Pluralize(f.Name)).PickRandom(19).ToArray());
 824:              s = Ia.Cl.Model.Language.FirstCharacterToUpper(s);
 825:   
 826:              return s;
 827:   
 828:          }
 829:   
 830:          ////////////////////////////////////////////////////////////////////////////
 831:   
 832:          /// <summary>
 833:          ///
 834:          /// </summary>
 835:          public static List<Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Translation> RawTranslationList
 836:          {
 837:              get
 838:              {
 839:                  if (translationList == null || translationList.Count == 0)
 840:                  {
 841:                      if (HttpContext.Current != null && HttpContext.Current.Application["rawTranslationList"] != null)
 842:                      {
 843:                          translationList = (List<Translation>)HttpContext.Current.Application["rawTranslationList"];
 844:                      }
 845:                      else
 846:                      {
 847:                          translationList = Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation._RawTranslationList;
 848:   
 849:                          if (HttpContext.Current != null) HttpContext.Current.Application["rawTranslationList"] = translationList;
 850:                      }
 851:                  }
 852:   
 853:                  return translationList;
 854:              }
 855:          }
 856:   
 857:          ////////////////////////////////////////////////////////////////////////////
 858:   
 859:          /// <summary>
 860:          ///
 861:          /// </summary>
 862:          private static List<Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Translation> _RawTranslationList
 863:          {
 864:              get
 865:              {
 866:                  if (translationList == null || translationList.Count == 0)
 867:                  {
 868:                      Translation translation;
 869:   
 870:                      translationList = new List<Translation>(100);
 871:   
 872:                      foreach (XElement x in XDocument.Element("applicationInformation").Element("translationList").Elements("translation"))
 873:                      {
 874:                          translation = new Translation();
 875:                          translation.Iso6391 = x.Attribute("id").Value;
 876:                          translation.SiteName = x.Element("siteName").Value;
 877:                          translation.CompanyName = x.Element("companyName").Value;
 878:   
 879:                          translation.About = x.Element("about").Value.Trim();
 880:                          translation.AboutTitle = x.Element("about").Attribute("title").Value;
 881:   
 882:                          translation.ShortDescription = Regex.Replace(x.Element("shortDescription").Value.Trim(), @"\n[ ]+", "\n");
 883:                          translation.LongDescription = Regex.Replace(translation.About, @"\n[ ]+", "\n");
 884:   
 885:                          translation.SearchSearchHint = x.Element("search").Attribute("searchHint").Value;
 886:   
 887:                          translation.Statistic = x.Element("statistic").Value.Trim();
 888:                          translation.StatisticTitle = x.Element("statistic").Attribute("title").Value;
 889:                          translation.Setting = x.Element("setting").Value.Trim();
 890:                          translation.SettingTitle = x.Element("setting").Attribute("title").Value;
 891:   
 892:                          translation.ShareTitle = x.Element("share").Attribute("title").Value;
 893:                          translation.ShareApplication = x.Element("share").Element("application").Value.Trim();
 894:                          translation.ShareTrek = x.Element("share").Element("trek").Value.Trim();
 895:                          translation.ShareNoEmailClientInstalled = x.Element("share").Attribute("noEmailClientInstalled").Value;
 896:                          translation.ShareContactUs = x.Element("share").Attribute("contactUs").Value;
 897:   
 898:                          translation.HelpFeedbackTitle = x.Element("help_feedback").Attribute("title").Value;
 899:                          translation.Help = x.Element("help_feedback").Element("help").Value.Trim();
 900:                          translation.HelpTitle = x.Element("help_feedback").Element("help").Attribute("title").Value;
 901:                          translation.HelpMainListOrder = x.Element("help_feedback").Element("help").Attribute("mainListOrder").Value;
 902:                          translation.HelpGoogleMapRoute = x.Element("help_feedback").Element("help").Attribute("googleMapRoute").Value;
 903:                          translation.HelpGoogleMapMarker = x.Element("help_feedback").Element("help").Attribute("googleMapMarker").Value;
 904:                          translation.HelpMagnifiyingGlass = x.Element("help_feedback").Element("help").Attribute("magnifiyingGlass").Value;
 905:                          translation.HelpMapType = x.Element("help_feedback").Element("help").Attribute("mapType").Value;
 906:                          translation.Feedback = x.Element("help_feedback").Element("feedback").Value.Trim();
 907:                          translation.FeedbackTitle = x.Element("help_feedback").Element("feedback").Attribute("title").Value;
 908:                          translation.FeedbackEmailSubject = x.Element("help_feedback").Element("feedback").Attribute("feedbackEmailSubject").Value;
 909:   
 910:                          translation.Legal = x.Element("legal").Value.Trim();
 911:                          translation.LegalTitle = x.Element("legal").Attribute("title").Value;
 912:   
 913:                          translation.FeatureClassName = x.Element("featureClass").Attribute("caption").Value;
 914:                          translation.FeatureClassDescription = x.Element("featureClass").Attribute("description").Value;
 915:   
 916:                          translation.FeatureClassAdministrativeName = x.Element("featureClass").Element("administrative").Attribute("name").Value;
 917:                          translation.FeatureClassAdministrativeCaption = x.Element("featureClass").Element("administrative").Attribute("caption").Value;
 918:                          translation.FeatureClassAdministrativeClassId = x.Element("featureClass").Element("administrative").Attribute("classId").Value;
 919:                          translation.FeatureClassAdministrativeDescription = x.Element("featureClass").Element("administrative").Attribute("description").Value;
 920:   
 921:                          translation.FeatureClassPopulatedName = x.Element("featureClass").Element("populated").Attribute("name").Value;
 922:                          translation.FeatureClassPopulatedCaption = x.Element("featureClass").Element("populated").Attribute("caption").Value;
 923:                          translation.FeatureClassPopulatedClassId = x.Element("featureClass").Element("populated").Attribute("classId").Value;
 924:                          translation.FeatureClassPopulatedDescription = x.Element("featureClass").Element("populated").Attribute("description").Value;
 925:   
 926:                          translation.FeatureClassVegetationName = x.Element("featureClass").Element("vegetation").Attribute("name").Value;
 927:                          translation.FeatureClassVegetationCaption = x.Element("featureClass").Element("vegetation").Attribute("caption").Value;
 928:                          translation.FeatureClassVegetationClassId = x.Element("featureClass").Element("vegetation").Attribute("classId").Value;
 929:                          translation.FeatureClassVegetationDescription = x.Element("featureClass").Element("vegetation").Attribute("description").Value;
 930:   
 931:                          translation.FeatureClassLocalityName = x.Element("featureClass").Element("locality").Attribute("name").Value;
 932:                          translation.FeatureClassLocalityCaption = x.Element("featureClass").Element("locality").Attribute("caption").Value;
 933:                          translation.FeatureClassLocalityClassId = x.Element("featureClass").Element("locality").Attribute("classId").Value;
 934:                          translation.FeatureClassLocalityDescription = x.Element("featureClass").Element("locality").Attribute("description").Value;
 935:   
 936:                          translation.FeatureClassUnderseaName = x.Element("featureClass").Element("undersea").Attribute("name").Value;
 937:                          translation.FeatureClassUnderseaCaption = x.Element("featureClass").Element("undersea").Attribute("caption").Value;
 938:                          translation.FeatureClassUnderseaClassId = x.Element("featureClass").Element("undersea").Attribute("classId").Value;
 939:                          translation.FeatureClassUnderseaDescription = x.Element("featureClass").Element("undersea").Attribute("description").Value;
 940:   
 941:                          translation.FeatureClassStreetName = x.Element("featureClass").Element("street").Attribute("name").Value;
 942:                          translation.FeatureClassStreetCaption = x.Element("featureClass").Element("street").Attribute("caption").Value;
 943:                          translation.FeatureClassStreetClassId = x.Element("featureClass").Element("street").Attribute("classId").Value;
 944:                          translation.FeatureClassStreetDescription = x.Element("featureClass").Element("street").Attribute("description").Value;
 945:   
 946:                          translation.FeatureClassHypsographicName = x.Element("featureClass").Element("hypsography").Attribute("name").Value;
 947:                          translation.FeatureClassHypsographicCaption = x.Element("featureClass").Element("hypsography").Attribute("caption").Value;
 948:                          translation.FeatureClassHypsographicClassId = x.Element("featureClass").Element("hypsography").Attribute("classId").Value;
 949:                          translation.FeatureClassHypsographicDescription = x.Element("featureClass").Element("hypsography").Attribute("description").Value;
 950:   
 951:                          translation.FeatureClassHydrographicName = x.Element("featureClass").Element("hydrographic").Attribute("name").Value;
 952:                          translation.FeatureClassHydrographicCaption = x.Element("featureClass").Element("hydrographic").Attribute("caption").Value;
 953:                          translation.FeatureClassHydrographicClassId = x.Element("featureClass").Element("hydrographic").Attribute("classId").Value;
 954:                          translation.FeatureClassHydrographicDescription = x.Element("featureClass").Element("hydrographic").Attribute("description").Value;
 955:   
 956:                          translation.FeatureClassSpotName = x.Element("featureClass").Element("spot").Attribute("name").Value;
 957:                          translation.FeatureClassSpotCaption = x.Element("featureClass").Element("spot").Attribute("caption").Value;
 958:                          translation.FeatureClassSpotClassId = x.Element("featureClass").Element("spot").Attribute("classId").Value;
 959:                          translation.FeatureClassSpotDescription = x.Element("featureClass").Element("spot").Attribute("description").Value;
 960:   
 961:                          translationList.Add(translation);
 962:                      }
 963:                  }
 964:   
 965:                  return translationList.ToList();
 966:              }
 967:          }
 968:   
 969:          ////////////////////////////////////////////////////////////////////////////
 970:          ////////////////////////////////////////////////////////////////////////////
 971:   
 972:          /// <summary>
 973:          /// 
 974:          /// How to embed and access resources by using Visual C# http://support.microsoft.com/kb/319292/en-us
 975:          /// 
 976:          /// 1. Change the "Build Action" property of your XML file from "Content" to "Embedded Resource".
 977:          /// 2. Add "using System.Reflection".
 978:          /// 3. See sample below.
 979:          /// 
 980:          /// </summary>
 981:   
 982:          private static XDocument XDocument
 983:          {
 984:              get
 985:              {
 986:                  Assembly _assembly;
 987:                  StreamReader streamReader;
 988:   
 989:                  if (xDocument == null)
 990:                  {
 991:                      _assembly = Assembly.GetExecutingAssembly();
 992:                      streamReader = new StreamReader(_assembly.GetManifestResourceStream("Ia.TentPlay.Cl.model.data.trek.application-information.xml"));
 993:   
 994:                      try
 995:                      {
 996:                          if (streamReader.Peek() != -1) xDocument = System.Xml.Linq.XDocument.Load(streamReader);
 997:                      }
 998:                      catch (Exception)
 999:                      {
1000:                      }
1001:                      finally
1002:                      {
1003:                      }
1004:                  }
1005:   
1006:                  return xDocument;
1007:              }
1008:          }
1009:   
1010:          ////////////////////////////////////////////////////////////////////////////
1011:          ////////////////////////////////////////////////////////////////////////////    
1012:      }
1013:  }