Example #1
0
 public void Save(Location location)
 {
     if(Locations != null)
     {
         if (!Locations.Contains(location))
             Locations.Add(location);
         File.WriteAllText(GetFilename(), JsonConvert.SerializeObject(Locations));
     }
 }
Example #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Create your application here
            this.SetContentView(Resource.Layout.Detail);

            if (Intent.HasExtra("locationid"))
            {
                string locationId = Intent.GetStringExtra("locationid");
                _location = LocationsData.Instance.Locations.FirstOrDefault(x => x.Id == locationId);
            }
            else
                _location = new Location();
            //LocationToUI();

            FindViewById<ImageButton>(Resource.Id.callButton).Click += callButton_Click;
        }
Example #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Edit);

            if (Intent.HasExtra("locationid"))
            {
                string locationId = Intent.GetStringExtra("locationid");
                _location = LocationsData.Instance.Locations.FirstOrDefault(x => x.Id == locationId);
            }
            else
                _location = new Location();

            _nameEditText = FindViewById<EditText>(Resource.Id.nameEditText);
            _descrEditText = FindViewById<EditText>(Resource.Id.descrEditText);
            _phoneEditText = FindViewById<EditText>(Resource.Id.phoneEditText);
            _latEditText = FindViewById<EditText>(Resource.Id.latEditText);
            _longEditText = FindViewById<EditText>(Resource.Id.longEditText);

            //LocationToUI();
        }
Example #4
0
 public  void Delete(Location location)
 {
     if(Locations != null)
     {
         Locations.Remove(location);
         File.WriteAllText(GetFilename(), JsonConvert.SerializeObject(Locations));
     }
 }