vendredi 25 décembre 2015

Create Geofence while storing the location to the sqlite database

I am developing windows mobile application. I want to create geofence when storing the location to the sqlite database to generate SMS alerts when entering to the geofence. I am loading the location to the text boxes through map.

This is the code so far

private void Load_Location(object sender, RoutedEventArgs e)
{
    LattxtBx.Text = String.Format("{0}", AddLocation.Center.Position.Latitude);
    LongtxtBx.Text = String.Format("{0}", AddLocation.Center.Position.Longitude);
}

private async void AddContact_Click(object sender, RoutedEventArgs e)
{
    DatabaseHelperClass Db_Helper = new DatabaseHelperClass();//Creating object for DatabaseHelperClass.cs from ViewModel/DatabaseHelperClass.cs 
    if (NametxtBx.Text != "" & AgetxtBx.Text != "" & AddresstxtBx.Text != "" & SchooltxtBx.Text != "" & GardienttxtBx.Text != "" & PhonetxtBx.Text != "" & LattxtBx.Text != "" & LongtxtBx.Text != "")
    {
        Db_Helper.Insert(new Contacts(NametxtBx.Text, AgetxtBx.Text, AddresstxtBx.Text, SchooltxtBx.Text, GardienttxtBx.Text, PhonetxtBx.Text, LattxtBx.Text, LongtxtBx.Text));
        Frame.Navigate(typeof(ReadContactList));//after add contact redirect to contact listbox page 
    }
    else
    {
        MessageDialog messageDialog = new MessageDialog("Please fill all fields");//Text should not be empty 
        await messageDialog.ShowAsync();
    }
}

Aucun commentaire:

Enregistrer un commentaire