Ejemplo n.º 1
0
        public void AddToDoItem(LocationItem newLocationItem)
        {
            // Add a to-do item to the data context.
            toDoDB.LocationItems.InsertOnSubmit(newLocationItem);

            // Save changes to the database.
            toDoDB.SubmitChanges();

            // Add a to-do item to the "all" observable collection.
            AllLocationItems.Add(newLocationItem);
        }
Ejemplo n.º 2
0
        private void SaveLocationApplicationBar_Click(object sender, EventArgs e)
        {
           
            if (!progressbarCurentLocation.IsIndeterminate)
            {
                if ("".Equals(txtboxLocationUserName.Text))
                {
                    MessageBox.Show("Please enter the Location name!!");
                }
                else if (null == LocationResult && null != LocationAddress)
                {
                    MessageBox.Show("Please select the the Location!!");
                }
                else
                {
                    MessageBox.Show(txtboxLocationUserName.Text + " at " + LocationAddress+ " is saved");

                    LocationItem newToDoItem = new LocationItem
                    {
                        LocationName = txtboxLocationUserName.Text,
                        LocationAddress = LocationAddress,
                        LocationRange = Convert.ToInt32(1),
                        LocationLatitude = LocationResult.Latitude,
                        LocationLongitude = LocationResult.Longitude,                        
                    };
                    App.ViewModel.AddToDoItem(newToDoItem);
                }
            }
            else
            {
                MessageBox.Show("Please wait while retriving your current location");
            }
        }