public override async void ViewDidLoad()
        {
            base.ViewDidLoad();

            AutomaticallyAdjustsScrollViewInsets = false; // NOTE: for iOS7+
            var tableView = new UITableView(View.Bounds);

            tableView.ContentInset   = new UIEdgeInsets(64, 0, 0, 0);
            tableView.SeparatorInset = new UIEdgeInsets(0, 20, 0, 0);
            ShowLoadingOverlay();
            try
            {
                var timesheets = await TimesheetService.GetTimesheetEntries();

                tableView.Source = new OutstandingTimesheetsSource(NavigationController, timesheets);
            }
            catch (Exception ex)
            {
                var okAlertController = UIAlertController.Create("Error", ex.Message, UIAlertControllerStyle.Alert);
                okAlertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null));
                PresentViewController(okAlertController, true, null);
            }
            LoadingOverlay.Hide();
            View.AddSubview(tableView);
        }
Beispiel #2
0
        protected async override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.OutstandingTimesheets);
            listView            = FindViewById <ListView>(Resource.Id.List);
            listView.ItemClick += OnListViewRowClick;
            var progress = CreateProgressDialog();

            progress.Show();
            try
            {
                adapter          = new OutstandingTimesheetsAdapter(this, (await TimesheetService.GetTimesheetEntries()).ToList());
                listView.Adapter = adapter;
            }
            catch
            {
                CreateExceptionDialog();
            }
            progress.Hide();
        }
Beispiel #3
0
        protected async Task ExecuteLoadItemsCommand()
        {
            if (IsLoading)
            {
                return;
            }
            IsLoading = true;
            try
            {
                Timesheets.Clear();
                var timesheets = await TimesheetService.GetTimesheetEntries();

                foreach (var timesheet in timesheets)
                {
                    Timesheets.Add(new TimesheetEntryViewModel(timesheet));
                }
            }
            finally
            {
                IsLoading = false;
            }
        }