예제 #1
0
        public TravelTrackingViewModel(
            ILocationInputFactory locationFactory,
            ITheme currentTheme)
        {
            Location = new Location(
                locationFactory,
                currentTheme);

            if (string.IsNullOrEmpty(Location.City))
            {
                return;
            }

            NavigateToWiki = new NavigateToWiki(Location.WikiPageId);

            StartTimeTracking(
                Location.Country,
                Location.City);

            // This needs to happen after the time is set because the local time is used to decide
            // which weather icon to display.
            StartWeatherTracking(
                Location.Country,
                Location.City,
                Location.WeatherAreaCode);
        }
예제 #2
0
        public Location(
            ILocationInputFactory locationFactory,
            ITheme appliedTheme)
        {
#if NDEBUG
            var locationWindowControl = new LocationInputViewModel(appliedTheme)
            {
                LocationInputFields = new LocationInputFields(() => { })
                {
                    CityInput    = "Paris",
                    CountryInput = "France"
                }
            };
#else
            var locationWindowControl = locationFactory.Generate(appliedTheme);
            if (locationWindowControl == null)
            {
                return;
            }
#endif

            Country = locationWindowControl.LocationInputFields.CountryInput;
            City    = locationWindowControl.LocationInputFields.CityInput;

            WikiPageId      = locationWindowControl.WikiPageId;
            WeatherAreaCode = locationWindowControl.WeatherAreaCode;
        }