public CurrentGasPricesViewModelDT()
        {
            FuelType = FuelTypeEnum.Diesel;
            LocationName = "Leoben";

            QueryResult = new GasQueryResult();
            QueryResult.GasStationResults.Add(new GasStationResult()
            {
                Name = "Fantasy Brand Gas Station",
                Price = 1.28,
                City = "Leoben",
                PostalCode = "8700",
                Street = "Some street 21"
            });
        }
        public async Task NotifyGasQueryResultChanged(GasQueryResult currentResult)
        {
            string tileId = currentResult.UniqueId;
            bool isCurrentlyPinned = SecondaryTile.Exists(tileId);

            if (isCurrentlyPinned)
            {
                string details = String.Format("{0} ({1})", currentResult.Name, currentResult.LastUpdatedFormatted);

                // http://msdn.microsoft.com/en-us/library/windows/apps/hh761491.aspx
                var wideTile = TileContentFactory.CreateTileWideText09();
                wideTile.TextHeading.Text = currentResult.PriceAtCheapestGasStation.ToString();
                wideTile.TextBodyWrap.Text = details;

                var squareTile = TileContentFactory.CreateTileSquareText02();
                squareTile.TextHeading.Text = currentResult.PriceAtCheapestGasStation.ToString();
                squareTile.TextBodyWrap.Text = details;

                wideTile.SquareContent = squareTile;

                TileUpdateManager.CreateTileUpdaterForSecondaryTile(tileId)
                    .Update(wideTile.CreateNotification());
            }
        }
Example #3
0
 public GasQueryResult(GasQueryResult parameterOriginal)
     : this(parameterOriginal, parameterOriginal.GasStationResults.ToList(), parameterOriginal.LastUpdated)
 {
 }
 public GasQueryResult(GasQueryResult parameterOriginal)
     : this(parameterOriginal, parameterOriginal.GasStationResults.ToList(), parameterOriginal.LastUpdated)
 {
 }
        private void SetQueryResultToGeocodeResult(GasQueryResult currentQueryResult)
        {
            if (currentQueryResult != null)
            {
                var result = new GasQueryResult(currentQueryResult);

                if (_geocodeResult != null)
                {
                    result.GeocodeLatitude = _geocodeResult.Latitude;
                    result.GeocodeLongitude = _geocodeResult.Longitude;
                    result.Name = _geocodeResult.Name;
                }

                QueryResult = result;
                return;
            }

            QueryResult = currentQueryResult;
        }
 public void SetViewModelToResult(GasQueryResult item)
 {
     QueryResult = item;
     SendUpdateMapNotification();
 }
        public async Task<bool> AddResultAsync(GasQueryResult result)
        {
            try
            {
                var existingErgebnisse = await LoadResultsAsync();
                existingErgebnisse.Add(result);
                bool saveOk = await SaveResultsAsync(existingErgebnisse);

                return saveOk;
            }
            catch (Exception)
            {
                return false;
            }
        }
        public SampleDataSource()
        {
            var se = new GasQueryResult()
                         {
                             UniqueId = "S1-Leoben-TestData",
                             FuelType = FuelTypeEnum.Diesel,
                             Longitude1 = 15.051175814518464,
                             Latitude1 = 47.36476416660497,
                             Longitude2 = 15.13108418548611,
                             Latitude2 = 47.38801327070198,
                             GeocodeLongitude = 15.093971,
                             GeocodeLatitude = 47.3827604,
                             Name = "Leoben / Steiermark",
                             LastUpdated = default(DateTime)
                         };

            se.GasStationResults.Add(new GasStationResult()
                                               {
                                                   Name = "Beispieldaten: Markentankstelle",
                                                   PostalCode = "8700",
                                                   Price = 0.0f
                                               });

            SuchErgebnisse.Add(se);

            se = new GasQueryResult()
            {
                UniqueId = "S2-Leoben-TestData",
                FuelType = FuelTypeEnum.Super,
                Longitude1 = 15.051175814518464,
                Latitude1 = 47.36476416660497,
                Longitude2 = 15.13108418548611,
                Latitude2 = 47.38801327070198,
                GeocodeLongitude = 15.093971,
                GeocodeLatitude = 47.3827604,
                Name = "Leoben / Steiermark",
                LastUpdated = default(DateTime)
            };

            se.GasStationResults.Add(new GasStationResult()
            {
                Name = "Beispieldaten: Freie Tankstelle",
                PostalCode = "8700",
                Price = 0.0f
            });


            SuchErgebnisse.Add(se);


            _geocodeResults.Add(new GeocodeResult()
                                      {
                                          Name = "Leoben / Austria",
                                          Latitude = 47.3827604,
                                          Longitude = 15.093971
                                      });

            // Fuel Actions
            _fuelTypeActions.Add(new FuelTypeAction()
                                     {
                                         FuelType = FuelTypeEnum.Diesel
                                     });
            _fuelTypeActions.Add(new FuelTypeAction()
                                     {
                                         FuelType = FuelTypeEnum.Super
                                     });

            // Main Page Actions 
            _mainpageActions = MainPageAction.GenerateMainPageActions();
        }