コード例 #1
0
 protected override void OnCreate(Bundle bundle)
 {
     RequestWindowFeature(WindowFeatures.NoTitle);
     base.OnCreate (bundle);
     SetContentView (Resource.Layout.CheckIn);
     FindViewById<TextView> (Resource.Id.btnCheckIn).Enabled = false;
     sessionKey = Intent.GetStringExtra ("SessionKey");
     groupID = Intent.GetIntExtra ("GroupID", 0);
     userID = Intent.GetIntExtra ("UserID", 0);
     var locSvc = new ROMPLocation ();
     //myFacilities[] = new FacilityCoordinates();
     myFacilities = locSvc.GetLocations (sessionKey, groupID);
     FindViewById<Button> (Resource.Id.btnCloseA).Click += btnCloseA_OnClick;
     if (myFacilities.Count () > 0) {
         FindViewById<Button> (Resource.Id.btnCheckIn).Click += btnCheckIn_OnClick;
         InitializeLocationManager();
     } else {
         FindViewById<Button> (Resource.Id.btnCheckIn).Visibility = ViewStates.Invisible;
         FindViewById<TextView> (Resource.Id.lblText).Text = "You have no locations to check in to. Please start the application during a rotation to properly utilize the functionality. Thank you.";
     }
 }
コード例 #2
0
 protected override void OnCreate(Bundle bundle)
 {
     RequestWindowFeature (WindowFeatures.NoTitle);
     base.OnCreate (bundle);
     SetContentView (Resource.Layout.CheckInPassive);
     mGeoIntentUp = (PendingIntent.GetService (this, 0,
         new Intent (this, Java.Lang.Class.FromType(typeof(GeofenceTransitionsIntentService))),
         PendingIntentFlags.NoCreate) != null);
     if (mGeoIntentUp) {
         geofenceRequestIntent = PendingIntent.GetService (this, 0,
             new Intent (this, Java.Lang.Class.FromType (typeof(GeofenceTransitionsIntentService))),
             PendingIntentFlags.UpdateCurrent);
         FindViewById<Button>(Resource.Id.btnBegin).Visibility = ViewStates.Invisible;
         FindViewById<TextView> (Resource.Id.lblConfirm).SetText ("A record that you have checked-in will be made in the log of your education activity for this ROMP rotation when this device enters a 1km radius surrounding the facility of your ROMP rotation.", TextView.BufferType.Normal);
     } else {
         geofenceList = new List<IGeofence> ();
         geofenceRequestIntent = null;
         string sessionKey = Intent.GetStringExtra ("SessionKey");
         int groupID = Intent.GetIntExtra ("GroupID", 0);
         int userID = Intent.GetIntExtra ("UserID", 0);
         if (sessionKey != "") {
             mSharedPreferences = this.GetSharedPreferences ("CheckInPrefs", FileCreationMode.Private);
             ISharedPreferencesEditor editor = mSharedPreferences.Edit ();
             editor.PutString ("SessionKey", sessionKey);
             editor.Commit ();
         }
         var locSvc = new ROMPLocation ();
         FindViewById<Button> (Resource.Id.btnCloseP).Click += btnCloseP_OnClick;
         myFacilities = locSvc.GetLocations (sessionKey, groupID);
         if (myFacilities.Count () > 0) {
             connectedGeofences = new List<ROMPGeofence> ();
             CreateGeofences ();
             FindViewById<Button> (Resource.Id.btnBegin).Click += BeginGeofencing;
             BuildGoogleApiClient ();
         } else {
             FindViewById<Button> (Resource.Id.btnBegin).Visibility = ViewStates.Invisible;
             FindViewById<TextView> (Resource.Id.lblConfirm).Text = "You have no locations to check in to. Please start the application during a rotation to properly utilize the functionality. Thank you.";
         }
     }
 }