Ejemplo n.º 1
0
        public InspectionsIndex()
        {
            this.InitializeComponent();

            inspectionsIndexViewModel = new InspectionsIndexViewModel();

            if (NetworkController.HasInternet())
            {
                PageHelper.DoAsync(overlay, Dispatcher, () =>
                {
                    inspectionsIndexViewModel.LoadAllInspections();
                    inspectionsIndexViewModel.inspections.ForEach(i => i.LoadInspectionByPK(i.Id));
                    this.saveOffline();

                    PageHelper.MainUI(Dispatcher, () =>
                    {
                        this.DataGrid.DataContext = this.inspectionsIndexViewModel.inspections;
                    });
                });
            }
            else
            {
                this.loadFromFile();
            }
        }
Ejemplo n.º 2
0
        private async void loadFromFile()
        {
            var offlineController = new OfflineController();
            var data = await offlineController.GetOfflineData <InspectionsIndexViewModel>("Inspections");

            this.inspectionsIndexViewModel = data.value;

            PageHelper.MainUI(Dispatcher, () =>
            {
                this.DataGrid.DataContext = this.inspectionsIndexViewModel.inspections;
            });
        }