protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); SetContentView(Resource.Layout.edit_outside_activity); _dataService.Initialize(); try { var selectedOutsideActivityId = Intent.Extras.GetInt("selectedOutsideActivityId"); outsideActivities = _dataService.GetOutsideActivity(); outsideActivity = outsideActivities[selectedOutsideActivityId]; //outsideActivity = _dataService.GetOutsideActivity(selectedOutsideActivityId); } catch (System.NullReferenceException) { _updateOutsideActivityButtonLabel = "Add Activity"; _deleteOutsideActivityButtonLabel = "Discard Activity"; outsideActivity = new OutsideActivity(); outsideActivity.StartTime = DateTime.Now.AddHours(-2); _dataService.CreateOutsideActivity(outsideActivity); } catch (System.ArgumentOutOfRangeException) { _updateOutsideActivityButtonLabel = "Add Activity"; _deleteOutsideActivityButtonLabel = "Discard Activity"; outsideActivity = new OutsideActivity(); outsideActivity.StartTime = DateTime.Now.AddHours(-2); _dataService.CreateOutsideActivity(outsideActivity); } FindViews(); LinkEventHandlers(); }
public OutsideActivityDetailAdapter() { _dataService.Initialize(); _outsideActivities = _dataService.GetOutsideActivity(); }