Exemplo n.º 1
0
        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"));
            }
        }
        protected async override void OnAppearing()
        {
            base.OnAppearing();

            Loading(true);
            AlbumListView.ItemsSource = await BlobStorageService.GetBlobList();

            Loading(false);
        }
Exemplo n.º 3
0
        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"));
            }
        }
Exemplo n.º 4
0
        public async Task <ActionResult> DeleteAllImages()
        {
            try
            {
                var list = await BlobStorageService.GetBlobList(BlobStorageService.PicturesContainerName);

                foreach (var image in list)
                {
                    await BlobStorageService.DeleteBlockBlob(BlobStorageService.PicturesContainerName, image);
                }

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                ViewData["message"] = ex.Message;
                ViewData["trace"]   = ex.StackTrace;
                return(View("Error"));
            }
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Index()
        {
            try
            {
                var availableData = await BlobStorageService.GetBlobList(BlobStorageService.DataContainerName);

                var model = new SettingsViewModel();
                model.Connections           = Program.Connections;
                model.AvailableData         = availableData;
                model.AvailableDataPackages = Program.AvailablePackages;
                ViewBag.Context             = "Settings";
                return(View(model));
            }
            catch (Exception ex)
            {
                ViewData["message"] = ex.Message;
                ViewData["trace"]   = ex.StackTrace;
                return(View("Error"));
            }
        }
Exemplo n.º 6
0
        public async Task <ActionResult> DeleteAllDataPackages()
        {
            try
            {
                var list = await BlobStorageService.GetBlobList(BlobStorageService.DataContainerName);

                foreach (var data in list)
                {
                    await BlobStorageService.DeleteBlockBlob(BlobStorageService.DataContainerName, data);
                }

                Program.CurrentData = null;
                Program.AvailablePackages.Clear();
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                ViewData["message"] = ex.Message;
                ViewData["trace"]   = ex.StackTrace;
                return(View("Error"));
            }
        }