/// <summary> /// Initialisation with a selected geometry /// </summary> /// <param name="objectId"></param> public RecordsPageVM(int objectId) { Activity = false; Title = "Beobachtungen"; if (SortBy == String.Empty) { SortBy = "Geometrie"; } App.CurrentRoute = "//Records?objectId=" + objectId.ToString(); ItemTapped = new Command <FormRec>(OnItemSelected); AddItemCommand = new Command(OnAddItem); CopyBDCGUIDCommand = new BDCGUIDRecordCommand(this); RecordDeleteCommand = new RecordDeleteCommand(this); GeometryDeleteCommand = new GeometryDeleteCommand(this); Object_pk = objectId; MessagingCenter.Subscribe <Application>(App.Current, "RefreshRecords", (sender) => { UpdateRecords(); }); MessagingCenter.Subscribe <Application>(App.Current, "RefreshGeometries", (sender) => { UpdateRecords(); }); MessagingCenter.Subscribe <Application>(App.Current, "SetProject", (sender) => { FilterBy = String.Empty; }); }
/// <summary> /// Initialisation without a selected geometry /// </summary> public RecordsPageVM() { Activity = false; Title = "Beobachtungen"; if (SortBy == String.Empty) { SortBy = "Geometrie"; } string filterGeom = Preferences.Get("FilterGeometry", String.Empty); int filterGeomVal; if (filterGeom != String.Empty) { int.TryParse(filterGeom, out filterGeomVal); Object_pk = filterGeomVal; } if (App.CurrentRoute.Contains("///Records?objectId=")) { var objArr = App.CurrentRoute.Split('='); var objId = objArr[1]; Object_pk = Int32.Parse(objId); } ItemTapped = new Command <FormRec>(OnItemSelected); AddItemCommand = new Command(OnAddItem); CopyBDCGUIDCommand = new BDCGUIDRecordCommand(this); RecordDeleteCommand = new RecordDeleteCommand(this); GeometryDeleteCommand = new GeometryDeleteCommand(this); MessagingCenter.Subscribe <Application>(App.Current, "RefreshRecords", (sender) => { UpdateRecords(); }); MessagingCenter.Subscribe <Application>(App.Current, "RefreshGeometries", (sender) => { UpdateRecords(); }); MessagingCenter.Subscribe <Application>(App.Current, "SetProject", (sender) => { FilterBy = String.Empty; }); }