شركة التطبيقات المتكاملة لتصميم النظم البرمجية الخاصة ش.ش.و.

Integrated Applications Programming Company

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:   
  60:              /// <summary/>
  61:              public string Name { get; set; }
  62:   
  63:              /// <summary/>
  64:              public Dictionary<string, string> NameDictionary { get; set; }
  65:   
  66:              /// <summary/>
  67:              public string ManifestPackagePrefix { get; set; }
  68:   
  69:              /// <summary/>
  70:              public Dictionary<string, string> ApplicationNameDictionary { get; set; }
  71:   
  72:              /// <summary/>
  73:              public string WhatsNew { get; set; }
  74:   
  75:              /// <summary/>
  76:              public string VersionName { get; set; }
  77:   
  78:              /// <summary/>
  79:              public string CopyrightYear { get; set; }
  80:   
  81:              /// <summary/>
  82:              public string ManifestPackage { get; set; }
  83:   
  84:              /// <summary/>
  85:              public string ApplicationUrl { get; set; }
  86:   
  87:              /// <summary/>
  88:              public string GoogleMapsDebugApiKey { get; set; }
  89:   
  90:              /// <summary/>
  91:              public string GoogleMapsProductionApiKey { get; set; }
  92:   
  93:              /// <summary/>
  94:              public string GoogleAdMobAdUnitDebugId { get; set; }
  95:   
  96:              /// <summary/>
  97:              public string GoogleAdMobAppId { get; set; }
  98:   
  99:              /// <summary/>
 100:              public string GoogleAdMobAdUnitProductionId { get; set; }
 101:   
 102:              /// <summary/>
 103:              public DateTime Published { get; set; }
 104:   
 105:              /// <summary/>
 106:              public int FeatureCount { get; set; }
 107:   
 108:              /// <summary/>
 109:              public int AdministrativeFeatureCount { get; set; }
 110:   
 111:              /// <summary/>
 112:              public int PopulatedFeatureCount { get; set; }
 113:   
 114:              /// <summary/>
 115:              public int VegetationFeatureCount { get; set; }
 116:   
 117:              /// <summary/>
 118:              public int LocalityFeatureCount { get; set; }
 119:   
 120:              /// <summary/>
 121:              public int UnderseaFeatureCount { get; set; }
 122:   
 123:              /// <summary/>
 124:              public int StreetFeatureCount { get; set; }
 125:   
 126:              /// <summary/>
 127:              public int HypsographicFeatureCount { get; set; }
 128:   
 129:              /// <summary/>
 130:              public int HydrographicFeatureCount { get; set; }
 131:   
 132:              /// <summary/>
 133:              public int SpotFeatureCount { get; set; }
 134:   
 135:              /// <summary/>
 136:              public string ColorPrimary { get; set; }
 137:   
 138:              /// <summary/>
 139:              public string ColorPrimaryDark { get; set; }
 140:   
 141:              /// <summary/>
 142:              public string ColorAccent { get; set; }
 143:   
 144:              /// <summary/>
 145:              public bool LanguageListMatchesTranslationList
 146:              {
 147:                  get
 148:                  {
 149:                      bool b;
 150:   
 151:                      if (Languages != null && Translations != null)
 152:                      {
 153:                          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;
 154:                      }
 155:                      else b = false;
 156:   
 157:                      return b;
 158:                  }
 159:              }
 160:   
 161:              /// <summary/>
 162:              public virtual List<Image> NavigationHeaderImages { get; set; }
 163:   
 164:              /// <summary/>
 165:              public virtual List<Ia.Cl.Model.Language> Languages { get; set; }
 166:   
 167:              /// <summary/>
 168:              public virtual ICollection<Translation> Translations
 169:              {
 170:                  get
 171:                  {
 172:                      if (translationList == null || translationList.Count == 0)
 173:                      {
 174:                          translationList = TranslationList(this);
 175:                      }
 176:   
 177:                      return translationList;
 178:                  }
 179:              }
 180:   
 181:              ////////////////////////////////////////////////////////////////////////////
 182:   
 183:              /// <summary>
 184:              ///
 185:              /// </summary>
 186:              public string FeatureGraphicImageUrl
 187:              {
 188:                  get
 189:                  {
 190:                      return "https://cdn.tentplay.com/trek/country/" + this.Iso2 + @"/images/feature-graphic.png";
 191:                  }
 192:              }
 193:   
 194:              ////////////////////////////////////////////////////////////////////////////
 195:   
 196:              /// <summary>
 197:              ///
 198:              /// </summary>
 199:              public string PromoGraphicImageUrl
 200:              {
 201:                  get
 202:                  {
 203:                      return "https://cdn.tentplay.com/trek/country/" + this.Iso2 + @"/images/promo-graphic.png";
 204:                  }
 205:              }
 206:   
 207:              ////////////////////////////////////////////////////////////////////////////
 208:   
 209:              /// <summary>
 210:              ///
 211:              /// </summary>
 212:              public string HiResIconImageUrl
 213:              {
 214:                  get
 215:                  {
 216:                      return "https://cdn.tentplay.com/trek/country/" + this.Iso2 + @"/images/hi-res-icon.png";
 217:                  }
 218:              }
 219:   
 220:              ////////////////////////////////////////////////////////////////////////////
 221:              ////////////////////////////////////////////////////////////////////////////
 222:   
 223:              /// <summary>
 224:              ///
 225:              /// </summary>
 226:              public string MipMapLdpiIcLauncherImage
 227:              {
 228:                  get
 229:                  {
 230:                      return MipMapXIcLauncherImage("ldpi");
 231:                  }
 232:              }
 233:   
 234:              ////////////////////////////////////////////////////////////////////////////
 235:   
 236:              /// <summary>
 237:              ///
 238:              /// </summary>
 239:              public string MipMapMdpiIcLauncherImage
 240:              {
 241:                  get
 242:                  {
 243:                      return MipMapXIcLauncherImage("mdpi");
 244:                  }
 245:              }
 246:   
 247:              ////////////////////////////////////////////////////////////////////////////
 248:   
 249:              /// <summary>
 250:              ///
 251:              /// </summary>
 252:              public string MipMapHdpiIcLauncherImage
 253:              {
 254:                  get
 255:                  {
 256:                      return MipMapXIcLauncherImage("hdpi");
 257:                  }
 258:              }
 259:   
 260:              ////////////////////////////////////////////////////////////////////////////
 261:   
 262:              /// <summary>
 263:              ///
 264:              /// </summary>
 265:              public string MipMapXhdpiIcLauncherImage
 266:              {
 267:                  get
 268:                  {
 269:                      return MipMapXIcLauncherImage("xhdpi");
 270:                  }
 271:              }
 272:   
 273:              ////////////////////////////////////////////////////////////////////////////
 274:   
 275:              /// <summary>
 276:              ///
 277:              /// </summary>
 278:              public string MipMapXxhdpiIcLauncherImage
 279:              {
 280:                  get
 281:                  {
 282:                      return MipMapXIcLauncherImage("xxhdpi");
 283:                  }
 284:              }
 285:   
 286:              ////////////////////////////////////////////////////////////////////////////
 287:   
 288:              /// <summary>
 289:              ///
 290:              /// </summary>
 291:              public string MipMapXxxhdpiIcLauncherImage
 292:              {
 293:                  get
 294:                  {
 295:                      return MipMapXIcLauncherImage("xxxhdpi");
 296:                  }
 297:              }
 298:   
 299:              ////////////////////////////////////////////////////////////////////////////
 300:   
 301:              /// <summary>
 302:              ///
 303:              /// </summary>
 304:              public string MipMapXIcLauncherImage(string x)
 305:              {
 306:                  return "https://cdn.tentplay.com/trek/country/" + this.Iso2 + @"/images/mipmap-" + x + "/ic_launcher.png";
 307:              }
 308:   
 309:              ////////////////////////////////////////////////////////////////////////////
 310:              ////////////////////////////////////////////////////////////////////////////
 311:   
 312:              /// <summary>
 313:              ///
 314:              /// </summary>
 315:              public string MipMapLdpiSplashScreenImage
 316:              {
 317:                  get
 318:                  {
 319:                      return MipMapXSplashScreenImage("ldpi");
 320:                  }
 321:              }
 322:   
 323:              ////////////////////////////////////////////////////////////////////////////
 324:   
 325:              /// <summary>
 326:              ///
 327:              /// </summary>
 328:              public string MipMapMdpiSplashScreenImage
 329:              {
 330:                  get
 331:                  {
 332:                      return MipMapXSplashScreenImage("mdpi");
 333:                  }
 334:              }
 335:   
 336:              ////////////////////////////////////////////////////////////////////////////
 337:   
 338:              /// <summary>
 339:              ///
 340:              /// </summary>
 341:              public string MipMapHdpiSplashScreenImage
 342:              {
 343:                  get
 344:                  {
 345:                      return MipMapXSplashScreenImage("hdpi");
 346:                  }
 347:              }
 348:   
 349:              ////////////////////////////////////////////////////////////////////////////
 350:   
 351:              /// <summary>
 352:              ///
 353:              /// </summary>
 354:              public string MipMapXhdpiSplashScreenImage
 355:              {
 356:                  get
 357:                  {
 358:                      return MipMapXSplashScreenImage("xhdpi");
 359:                  }
 360:              }
 361:   
 362:              ////////////////////////////////////////////////////////////////////////////
 363:   
 364:              /// <summary>
 365:              ///
 366:              /// </summary>
 367:              public string MipMapXxhdpiSplashScreenImage
 368:              {
 369:                  get
 370:                  {
 371:                      return MipMapXSplashScreenImage("xxhdpi");
 372:                  }
 373:              }
 374:   
 375:              ////////////////////////////////////////////////////////////////////////////
 376:   
 377:              /// <summary>
 378:              ///
 379:              /// </summary>
 380:              public string MipMapXxxhdpiSplashScreenImage
 381:              {
 382:                  get
 383:                  {
 384:                      return MipMapXSplashScreenImage("xxxhdpi");
 385:                  }
 386:              }
 387:   
 388:              ////////////////////////////////////////////////////////////////////////////
 389:   
 390:              /// <summary>
 391:              ///
 392:              /// </summary>
 393:              public string MipMapXSplashScreenImage(string x)
 394:              {
 395:                  return "https://cdn.tentplay.com/trek/country/" + this.Iso2 + @"/images/mipmap-" + x + "/splash_screen.png";
 396:              }
 397:   
 398:              ////////////////////////////////////////////////////////////////////////////    
 399:              ////////////////////////////////////////////////////////////////////////////
 400:   
 401:              /// <summary>
 402:              ///
 403:              /// </summary>
 404:              public string StoreListingSampleScreenCapture1Image
 405:              {
 406:                  get
 407:                  {
 408:                      return StoreListingSampleScreenCaptureXImage(1);
 409:                  }
 410:              }
 411:   
 412:              ////////////////////////////////////////////////////////////////////////////
 413:   
 414:              /// <summary>
 415:              ///
 416:              /// </summary>
 417:              public string StoreListingSampleScreenCapture2Image
 418:              {
 419:                  get
 420:                  {
 421:                      return StoreListingSampleScreenCaptureXImage(2);
 422:                  }
 423:              }
 424:   
 425:              ////////////////////////////////////////////////////////////////////////////
 426:   
 427:              /// <summary>
 428:              ///
 429:              /// </summary>
 430:              public string StoreListingSampleScreenCapture3Image
 431:              {
 432:                  get
 433:                  {
 434:                      return StoreListingSampleScreenCaptureXImage(3);
 435:                  }
 436:              }
 437:   
 438:              ////////////////////////////////////////////////////////////////////////////
 439:   
 440:              /// <summary>
 441:              ///
 442:              /// </summary>
 443:              public string StoreListingSampleScreenCapture4Image
 444:              {
 445:                  get
 446:                  {
 447:                      return StoreListingSampleScreenCaptureXImage(4);
 448:                  }
 449:              }
 450:   
 451:              ////////////////////////////////////////////////////////////////////////////
 452:   
 453:              /// <summary>
 454:              ///
 455:              /// </summary>
 456:              public string StoreListingSampleScreenCapture5Image
 457:              {
 458:                  get
 459:                  {
 460:                      return StoreListingSampleScreenCaptureXImage(5);
 461:                  }
 462:              }
 463:   
 464:              ////////////////////////////////////////////////////////////////////////////
 465:   
 466:              /// <summary>
 467:              ///
 468:              /// </summary>
 469:              public string StoreListingSampleScreenCapture6Image
 470:              {
 471:                  get
 472:                  {
 473:                      return StoreListingSampleScreenCaptureXImage(6);
 474:                  }
 475:              }
 476:   
 477:              ////////////////////////////////////////////////////////////////////////////
 478:   
 479:              /// <summary>
 480:              ///
 481:              /// </summary>
 482:              public string StoreListingSampleScreenCapture7Image
 483:              {
 484:                  get
 485:                  {
 486:                      return StoreListingSampleScreenCaptureXImage(7);
 487:                  }
 488:              }
 489:   
 490:              ////////////////////////////////////////////////////////////////////////////
 491:   
 492:              /// <summary>
 493:              ///
 494:              /// </summary>
 495:              public string StoreListingSampleScreenCapture8Image
 496:              {
 497:                  get
 498:                  {
 499:                      return StoreListingSampleScreenCaptureXImage(8);
 500:                  }
 501:              }
 502:   
 503:              ////////////////////////////////////////////////////////////////////////////
 504:   
 505:              /// <summary>
 506:              ///
 507:              /// </summary>
 508:              public string StoreListingSampleScreenCaptureXImage(int i)
 509:              {
 510:                  return "https://cdn.tentplay.com/trek/country/" + this.Iso2 + @"/images/" + i + ".png";
 511:              }
 512:   
 513:              ////////////////////////////////////////////////////////////////////////////    
 514:              ////////////////////////////////////////////////////////////////////////////    
 515:          }
 516:   
 517:          ////////////////////////////////////////////////////////////////////////////    
 518:   
 519:          public class Image
 520:          {
 521:              /// <summary/>
 522:              //public string Caption { get; set; }
 523:   
 524:              /// <summary/>
 525:              //public string Photographer { get; set; }
 526:   
 527:              /// <summary/>
 528:              //public string Source { get; set; }
 529:   
 530:              /// <summary/>
 531:              public string AndroidFileName { get; set; }
 532:   
 533:              /// <summary/>
 534:              public string FileName { get; set; }
 535:          }
 536:   
 537:          ////////////////////////////////////////////////////////////////////////////    
 538:   
 539:          public class Translation
 540:          {
 541:              /// <summary/>
 542:              public Translation() { }
 543:   
 544:              /// <summary/>
 545:              public string CountryIso2 { get; set; }
 546:              /// <summary/>
 547:              public string Iso6391 { get; set; }
 548:              /// <summary/>
 549:              public string SiteName { get; set; }
 550:              /// <summary/>
 551:              public string CompanyName { get; set; }
 552:              /// <summary/>
 553:              public string ShortDescription { get; set; }
 554:              /// <summary/>
 555:              public string LongDescription { get; set; }
 556:   
 557:              /// <summary/>
 558:              public string About { get; set; }
 559:              /// <summary/>
 560:              public string AboutTitle { get; set; }
 561:              /// <summary/>
 562:              public string SearchSearchHint { get; set; }
 563:              /// <summary/>
 564:              public string Statistic { get; set; }
 565:              /// <summary/>
 566:              public string StatisticTitle { get; set; }
 567:              /// <summary/>
 568:              public string Setting { get; set; }
 569:              /// <summary/>
 570:              public string SettingTitle { get; set; }
 571:   
 572:              /// <summary/>
 573:              public string ShareTitle { get; set; }
 574:              /// <summary/>
 575:              public string ShareApplication { get; set; }
 576:              /// <summary/>
 577:              public string ShareTrek { get; set; }
 578:              /// <summary/>
 579:              public string ShareNoEmailClientInstalled { get; set; }
 580:              /// <summary/>
 581:              public string ShareContactUs { get; set; }
 582:   
 583:              /// <summary/>
 584:              public string HelpFeedbackTitle { get; set; }
 585:              /// <summary/>
 586:              public string Help { get; set; }
 587:              /// <summary/>
 588:              public string HelpTitle { get; set; }
 589:              /// <summary/>
 590:              public string HelpMagnifiyingGlass { get; set; }
 591:              /// <summary/>
 592:              public string HelpMainListOrder { get; set; }
 593:              /// <summary/>
 594:              public string HelpMapType { get; set; }
 595:              /// <summary/>
 596:              public string HelpGoogleMapRoute { get; set; }
 597:              /// <summary/>
 598:              public string HelpGoogleMapMarker { get; set; }
 599:              /// <summary/>
 600:              public string Feedback { get; set; }
 601:              /// <summary/>
 602:              public string FeedbackTitle { get; set; }
 603:              /// <summary/>
 604:              public string FeedbackEmailSubject { get; set; }
 605:   
 606:              /// <summary/>
 607:              public string Legal { get; set; }
 608:              /// <summary/>
 609:              public string LegalTitle { get; set; }
 610:              /// <summary/>
 611:              public string FeatureClassName { get; set; }
 612:              /// <summary/>
 613:              public string FeatureClassCaption { get; set; }
 614:              /// <summary/>
 615:              public string FeatureClassDescription { get; set; }
 616:              /// <summary/>
 617:              public string FeatureClassAdministrativeName { get; set; }
 618:              /// <summary/>
 619:              public string FeatureClassAdministrativeCaption { get; set; }
 620:              /// <summary/>
 621:              public string FeatureClassAdministrativeClassId { get; set; }
 622:              /// <summary/>
 623:              public string FeatureClassAdministrativeDescription { get; set; }
 624:              /// <summary/>
 625:              public string FeatureClassPopulatedName { get; set; }
 626:              /// <summary/>
 627:              public string FeatureClassPopulatedCaption { get; set; }
 628:              /// <summary/>
 629:              public string FeatureClassPopulatedClassId { get; set; }
 630:              /// <summary/>
 631:              public string FeatureClassPopulatedDescription { get; set; }
 632:              /// <summary/>
 633:              public string FeatureClassVegetationName { get; set; }
 634:              /// <summary/>
 635:              public string FeatureClassVegetationCaption { get; set; }
 636:              /// <summary/>
 637:              public string FeatureClassVegetationClassId { get; set; }
 638:              /// <summary/>
 639:              public string FeatureClassVegetationDescription { get; set; }
 640:              /// <summary/>
 641:              public string FeatureClassLocalityName { get; set; }
 642:              /// <summary/>
 643:              public string FeatureClassLocalityCaption { get; set; }
 644:              /// <summary/>
 645:              public string FeatureClassLocalityClassId { get; set; }
 646:              /// <summary/>
 647:              public string FeatureClassLocalityDescription { get; set; }
 648:              /// <summary/>
 649:              public string FeatureClassUnderseaName { get; set; }
 650:              /// <summary/>
 651:              public string FeatureClassUnderseaCaption { get; set; }
 652:              /// <summary/>
 653:              public string FeatureClassUnderseaClassId { get; set; }
 654:              /// <summary/>
 655:              public string FeatureClassUnderseaDescription { get; set; }
 656:              /// <summary/>
 657:              public string FeatureClassStreetName { get; set; }
 658:              /// <summary/>
 659:              public string FeatureClassStreetCaption { get; set; }
 660:              /// <summary/>
 661:              public string FeatureClassStreetClassId { get; set; }
 662:              /// <summary/>
 663:              public string FeatureClassStreetDescription { get; set; }
 664:              /// <summary/>
 665:              public string FeatureClassHypsographicName { get; set; }
 666:              /// <summary/>
 667:              public string FeatureClassHypsographicCaption { get; set; }
 668:              /// <summary/>
 669:              public string FeatureClassHypsographicClassId { get; set; }
 670:              /// <summary/>
 671:              public string FeatureClassHypsographicDescription { get; set; }
 672:              /// <summary/>
 673:              public string FeatureClassHydrographicName { get; set; }
 674:              /// <summary/>
 675:              public string FeatureClassHydrographicCaption { get; set; }
 676:              /// <summary/>
 677:              public string FeatureClassHydrographicClassId { get; set; }
 678:              /// <summary/>
 679:              public string FeatureClassHydrographicDescription { get; set; }
 680:              /// <summary/>
 681:              public string FeatureClassSpotName { get; set; }
 682:              /// <summary/>
 683:              public string FeatureClassSpotCaption { get; set; }
 684:              /// <summary/>
 685:              public string FeatureClassSpotClassId { get; set; }
 686:              /// <summary/>
 687:              public string FeatureClassSpotDescription { get; set; }
 688:              /// <summary/>
 689:              public virtual ICollection<Country> Countries
 690:              {
 691:                  get
 692:                  {
 693:                      return (from c in CountryList where c.Languages.Any(u => u.Iso6391 == this.Iso6391) select c).ToList();
 694:                  }
 695:              }
 696:              /// <summary/>
 697:              public List<Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass> FeatureClassList
 698:              {
 699:                  get
 700:                  {
 701:                      Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass fc;
 702:                      List<Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass> list;
 703:   
 704:                      list = new List<Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass>();
 705:   
 706:                      fc = new Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass();
 707:   
 708:                      fc.Id = this.FeatureClassAdministrativeClassId;
 709:                      fc.Name = this.FeatureClassAdministrativeName;
 710:                      fc.Caption = this.FeatureClassAdministrativeCaption;
 711:                      fc.Description = this.FeatureClassAdministrativeDescription;
 712:   
 713:                      list.Add(fc);
 714:   
 715:   
 716:                      fc = new Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass();
 717:   
 718:                      fc.Id = this.FeatureClassPopulatedClassId;
 719:                      fc.Name = this.FeatureClassPopulatedName;
 720:                      fc.Caption = this.FeatureClassPopulatedCaption;
 721:                      fc.Description = this.FeatureClassPopulatedDescription;
 722:   
 723:                      list.Add(fc);
 724:   
 725:   
 726:                      fc = new Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass();
 727:   
 728:                      fc.Id = this.FeatureClassVegetationClassId;
 729:                      fc.Name = this.FeatureClassVegetationName;
 730:                      fc.Caption = this.FeatureClassVegetationCaption;
 731:                      fc.Description = this.FeatureClassVegetationDescription;
 732:   
 733:                      list.Add(fc);
 734:   
 735:   
 736:                      fc = new Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass();
 737:   
 738:                      fc.Id = this.FeatureClassLocalityClassId;
 739:                      fc.Name = this.FeatureClassLocalityName;
 740:                      fc.Caption = this.FeatureClassLocalityCaption;
 741:                      fc.Description = this.FeatureClassLocalityDescription;
 742:   
 743:                      list.Add(fc);
 744:   
 745:   
 746:                      fc = new Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass();
 747:   
 748:                      fc.Id = this.FeatureClassUnderseaClassId;
 749:                      fc.Name = this.FeatureClassUnderseaName;
 750:                      fc.Caption = this.FeatureClassUnderseaCaption;
 751:                      fc.Description = this.FeatureClassUnderseaDescription;
 752:   
 753:                      list.Add(fc);
 754:   
 755:   
 756:                      fc = new Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass();
 757:   
 758:                      fc.Id = this.FeatureClassStreetClassId;
 759:                      fc.Name = this.FeatureClassStreetName;
 760:                      fc.Caption = this.FeatureClassStreetCaption;
 761:                      fc.Description = this.FeatureClassStreetDescription;
 762:   
 763:                      list.Add(fc);
 764:   
 765:   
 766:                      fc = new Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass();
 767:   
 768:                      fc.Id = this.FeatureClassHypsographicClassId;
 769:                      fc.Name = this.FeatureClassHypsographicName;
 770:                      fc.Caption = this.FeatureClassHypsographicCaption;
 771:                      fc.Description = this.FeatureClassHypsographicDescription;
 772:   
 773:                      list.Add(fc);
 774:   
 775:   
 776:                      fc = new Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass();
 777:   
 778:                      fc.Id = this.FeatureClassHydrographicClassId;
 779:                      fc.Name = this.FeatureClassHydrographicName;
 780:                      fc.Caption = this.FeatureClassHydrographicCaption;
 781:                      fc.Description = this.FeatureClassHydrographicDescription;
 782:   
 783:                      list.Add(fc);
 784:   
 785:   
 786:                      fc = new Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass();
 787:   
 788:                      fc.Id = this.FeatureClassSpotClassId;
 789:                      fc.Name = this.FeatureClassSpotName;
 790:                      fc.Caption = this.FeatureClassSpotCaption;
 791:                      fc.Description = this.FeatureClassSpotDescription;
 792:   
 793:                      list.Add(fc);
 794:   
 795:                      return list;
 796:                  }
 797:              }
 798:          }
 799:   
 800:          ////////////////////////////////////////////////////////////////////////////
 801:   
 802:          /// <summary>
 803:          ///
 804:          /// </summary>
 805:          public static List<Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Country> CountryList
 806:          {
 807:              get
 808:              {
 809:                  if (countryList == null || countryList.Count == 0)
 810:                  {
 811:                      if (HttpContext.Current != null && HttpContext.Current.Application["countryList"] != null)
 812:                      {
 813:                          countryList = (List<Country>)HttpContext.Current.Application["countryList"];
 814:                      }
 815:                      else
 816:                      {
 817:                          countryList = Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation._CountryList;
 818:   
 819:                          if (HttpContext.Current != null) HttpContext.Current.Application["countryList"] = countryList;
 820:                      }
 821:                  }
 822:   
 823:                  return countryList;
 824:              }
 825:          }
 826:   
 827:          ////////////////////////////////////////////////////////////////////////////
 828:   
 829:          /// <summary>
 830:          ///
 831:          /// </summary>
 832:          private static List<Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Country> _CountryList
 833:          {
 834:              get
 835:              {
 836:                  if (countryList == null || countryList.Count == 0)
 837:                  {
 838:                      Country country;
 839:   
 840:                      countryList = new List<Country>(100);
 841:   
 842:                      foreach (XElement x in XDocument.Element("applicationInformation").Element("countryList").Elements("country"))
 843:                      {
 844:                          country = new Country();
 845:                          country.Iso2 = x.Attribute("id").Value;
 846:   
 847:                          country.Name = (from c in Ia.Cl.Model.Country.List where c.Iso2 == country.Iso2.ToUpper() select c.Name).SingleOrDefault();
 848:                          country.NameDictionary = (from c in Ia.Cl.Model.Country.List where c.Iso2 == country.Iso2.ToUpper() select c.NameDictionary).SingleOrDefault();
 849:   
 850:                          country.ManifestPackagePrefix = x.Parent.Parent.Element("manifestPackagePrefix").Value;
 851:   
 852:                          country.GoogleMapsDebugApiKey = x.Parent.Parent.Element("googleMapsDebugApiKey").Value;
 853:                          country.GoogleAdMobAdUnitDebugId = x.Parent.Parent.Element("googleAdMobAdUnitDebugId").Value;
 854:   
 855:                          country.ApplicationNameDictionary = ApplicationNameDictionary(x);
 856:   
 857:                          country.WhatsNew = Regex.Replace(x.Parent.Parent.Element("googleStoreWhatsNew").Value.Trim(), @"\n[ ]+", "\n");
 858:   
 859:                          country.VersionName = x.Element("version").Attribute("name").Value;
 860:                          country.CopyrightYear = x.Element("version").Attribute("copyrightYear").Value;
 861:                          country.ManifestPackage = x.Element("manifestPackage").Value;
 862:   
 863:                          country.ApplicationUrl = ReplaceNameVariableWithName(Ia.TentPlay.Cl.Model.Data.CompanyInformation.ApplicationDownloadLink, country);
 864:   
 865:                          country.GoogleMapsProductionApiKey = x.Element("googleMapsProductionApiKey").Value;
 866:                          country.GoogleAdMobAppId = x.Element("googleAdMobAppId").Value;
 867:                          country.GoogleAdMobAdUnitProductionId = x.Element("googleAdMobAdUnitId").Value;
 868:   
 869:                          country.Published = (x.Element("version").Attribute("published") != null && x.Element("version").Attribute("published").Value != string.Empty) ? DateTime.Parse(x.Element("version").Attribute("published").Value) : DateTime.MinValue;
 870:   
 871:                          country.ColorPrimary = (from e in x.Element("colorTheme").Elements("color") where e.Attribute("name").Value == "colorPrimary" select e.Attribute("value").Value).SingleOrDefault();
 872:                          country.ColorPrimaryDark = (from e in x.Element("colorTheme").Elements("color") where e.Attribute("name").Value == "colorPrimaryDark" select e.Attribute("value").Value).SingleOrDefault();
 873:                          country.ColorAccent = (from e in x.Element("colorTheme").Elements("color") where e.Attribute("name").Value == "colorAccent" select e.Attribute("value").Value).SingleOrDefault();
 874:   
 875:                          country.NavigationHeaderImages = ApplicationImageList(x.Element("navigationHeader").Element("imageList"));
 876:   
 877:                          country.Languages = ApplicationLanguageList(country.Iso2, country.ApplicationNameDictionary);
 878:   
 879:                          countryList.Add(country);
 880:                      }
 881:                  }
 882:   
 883:                  return countryList.ToList();
 884:              }
 885:          }
 886:   
 887:          ////////////////////////////////////////////////////////////////////////////
 888:   
 889:          /// <summary>
 890:          ///
 891:          /// </summary>
 892:          public static void CountryStatisticCalcucation(ref Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Country country)
 893:          {
 894:              int featureCount, administrative, populated, vegetation, locality, undersea, street, hypsographic, hydrographic, spot;
 895:              Ia.Cl.Model.Result result;
 896:   
 897:              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);
 898:   
 899:              country.FeatureCount = featureCount;
 900:              country.AdministrativeFeatureCount = administrative;
 901:              country.PopulatedFeatureCount = populated;
 902:              country.VegetationFeatureCount = vegetation;
 903:              country.LocalityFeatureCount = locality;
 904:              country.UnderseaFeatureCount = undersea;
 905:              country.StreetFeatureCount = street;
 906:              country.HypsographicFeatureCount = hypsographic;
 907:              country.HydrographicFeatureCount = hydrographic;
 908:              country.SpotFeatureCount = spot;
 909:          }
 910:   
 911:          ////////////////////////////////////////////////////////////////////////////
 912:   
 913:          /// <summary>
 914:          /// 
 915:          /// </summary>
 916:          private static Dictionary<string, string> ApplicationNameDictionary(XElement xElement)
 917:          {
 918:              XElement xe;
 919:              IEnumerable<XAttribute> list;
 920:              Dictionary<string, string> dictionary;
 921:   
 922:              dictionary = new Dictionary<string, string>();
 923:   
 924:              xe = xElement.Element("applicationName");
 925:   
 926:              if (xe.HasAttributes)
 927:              {
 928:                  list = xe.Attributes();
 929:   
 930:                  foreach (XAttribute xa in list)
 931:                  {
 932:                      dictionary.Add(xa.Name.LocalName, xa.Value);
 933:                  }
 934:              }
 935:   
 936:              return dictionary;
 937:          }
 938:   
 939:          ////////////////////////////////////////////////////////////////////////////
 940:   
 941:          /// <summary>
 942:          /// 
 943:          /// </summary>
 944:          private static List<Ia.Cl.Model.Language> ApplicationLanguageList(string fileCountry, Dictionary<string, string> countryApplicationNameDictionary)
 945:          {
 946:              List<Ia.Cl.Model.Language> list, countrySpokenLanguageList, featureDesignationLanguageList;
 947:   
 948:              list = new List<Ia.Cl.Model.Language>();
 949:   
 950:              if (fileCountry == "uk") fileCountry = "gb";
 951:   
 952:              countrySpokenLanguageList = (from c in Ia.Cl.Model.Country.List where c.Iso2 == fileCountry.ToUpper() select c.SpokenLanguageList).SingleOrDefault();
 953:   
 954:              featureDesignationLanguageList = Ia.TentPlay.Cl.Model.Data.Trek.FeatureDesignation.LanguageList;
 955:   
 956:              // make sure to select only languages defined in application title
 957:   
 958:              list = (from c in countrySpokenLanguageList
 959:                      join n in featureDesignationLanguageList on c.Symbol equals n.Symbol
 960:                      join cand in countryApplicationNameDictionary on n.Symbol equals cand.Key
 961:                      select c).ToList();
 962:   
 963:              // below: add English to all language lists for all countries
 964:              if (list.Find(u => u.Symbol == "en") == null) list.Add(Ia.Cl.Model.Language.List.Single(u => u.Symbol == "en"));
 965:   
 966:              return list;
 967:          }
 968:   
 969:          ////////////////////////////////////////////////////////////////////////////
 970:   
 971:          /// <summary>
 972:          /// 
 973:          /// </summary>
 974:          private static List<Image> ApplicationImageList(XElement imageList)
 975:          {
 976:              Image image;
 977:              List<Image> list;
 978:   
 979:              list = new List<Image>();
 980:   
 981:              foreach (XElement x in imageList.Elements("image"))
 982:              {
 983:                  image = new Image();
 984:   
 985:                  // Attribute
 986:                  //image.Caption = x.Attribute("caption").Value;
 987:                  //image.Photographer = x.Attribute("photographer").Value.Replace(" ", "").ToLower();
 988:                  //image.Source = x.Attribute("source").Value.ToLower();
 989:                  image.FileName = x.Attribute("fileName").Value;
 990:                  image.AndroidFileName = x.Attribute("fileName").Value.Replace("-", "_");
 991:   
 992:                  list.Add(image);
 993:              }
 994:   
 995:              return list;
 996:          }
 997:   
 998:          ////////////////////////////////////////////////////////////////////////////
 999:          ////////////////////////////////////////////////////////////////////////////
1000:   
1001:          /// <summary>
1002:          ///
1003:          /// </summary>
1004:          private static List<Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Translation> TranslationList(Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Country country)
1005:          {
1006:              string s;
1007:              Ia.Cl.Model.Result result;
1008:              Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Translation translation;
1009:              List<Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Translation> translationList;
1010:              List<Ia.TentPlay.Cl.Model.Business.Trek.FeatureDesignation> featureDesignationNameAndCountList;
1011:   
1012:              translationList = new List<Translation>(100);
1013:   
1014:              foreach (Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Translation rawTranslation in RawTranslationList)
1015:              {
1016:                  if (country.Languages.Any(u => u.Iso6391 == rawTranslation.Iso6391))
1017:                  {
1018:                      featureDesignationNameAndCountList = Ia.TentPlay.Cl.Model.Data.Trek.Default.FeatureDesignationNameAndCountWithinDatabaseList(country.Iso2, rawTranslation, out result);
1019:   
1020:                      translation = new Translation();
1021:                      translation.CountryIso2 = country.Iso2;
1022:                      translation.Iso6391 = rawTranslation.Iso6391;
1023:   
1024:                      translation.SiteName = rawTranslation.SiteName;
1025:                      translation.CompanyName = rawTranslation.CompanyName;
1026:   
1027:                      translation.About = ReplaceNameVariableWithName(rawTranslation.About, country, translation.Iso6391);
1028:                      translation.AboutTitle = rawTranslation.AboutTitle;
1029:   
1030:                      translation.ShortDescription = ReplaceNameVariableWithName(rawTranslation.ShortDescription, country, translation.Iso6391);
1031:   
1032:                      translation.LongDescription = ReplaceNameVariableWithName(rawTranslation.LongDescription, country, translation.Iso6391);
1033:                      s = Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.BuildRandomDesignationListString(featureDesignationNameAndCountList);
1034:                      translation.LongDescription = translation.LongDescription.Replace("#randomDesignationList", s);
1035:   
1036:                      translation.SearchSearchHint = rawTranslation.SearchSearchHint;
1037:   
1038:                      translation.Statistic = ReplaceNameVariableWithName(rawTranslation.Statistic, country, translation.Iso6391);
1039:                      translation.StatisticTitle = rawTranslation.StatisticTitle;
1040:                      translation.Setting = rawTranslation.Setting;
1041:                      translation.SettingTitle = rawTranslation.SettingTitle;
1042:   
1043:                      translation.ShareTitle = rawTranslation.ShareTitle;
1044:                      translation.ShareApplication = ReplaceNameVariableWithName(rawTranslation.ShareApplication, country, translation.Iso6391);
1045:                      translation.ShareTrek = ReplaceNameVariableWithName(rawTranslation.ShareTrek, country, translation.Iso6391);
1046:                      translation.ShareNoEmailClientInstalled = rawTranslation.ShareNoEmailClientInstalled;
1047:                      translation.ShareContactUs = rawTranslation.ShareContactUs;
1048:   
1049:                      translation.HelpFeedbackTitle = rawTranslation.HelpFeedbackTitle;
1050:                      translation.Help = rawTranslation.Help;
1051:                      translation.HelpTitle = rawTranslation.HelpTitle;
1052:                      translation.HelpMainListOrder = rawTranslation.HelpMainListOrder;
1053:                      translation.HelpGoogleMapRoute = rawTranslation.HelpGoogleMapRoute;
1054:                      translation.HelpGoogleMapMarker = rawTranslation.HelpGoogleMapMarker;
1055:                      translation.HelpMagnifiyingGlass = rawTranslation.HelpMagnifiyingGlass;
1056:                      translation.HelpMapType = rawTranslation.HelpMapType;
1057:                      translation.Feedback = ReplaceNameVariableWithName(rawTranslation.Feedback, country, translation.Iso6391);
1058:                      translation.FeedbackTitle = rawTranslation.FeedbackTitle;
1059:                      translation.FeedbackEmailSubject = rawTranslation.FeedbackEmailSubject;
1060:   
1061:                      translation.Legal = ReplaceNameVariableWithName(rawTranslation.Legal, country, translation.Iso6391);
1062:                      translation.LegalTitle = rawTranslation.LegalTitle;
1063:   
1064:                      translation.FeatureClassName = rawTranslation.FeatureClassName;
1065:                      translation.FeatureClassDescription = rawTranslation.FeatureClassDescription;
1066:   
1067:                      translation.FeatureClassAdministrativeName = rawTranslation.FeatureClassAdministrativeName;
1068:                      translation.FeatureClassAdministrativeCaption = rawTranslation.FeatureClassAdministrativeCaption;
1069:                      translation.FeatureClassAdministrativeClassId = rawTranslation.FeatureClassAdministrativeClassId;
1070:                      translation.FeatureClassAdministrativeDescription = rawTranslation.FeatureClassAdministrativeDescription;
1071:   
1072:                      translation.FeatureClassPopulatedName = rawTranslation.FeatureClassPopulatedName;
1073:                      translation.FeatureClassPopulatedCaption = rawTranslation.FeatureClassPopulatedCaption;
1074:                      translation.FeatureClassPopulatedClassId = rawTranslation.FeatureClassPopulatedClassId;
1075:                      translation.FeatureClassPopulatedDescription = rawTranslation.FeatureClassPopulatedDescription;
1076:   
1077:                      translation.FeatureClassVegetationName = rawTranslation.FeatureClassVegetationName;
1078:                      translation.FeatureClassVegetationCaption = rawTranslation.FeatureClassVegetationCaption;
1079:                      translation.FeatureClassVegetationClassId = rawTranslation.FeatureClassVegetationClassId;
1080:                      translation.FeatureClassVegetationDescription = rawTranslation.FeatureClassVegetationDescription;
1081:   
1082:                      translation.FeatureClassLocalityName = rawTranslation.FeatureClassLocalityName;
1083:                      translation.FeatureClassLocalityCaption = rawTranslation.FeatureClassLocalityCaption;
1084:                      translation.FeatureClassLocalityClassId = rawTranslation.FeatureClassLocalityClassId;
1085:                      translation.FeatureClassLocalityDescription = rawTranslation.FeatureClassLocalityDescription;
1086:   
1087:                      translation.FeatureClassUnderseaName = rawTranslation.FeatureClassUnderseaName;
1088:                      translation.FeatureClassUnderseaCaption = rawTranslation.FeatureClassUnderseaCaption;
1089:                      translation.FeatureClassUnderseaClassId = rawTranslation.FeatureClassUnderseaClassId;
1090:                      translation.FeatureClassUnderseaDescription = rawTranslation.FeatureClassUnderseaDescription;
1091:   
1092:                      translation.FeatureClassStreetName = rawTranslation.FeatureClassStreetName;
1093:                      translation.FeatureClassStreetCaption = rawTranslation.FeatureClassStreetCaption;
1094:                      translation.FeatureClassStreetClassId = rawTranslation.FeatureClassStreetClassId;
1095:                      translation.FeatureClassStreetDescription = rawTranslation.FeatureClassStreetDescription;
1096:   
1097:                      translation.FeatureClassHypsographicName = rawTranslation.FeatureClassHypsographicName;
1098:                      translation.FeatureClassHypsographicCaption = rawTranslation.FeatureClassHypsographicCaption;
1099:                      translation.FeatureClassHypsographicClassId = rawTranslation.FeatureClassHypsographicClassId;
1100:                      translation.FeatureClassHypsographicDescription = rawTranslation.FeatureClassHypsographicDescription;
1101:   
1102:                      translation.FeatureClassHydrographicName = rawTranslation.FeatureClassHydrographicName;
1103:                      translation.FeatureClassHydrographicCaption = rawTranslation.FeatureClassHydrographicCaption;
1104:                      translation.FeatureClassHydrographicClassId = rawTranslation.FeatureClassHydrographicClassId;
1105:                      translation.FeatureClassHydrographicDescription = rawTranslation.FeatureClassHydrographicDescription;
1106:   
1107:                      translation.FeatureClassSpotName = rawTranslation.FeatureClassSpotName;
1108:                      translation.FeatureClassSpotCaption = rawTranslation.FeatureClassSpotCaption;
1109:                      translation.FeatureClassSpotClassId = rawTranslation.FeatureClassSpotClassId;
1110:                      translation.FeatureClassSpotDescription = rawTranslation.FeatureClassSpotDescription;
1111:   
1112:                      translationList.Add(translation);
1113:                  }
1114:              }
1115:   
1116:              return translationList.ToList();
1117:          }
1118:   
1119:          ////////////////////////////////////////////////////////////////////////////
1120:   
1121:          /// <summary>
1122:          /// 
1123:          /// </summary>
1124:          private static string ReplaceNameVariableWithName(string line, Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Country applicationCountry)
1125:          {
1126:              return ReplaceNameVariableWithName(line, applicationCountry, null);
1127:          }
1128:   
1129:          ////////////////////////////////////////////////////////////////////////////
1130:   
1131:          /// <summary>
1132:          /// 
1133:          /// </summary>
1134:          private static string ReplaceNameVariableWithName(string line, Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Country applicationCountry, string iso6391)
1135:          {
1136:              string s;
1137:   
1138:              s = line;
1139:   
1140:              // this must be before $manifestPackage
1141:              s = Replace(s, "$applicationUrl", applicationCountry.ApplicationUrl);
1142:   
1143:              if (!string.IsNullOrEmpty(iso6391))
1144:              {
1145:                  s = Replace(s, "$applicationName", applicationCountry.ApplicationNameDictionary[iso6391]);
1146:                  s = Replace(s, "$countryName", applicationCountry.NameDictionary[iso6391]);
1147:              }
1148:   
1149:              s = Replace(s, "$countryIso2", applicationCountry.Iso2);
1150:              s = Replace(s, "$version", applicationCountry.VersionName);
1151:              s = Replace(s, "$manifestPackagePrefix", applicationCountry.ManifestPackagePrefix);
1152:              s = Replace(s, "$manifestPackage", applicationCountry.ManifestPackage);
1153:              s = Replace(s, "$copyrightYear", applicationCountry.CopyrightYear);
1154:              s = Replace(s, "$featureCount", applicationCountry.FeatureCount.ToString());
1155:   
1156:              s = Replace(s, "$companyName", Ia.TentPlay.Cl.Model.Data.CompanyInformation.CompanyName);
1157:              s = Replace(s, "$companyEmail", Ia.TentPlay.Cl.Model.Data.CompanyInformation.CompanyEmail);
1158:              s = Replace(s, "$companyUrl", Ia.TentPlay.Cl.Model.Data.CompanyInformation.CompanyUrl);
1159:   
1160:              s = Replace(s, "$applicationCompanyName", Ia.TentPlay.Cl.Model.Data.CompanyInformation.ApplicationCompanyName);
1161:              s = Replace(s, "$applicationCompanyEmail", Ia.TentPlay.Cl.Model.Data.CompanyInformation.ApplicationCompanyEmail);
1162:              s = Replace(s, "$applicationCompanyUrl", Ia.TentPlay.Cl.Model.Data.CompanyInformation.ApplicationCompanyUrl);
1163:   
1164:              return s;
1165:          }
1166:   
1167:          ////////////////////////////////////////////////////////////////////////////
1168:   
1169:          /// <summary>
1170:          /// 
1171:          /// </summary>
1172:          private static string Replace(string content, string term, string replacementTerm)
1173:          {
1174:              return content.Replace(term, replacementTerm);
1175:          }
1176:   
1177:          ////////////////////////////////////////////////////////////////////////////
1178:   
1179:          /// <summary>
1180:          /// 
1181:          /// </summary>
1182:          public static string BuildRandomDesignationListString(List<Ia.TentPlay.Cl.Model.Business.Trek.FeatureDesignation> featureDesignationNameAndCountList)
1183:          {
1184:              string s;
1185:   
1186:              s = string.Join(", ", (from f in featureDesignationNameAndCountList where f.Name.Length < 16 select Ia.Cl.Model.Language.Pluralize(f.Name)).PickRandom(19).ToArray());
1187:              s = Ia.Cl.Model.Language.FirstCharacterToUpper(s);
1188:   
1189:              return s;
1190:   
1191:          }
1192:   
1193:          ////////////////////////////////////////////////////////////////////////////
1194:   
1195:          /// <summary>
1196:          ///
1197:          /// </summary>
1198:          public static List<Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Translation> RawTranslationList
1199:          {
1200:              get
1201:              {
1202:                  if (translationList == null || translationList.Count == 0)
1203:                  {
1204:                      if (HttpContext.Current != null && HttpContext.Current.Application["rawTranslationList"] != null)
1205:                      {
1206:                          translationList = (List<Translation>)HttpContext.Current.Application["rawTranslationList"];
1207:                      }
1208:                      else
1209:                      {
1210:                          translationList = Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation._RawTranslationList;
1211:   
1212:                          if (HttpContext.Current != null) HttpContext.Current.Application["rawTranslationList"] = translationList;
1213:                      }
1214:                  }
1215:   
1216:                  return translationList;
1217:              }
1218:          }
1219:   
1220:          ////////////////////////////////////////////////////////////////////////////
1221:   
1222:          /// <summary>
1223:          ///
1224:          /// </summary>
1225:          private static List<Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Translation> _RawTranslationList
1226:          {
1227:              get
1228:              {
1229:                  if (translationList == null || translationList.Count == 0)
1230:                  {
1231:                      Translation translation;
1232:   
1233:                      translationList = new List<Translation>(100);
1234:   
1235:                      foreach (XElement x in XDocument.Element("applicationInformation").Element("translationList").Elements("translation"))
1236:                      {
1237:                          translation = new Translation();
1238:                          translation.Iso6391 = x.Attribute("id").Value;
1239:                          translation.SiteName = x.Element("siteName").Value;
1240:                          translation.CompanyName = x.Element("companyName").Value;
1241:   
1242:                          translation.About = x.Element("about").Value.Trim();
1243:                          translation.AboutTitle = x.Element("about").Attribute("title").Value;
1244:   
1245:                          translation.ShortDescription = Regex.Replace(x.Element("shortDescription").Value.Trim(), @"\n[ ]+", "\n");
1246:                          translation.LongDescription = Regex.Replace(translation.About, @"\n[ ]+", "\n");
1247:   
1248:                          translation.SearchSearchHint = x.Element("search").Attribute("searchHint").Value;
1249:   
1250:                          translation.Statistic = x.Element("statistic").Value.Trim();
1251:                          translation.StatisticTitle = x.Element("statistic").Attribute("title").Value;
1252:                          translation.Setting = x.Element("setting").Value.Trim();
1253:                          translation.SettingTitle = x.Element("setting").Attribute("title").Value;
1254:   
1255:                          translation.ShareTitle = x.Element("share").Attribute("title").Value;
1256:                          translation.ShareApplication = x.Element("share").Element("application").Value.Trim();
1257:                          translation.ShareTrek = x.Element("share").Element("trek").Value.Trim();
1258:                          translation.ShareNoEmailClientInstalled = x.Element("share").Attribute("noEmailClientInstalled").Value;
1259:                          translation.ShareContactUs = x.Element("share").Attribute("contactUs").Value;
1260:   
1261:                          translation.HelpFeedbackTitle = x.Element("help_feedback").Attribute("title").Value;
1262:                          translation.Help = x.Element("help_feedback").Element("help").Value.Trim();
1263:                          translation.HelpTitle = x.Element("help_feedback").Element("help").Attribute("title").Value;
1264:                          translation.HelpMainListOrder = x.Element("help_feedback").Element("help").Attribute("mainListOrder").Value;
1265:                          translation.HelpGoogleMapRoute = x.Element("help_feedback").Element("help").Attribute("googleMapRoute").Value;
1266:                          translation.HelpGoogleMapMarker = x.Element("help_feedback").Element("help").Attribute("googleMapMarker").Value;
1267:                          translation.HelpMagnifiyingGlass = x.Element("help_feedback").Element("help").Attribute("magnifiyingGlass").Value;
1268:                          translation.HelpMapType = x.Element("help_feedback").Element("help").Attribute("mapType").Value;
1269:                          translation.Feedback = x.Element("help_feedback").Element("feedback").Value.Trim();
1270:                          translation.FeedbackTitle = x.Element("help_feedback").Element("feedback").Attribute("title").Value;
1271:                          translation.FeedbackEmailSubject = x.Element("help_feedback").Element("feedback").Attribute("feedbackEmailSubject").Value;
1272:   
1273:                          translation.Legal = x.Element("legal").Value.Trim();
1274:                          translation.LegalTitle = x.Element("legal").Attribute("title").Value;
1275:   
1276:                          translation.FeatureClassName = x.Element("featureClass").Attribute("caption").Value;
1277:                          translation.FeatureClassDescription = x.Element("featureClass").Attribute("description").Value;
1278:   
1279:                          translation.FeatureClassAdministrativeName = x.Element("featureClass").Element("administrative").Attribute("name").Value;
1280:                          translation.FeatureClassAdministrativeCaption = x.Element("featureClass").Element("administrative").Attribute("caption").Value;
1281:                          translation.FeatureClassAdministrativeClassId = x.Element("featureClass").Element("administrative").Attribute("classId").Value;
1282:                          translation.FeatureClassAdministrativeDescription = x.Element("featureClass").Element("administrative").Attribute("description").Value;
1283:   
1284:                          translation.FeatureClassPopulatedName = x.Element("featureClass").Element("populated").Attribute("name").Value;
1285:                          translation.FeatureClassPopulatedCaption = x.Element("featureClass").Element("populated").Attribute("caption").Value;
1286:                          translation.FeatureClassPopulatedClassId = x.Element("featureClass").Element("populated").Attribute("classId").Value;
1287:                          translation.FeatureClassPopulatedDescription = x.Element("featureClass").Element("populated").Attribute("description").Value;
1288:   
1289:                          translation.FeatureClassVegetationName = x.Element("featureClass").Element("vegetation").Attribute("name").Value;
1290:                          translation.FeatureClassVegetationCaption = x.Element("featureClass").Element("vegetation").Attribute("caption").Value;
1291:                          translation.FeatureClassVegetationClassId = x.Element("featureClass").Element("vegetation").Attribute("classId").Value;
1292:                          translation.FeatureClassVegetationDescription = x.Element("featureClass").Element("vegetation").Attribute("description").Value;
1293:   
1294:                          translation.FeatureClassLocalityName = x.Element("featureClass").Element("locality").Attribute("name").Value;
1295:                          translation.FeatureClassLocalityCaption = x.Element("featureClass").Element("locality").Attribute("caption").Value;
1296:                          translation.FeatureClassLocalityClassId = x.Element("featureClass").Element("locality").Attribute("classId").Value;
1297:                          translation.FeatureClassLocalityDescription = x.Element("featureClass").Element("locality").Attribute("description").Value;
1298:   
1299:                          translation.FeatureClassUnderseaName = x.Element("featureClass").Element("undersea").Attribute("name").Value;
1300:                          translation.FeatureClassUnderseaCaption = x.Element("featureClass").Element("undersea").Attribute("caption").Value;
1301:                          translation.FeatureClassUnderseaClassId = x.Element("featureClass").Element("undersea").Attribute("classId").Value;
1302:                          translation.FeatureClassUnderseaDescription = x.Element("featureClass").Element("undersea").Attribute("description").Value;
1303:   
1304:                          translation.FeatureClassStreetName = x.Element("featureClass").Element("street").Attribute("name").Value;
1305:                          translation.FeatureClassStreetCaption = x.Element("featureClass").Element("street").Attribute("caption").Value;
1306:                          translation.FeatureClassStreetClassId = x.Element("featureClass").Element("street").Attribute("classId").Value;
1307:                          translation.FeatureClassStreetDescription = x.Element("featureClass").Element("street").Attribute("description").Value;
1308:   
1309:                          translation.FeatureClassHypsographicName = x.Element("featureClass").Element("hypsography").Attribute("name").Value;
1310:                          translation.FeatureClassHypsographicCaption = x.Element("featureClass").Element("hypsography").Attribute("caption").Value;
1311:                          translation.FeatureClassHypsographicClassId = x.Element("featureClass").Element("hypsography").Attribute("classId").Value;
1312:                          translation.FeatureClassHypsographicDescription = x.Element("featureClass").Element("hypsography").Attribute("description").Value;
1313:   
1314:                          translation.FeatureClassHydrographicName = x.Element("featureClass").Element("hydrographic").Attribute("name").Value;
1315:                          translation.FeatureClassHydrographicCaption = x.Element("featureClass").Element("hydrographic").Attribute("caption").Value;
1316:                          translation.FeatureClassHydrographicClassId = x.Element("featureClass").Element("hydrographic").Attribute("classId").Value;
1317:                          translation.FeatureClassHydrographicDescription = x.Element("featureClass").Element("hydrographic").Attribute("description").Value;
1318:   
1319:                          translation.FeatureClassSpotName = x.Element("featureClass").Element("spot").Attribute("name").Value;
1320:                          translation.FeatureClassSpotCaption = x.Element("featureClass").Element("spot").Attribute("caption").Value;
1321:                          translation.FeatureClassSpotClassId = x.Element("featureClass").Element("spot").Attribute("classId").Value;
1322:                          translation.FeatureClassSpotDescription = x.Element("featureClass").Element("spot").Attribute("description").Value;
1323:   
1324:                          translationList.Add(translation);
1325:                      }
1326:                  }
1327:   
1328:                  return translationList.ToList();
1329:              }
1330:          }
1331:   
1332:          ////////////////////////////////////////////////////////////////////////////
1333:          ////////////////////////////////////////////////////////////////////////////
1334:   
1335:          /// <summary>
1336:          /// 
1337:          /// How to embed and access resources by using Visual C# http://support.microsoft.com/kb/319292/en-us
1338:          /// 
1339:          /// 1. Change the "Build Action" property of your XML file from "Content" to "Embedded Resource".
1340:          /// 2. Add "using System.Reflection".
1341:          /// 3. See sample below.
1342:          /// 
1343:          /// </summary>
1344:   
1345:          private static XDocument XDocument
1346:          {
1347:              get
1348:              {
1349:                  Assembly _assembly;
1350:                  StreamReader streamReader;
1351:   
1352:                  if (xDocument == null)
1353:                  {
1354:                      _assembly = Assembly.GetExecutingAssembly();
1355:                      streamReader = new StreamReader(_assembly.GetManifestResourceStream("Ia.TentPlay.Cl.model.data.trek.application-information.xml"));
1356:   
1357:                      try
1358:                      {
1359:                          if (streamReader.Peek() != -1) xDocument = System.Xml.Linq.XDocument.Load(streamReader);
1360:                      }
1361:                      catch (Exception)
1362:                      {
1363:                      }
1364:                      finally
1365:                      {
1366:                      }
1367:                  }
1368:   
1369:                  return xDocument;
1370:              }
1371:          }
1372:   
1373:          ////////////////////////////////////////////////////////////////////////////
1374:          ////////////////////////////////////////////////////////////////////////////    
1375:      }
1376:  }