示例#1
0
        private async Task GetRequests()
        {
            ICrisisCheckInApiClient apiClient = new CrisisCheckInApiClient();
            var requests = await apiClient.GetRequests(2);

            _requestListView.ItemsSource = requests;
        }
        public RegistrationPage()
        {



            InitializeComponent();
            //TODO: Use a container to pass in parameters
            var client = new CrisisCheckInApiClient();
            viewModel = new RegistrationPageViewModel(this, client);
            BindingContext = viewModel;




        }
示例#3
0
        private async Task Init()
        {
            _itemSelectedEventHandler = (sender, args) =>
            {
                if (args.SelectedItem == null)
                    return;

                var listView = sender as ListView;
                var selectedItem = args.SelectedItem as DisasterViewModel;
                if (selectedItem != null)
                {
                    Navigation.PushAsync(new CommitmentPage(selectedItem.CommitmentData));
                }
                if (listView != null)
                {
                    listView.SelectedItem = null;
                }
            };

            BackgroundColor = Constants.HtBoxDarkBrown;

            // TODO: Implement a progress indicator
            ICrisisCheckInApiClient apiClient = new CrisisCheckInApiClient();
            var dtos = await apiClient.GetCommitmentsList(2); //TODO: wire up to Auth0 so we don't have to pass person ID
           // Data = dtos.Select(c => new DisasterViewModel(c));

            _disasterListView = new ListView
            {
                ItemsSource = Data,
                BackgroundColor = Constants.HtBoxDarkBrown
            };
            _disasterListView.ItemSelected += _itemSelectedEventHandler;
            var cell = new DataTemplate(typeof(TextCell));
            cell.SetBinding(TextCell.TextProperty, new Binding("DisasterName"));
            cell.SetBinding(TextCell.DetailProperty, new Binding("DisasterStatusAndDate"));
            cell.SetValue(TextCell.TextColorProperty, Color.White);
            cell.SetValue(TextCell.DetailColorProperty, Constants.HtBoxLightBrown);
            _disasterListView.ItemTemplate = cell;

            Content = _disasterListView;
        }
 private async Task GetCompleteButtonHandler(RequestDto selectedRequest, PaddedButton completeButton)
 {
     completeButton.Clicked += async (o, e) =>
     {
         ICrisisCheckInApiClient apiClient = new CrisisCheckInApiClient();
         await apiClient.CompleteRequest(selectedRequest.RequestId);
         await Navigation.PopAsync();
     };
 }