Exemplo n.º 1
0
        private async void RefreshReports()
        {
            if (IsBusy || !IsLoaded)
            {
                return;
            }

            IsBusy = true;
            RefreshCommand.ChangeCanExecute();

            try
            {
                Reports = null;
                var reports = await _reportStorage.GetReports();

                Reports = new List <Report>(reports);
            }
            catch (Exception)
            {
                // ignored
            }
            finally
            {
                IsBusy = false;
                RefreshCommand.ChangeCanExecute();
            }
        }
Exemplo n.º 2
0
        private async void RefreshRules()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;
            RefreshCommand.ChangeCanExecute();

            try
            {
                var rules = await _ruleStorage.GetRules();

                Rules = new ObservableCollection <Rule>(rules);
            }
            catch (Exception)
            {
                // ignored
            }
            finally
            {
                IsBusy = false;
                RefreshCommand.ChangeCanExecute();
            }
        }
Exemplo n.º 3
0
        private async Task UpdateNextRowsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            pageId++;
            IsBusy = true;
            RefreshCommand.ChangeCanExecute();

            string url = Url + "&page=" + pageId;

            ObservableCollection <RowData> rows = await WebManager.LoadItemsAsync(url);

            Rows.RemoveAt(Rows.Count - 1);
            foreach (RowData rowData in rows)
            {
                Rows.Add(rowData);
            }
            Rows = RemoveDuplicateRows(Rows);
            Rows.Add(GetMoreRowData());
            IsBusy = false;
            RefreshCommand.ChangeCanExecute();
        }
Exemplo n.º 4
0
        private async void RefreshSightings()
        {
            if (IsBusy || !IsLoaded)
            {
                return;
            }

            IsBusy = true;
            RefreshCommand.ChangeCanExecute();

            try
            {
                Sightings = null;
                var sightings = await _sightingStorage.Match(DaysFilter, RuleId);

                Sightings = new List <Sighting>(sightings);
            }
            catch (Exception)
            {
                // ignored
            }
            finally
            {
                IsBusy = false;
                RefreshCommand.ChangeCanExecute();
            }
        }
Exemplo n.º 5
0
        private async void RefreshSites()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;
            RefreshCommand.ChangeCanExecute();
            var lastSearch = SearchText;

            try
            {
                var sites = await _siteService.GetSites(lastSearch);

                Sites = new ObservableCollection <Site>(sites);
            }
            finally
            {
                IsBusy = false;
                RefreshCommand.ChangeCanExecute();
            }

            if (lastSearch != SearchText)
            {
                RefreshSites();
            }
        }
        public async void Refresh()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;
            RefreshCommand.ChangeCanExecute();

            if (RefreshDataAction != null)
            {
                RefreshDataAction();
            }

            IsBusy = false;
            RefreshCommand.ChangeCanExecute();
        }
Exemplo n.º 7
0
        // Load the courses from data store.
        private async Task ExecuteLoadCoursesCommand()
        {
            if (IsBusy)
            {
                return;
            }

            //string[] values = new string[] { "Group1", "Group2", "Group3" };
            //var result = values.AsQueryable().Where("it in (\"Group2\")").ToArray();

            IsBusy = true;
            RefreshCommand.ChangeCanExecute();

            //DoStuff
            Courses = await azureService.GetCourses();

            Title = $"Courses ({Courses.Count})";

            IsBusy = false;
            RefreshCommand.ChangeCanExecute();
        }