Пример #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.CompleteLocationInputForm);

            try
            {

                int locationId = Intent.GetIntExtra("LocationId", 0);
                var buttonSave = this.FindViewById<Button>(Resource.Id.buttonSaveLocation);
                this.textViewLocationInfo = this.FindViewById<TextView>(Resource.Id.textViewLocationInfo);
                this.editTextLocationName = this.FindViewById<EditText>(Resource.Id.editTextLocationName);

                this.location = CentralStation.Instance.Ainject.ResolveType<ITimeTrackerWorkspace>().GetTrackLocations().FirstOrDefault(t => t.ID == locationId);
                this.BindLocation(location);

                buttonSave.Click += delegate
                                        {
                                            var backToMain = new Intent(this, typeof(MainActivity));
                                            this.UpdateCurrentLocation();
                                            this.StartActivity(backToMain);
                                        };
            }
            catch (Exception ex)
            {
                Log.Error(this.GetType().Name, ex.StackTrace);
            }
        }
Пример #2
0
 private void BindLocation(TrackLocation location)
 {
     if (location != null)
     {
         this.textViewLocationInfo.Text = location.ToString();
         this.editTextLocationName.Text = location.Name;
     }
 }
Пример #3
0
        /// <summary>
        /// Sets the track location.
        /// </summary>
        /// <param name="trackLocation">The track location.</param>
        public void SetTrackLocation(TrackLocation trackLocation)
        {
            if (trackLocation == this.currentTrackLocation)
            {
                return;
            }

            this.WriteExitPerimeterEvent(this.currentTrackLocation);
            this.currentTrackLocation = trackLocation;
            this.WriteEnterPerimeterEvent(this.currentTrackLocation);
        }
Пример #4
0
        private void WriteEnterPerimeterEvent(TrackLocation enterTrackLocation)
        {
            if (enterTrackLocation == null)
            {
                return;
            }

            Log.Debug(this.GetType().Name, "Enter Perimeter");
            var entry = new TrackLocationLogEntry { LogEntry = Constants.EntryPerimeter, TrackLocationId = enterTrackLocation.ID, LocationName = enterTrackLocation.LocationName };
            entry.LogDateTime = (DateTime.Now);
            int response = this.timeTrackerWorkspace.SaveTrackLocationLogEntry(entry);
            Log.Error(this.GetType().Name, "Enter Perimeter response" + response);
        }
Пример #5
0
 /// <summary>
 /// Saves the track location.
 /// </summary>
 /// <param name="item">The item.</param>
 /// <returns></returns>
 public int SaveTrackLocation(TrackLocation item)
 {
     return this.database.SateEntity(item);
 }