private void Select_OnClick(object sender, RoutedEventArgs e)
 {
     tempLT = (LandmarkType)dgrTypes.SelectedItem;
     if (Select.Content.Equals("Select"))
     {
         if (tempLT != null)
         {
             LTID.Text      = tempLT.TypeView;
             Select.Content = "Deselect";
             notSaved       = true;
         }
         else
         {
             MessageBox.Show("Please select one of the landmark types.", "Selection Error", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
     else
     {
         if (tempLT != null)
         {
             tempLT         = null;
             LTID.Text      = "";
             Select.Content = "Select";
             notSaved       = true;
         }
         else
         {
             MessageBox.Show("Please select one of the landmark types.", "Selection Error", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
 }
Exemplo n.º 2
0
 public Landmark(string i, string n, string d, LandmarkType lt, List <Tag> tags, string c, string s, double r, string dd, string ip, bool e, bool h, bool u, Point p)
 {
     position.X = p.X;
     position.Y = p.Y;
     _name      = n;
     _id        = i;
     _desc      = d;
     _lt        = lt;
     _tags      = new List <Tag>();
     foreach (Tag t in tags)
     {
         _tags.Add(t);
     }
     _climate = c;
     _status  = s;
     _rev     = r;
     _dd      = dd;
     if (ip == null || ip.Equals("/HCI_Project;component/Images/missing_pic.jpg"))
     {
         imagePath = _lt.IconPath;
     }
     else
     {
         imagePath = ip;
     }
     _ee  = e;
     _hab = h;
     _urb = u;
 }
 private void Double_OnClick(object sender, MouseButtonEventArgs e)
 {
     if (ltw == null)
     {
         ltw                          = new LandmarkTypeWindow(map, this);
         forChanging                  = (LandmarkType)dgrTypes.SelectedItem;
         changing                     = true;
         ltw.LTID_Field.Text          = forChanging.ID;
         ltw.LTName_Field.Text        = forChanging.Name;
         ltw.LTDescription_Field.Text = forChanging.Description;
         ltw.Image_Path               = forChanging.IconPath;
         ltw.Show();
         if (tempLT != null)
         {
             if (forChanging.Equals(tempLT))
             {
                 LTID.Text = "";
                 tempLT    = null;
             }
         }
     }
     else
     {
         ltw.Topmost = true;  // important
         ltw.Topmost = false; // important
         ltw.Focus();         // important
     }
 }
        public bool AddType(LandmarkType lt)
        {
            if (ptypes.Contains(lt) && changing == false)
            {
                return(false);
            }

            if (changing == true)
            {
                if (lt.Equals(forChanging))
                {
                }
                else
                {
                    ptypes.Remove(forChanging);
                    ltypes.Remove(forChanging);
                    ptypes.Add(lt);
                    ltypes.Add(lt);
                }
            }
            else
            {
                ptypes.Add(lt);
                ltypes.Add(lt);
            }

            changing = false;
            return(true);
        }
Exemplo n.º 5
0
        public bool addLandmarkType(LandmarkType lt)
        {
            if (landmarkTypes.ContainsKey(lt.ID))
            {
                return(false);
            }

            landmarkTypes.Add(lt.ID, lt);

            return(true);
        }
        private void Delete_OnClick(object sender, RoutedEventArgs e)
        {
            forChanging = (LandmarkType)dgrTypes.SelectedItem;

            if (forChanging != null)
            {
                int cc = map.FindLandmarkTypes(forChanging, tempLandmarks);
                if (cc > 0)
                {
                    MessageBoxResult mbr =
                        MessageBox.Show(
                            "There are " + cc +
                            " landmarks that use the landmark type you want to delete. \nIf you click Yes, you agree to remove deleted landmark type from all landmarks. \nAre you sure you want to continue?",
                            "Landmark Types Found", MessageBoxButton.YesNo, MessageBoxImage.Warning);

                    if (mbr == MessageBoxResult.Yes)
                    {
                        tempLandmarks = map.RemoveLandmarkType(forChanging, tempLandmarks);
                        if (tempLT == forChanging)
                        {
                            tempLT = null;
                        }

                        LTID.Text = "";
                        ptypes.Remove(forChanging);
                        ltypes.Remove(forChanging);
                        MessageBox.Show(
                            "Landmark type " + forChanging.TypeView + " deleted from " + cc + " landmarks",
                            "Landmark Type Deleted", MessageBoxButton.OK, MessageBoxImage.Information);

                        notSaved = true;
                    }
                }
                else
                {
                    ptypes.Remove(forChanging);
                    ltypes.Remove(forChanging);
                    MessageBox.Show(
                        "Landmark type " + forChanging.TypeView + " deleted.",
                        "Landmark Type Deleted", MessageBoxButton.OK, MessageBoxImage.Information);

                    notSaved = true;
                }
            }
            else
            {
                MessageBox.Show(
                    "Please select one of the landmark types.", "Selection Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Exemplo n.º 7
0
        public int FindLandmarkTypes(LandmarkType lt, List <Landmark> lmarks)
        {
            int count = 0;

            foreach (Landmark l in lmarks)
            {
                if (l.Type.Equals(lt))
                {
                    count++;
                }
            }

            return(count);
        }
Exemplo n.º 8
0
        public List <Landmark> RemoveLandmarkType(LandmarkType lt, List <Landmark> lmarks)
        {
            foreach (Landmark l in lmarks)
            {
                if (l.Type.Equals(lt))
                {
                    if (l.imagePath.Equals(l.Type.IconPath))
                    {
                        l.imagePath = "/HCI_Project;component/Images/missing_pic.jpg";
                    }

                    l.TypeView = "";
                    l.Type     = null;
                }
            }

            return(lmarks);
        }
        private void SelectionChanged_OnClick(object sender, SelectionChangedEventArgs e)
        {
            LandmarkType ltt = (LandmarkType)dgrTypes.SelectedItem;

            if (tempLT != null)
            {
                if (ltt.Equals(tempLT))
                {
                    Select.Content = "Deselect";
                }
                else
                {
                    Select.Content = "Select";
                }
            }
            else
            {
                Select.Content = "Select";
            }
        }
        private void OK_Click(object sender, RoutedEventArgs e)
        {
            if (!LTID_Field.Text.Equals("") && !LTName_Field.Text.Equals("") && !Image_Path.Equals("/HCI_Project;component/Images/missing_pic.jpg"))
            {
                LandmarkType lt = new LandmarkType(LTID_Field.Text, LTName_Field.Text, _image, LTDescription_Field.Text);

                if (ltw.AddType(lt))
                {
                    ListTypesWindow.notSaved = true;
                    ltw.Search.Text          = "";
                    doNotShow = true;
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Landmark type with entered code already exists. \nPlease try again.", "Landmark Type Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            else
            {
                MessageBox.Show("Please enter ID, name and choose an \nimage for your landmark type.", "Landmark Type Data Error", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Exemplo n.º 11
0
 public bool Equals(LandmarkType lt)
 {
     return(id.Equals(lt.id) && name.Equals(lt.name) &&
            description.Equals(lt.description) && iconPath.Equals(lt.iconPath));
 }