public async Task <IActionResult> RefreshDataPackage(string packageName) { try { var dataPackage = Program.AvailablePackages.FirstOrDefault(x => x.PackageName == packageName); if (dataPackage != null) { var newDataPackage = new TelemetryPackage() { PackageName = packageName, PackageData = await BlobStorageService.GetData(BlobStorageService.DataContainerName, packageName) }; Program.AvailablePackages.Remove(dataPackage); Program.AvailablePackages.Add(newDataPackage); } return(RedirectToAction("Index")); } catch (Exception ex) { ViewData["message"] = ex.Message; ViewData["trace"] = ex.StackTrace; return(View("Error")); } }
public async Task <string> LoadData(string blobName) { try { var dataPackage = Program.AvailablePackages.FirstOrDefault(x => x.PackageName == blobName); if (dataPackage == null) { Program.CurrentData = new TelemetryPackage() { PackageName = blobName, PackageData = await BlobStorageService.GetData(BlobStorageService.DataContainerName, blobName) }; Program.AvailablePackages.Add(Program.CurrentData); } else { Program.CurrentData = dataPackage; } return(JsonConvert.SerializeObject(Program.CurrentData.PackageData)); } catch (Exception ex) { return($"Error: {ex.Message}"); } }
public async Task <IActionResult> Index() { try { var availableData = await BlobStorageService.GetBlobList(BlobStorageService.DataContainerName); if (Program.CurrentData == null) { Program.CurrentData = new TelemetryPackage() { PackageName = availableData.LastOrDefault(), PackageData = await BlobStorageService.GetData(BlobStorageService.DataContainerName, availableData.LastOrDefault()) }; Program.AvailablePackages.Add(Program.CurrentData); } var model = new DashboardViewModel(); model.AvailableData = availableData; model.CurrentData = Program.CurrentData.PackageData; ViewBag.Context = "Home"; return(View(model)); } catch (Exception ex) { ViewData["message"] = ex.Message; ViewData["trace"] = ex.StackTrace; return(View("Error")); } }
public async Task <IActionResult> Index() { try { if (Program.CurrentData == null) { var availableData = await BlobStorageService.GetBlobList(BlobStorageService.DataContainerName); Program.CurrentData = new TelemetryPackage() { PackageName = availableData.LastOrDefault(), PackageData = await BlobStorageService.GetData(BlobStorageService.DataContainerName, availableData.LastOrDefault()) }; Program.AvailablePackages.Add(Program.CurrentData); } var list = new List <Position>(); foreach (var data in Program.CurrentData.PackageData) { if (data.GpsLatitude != 0 && data.GpsLongitude != 0) { list.Add(new Position(data.GpsLatitude, data.GpsLongitude, data.GpsAltitude)); } } var model = new MapViewModel(); if (list != null && list.Count > 0) { model.Points = list; model.LastKnownPosition = list.LastOrDefault(); } ViewBag.Context = "Map"; return(View(model)); } catch (Exception ex) { ViewData["message"] = ex.Message; ViewData["trace"] = ex.StackTrace; return(View("Error")); } }
public async Task <IActionResult> LoadDataPackage(string packageName) { try { var dataPackage = new TelemetryPackage() { PackageName = packageName, PackageData = await BlobStorageService.GetData(BlobStorageService.DataContainerName, packageName) }; Program.AvailablePackages.Add(dataPackage); return(RedirectToAction("Index")); } catch (Exception ex) { ViewData["message"] = ex.Message; ViewData["trace"] = ex.StackTrace; return(View("Error")); } }