예제 #1
0
        /// <summary>
        /// Event handler for the selection change of drop down menu.
        /// It locates the all animals from a particular categories or from all categories choosen based on drop down menu selection.
        /// </summary>
        /// <param name="sender">Sender Object</param>
        /// <param name="e">Event argument</param>
        private void locateSelectedCategory(object sender, EventArgs e)
        {
            gMapControl.Overlays.Clear();
            Models.Category selectedCategory = (Models.Category) this.category_comboBox.Items[category_comboBox.SelectedIndex];

            int    categoryId   = selectedCategory.categoryId;
            string categoryName = selectedCategory.categoryName;

            if (categoryName == Constants.ALL)
            {
                categoryName_label.Text = Constants.LOCATE_ANIMAL_HEADING_START + selectedCategory.categoryName + Constants.LOCATE_ANIMAL_HEADING_END_ALL_CATEGORY;
                loadGoogleMapForAllCategory();
            }
            else
            {
                categoryName_label.Text = Constants.LOCATE_ANIMAL_HEADING_START + selectedCategory.categoryName + Constants.LOCATE_ANIMAL_HEADING_END_PER_CATEGORY;
                loadGoogleMapPerCategory();
            }
        }
예제 #2
0
 /// <summary>
 /// Event handler for add animal click.
 /// </summary>
 /// <param name="sender">Sender object</param>
 /// <param name="e">Event argument</param>
 private void add_button_Click(object sender, EventArgs e)
 {
     try
     {
         if (!(animalName_text.Text == "" | gpsDeviceId_Text.Text == ""))
         {
             Models.Category selectedCategory = (Models.Category) this.category_comboBox.Items[category_comboBox.SelectedIndex];
             this.categoryId  = selectedCategory.categoryId;
             this.animalName  = this.animalName_text.Text;
             this.GPSDeviceId = this.gpsDeviceId_Text.Text;
         }
     }
     catch (Exception ex)
     {
         log.Error(String.Format("Error in adding new animal {0}", ex.Message));
         PopUp popUpBox = new PopUp("Error in creating a new animal");
         popUpBox.ShowDialog();
     }
 }