예제 #1
0
 public void Save(Location location)
 {
     if(Locations != null)
     {
         if (!Locations.Contains(location))
             Locations.Add(location);
         File.WriteAllText(GetFilename(), JsonConvert.SerializeObject(Locations));
     }
 }
예제 #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;
        }
예제 #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();
        }
예제 #4
0
 public  void Delete(Location location)
 {
     if(Locations != null)
     {
         Locations.Remove(location);
         File.WriteAllText(GetFilename(), JsonConvert.SerializeObject(Locations));
     }
 }