private void pictureBox1_MouseClick(object sender, MouseEventArgs e) { if (add == MapsOType.Camera && (sender is PictureBox pb) && !pb.Name.Contains("camera")) { add = MapsOType.None; var l = maps.Manifest.Objects.ToList(); var s = new MapsObjectSetting() { TypeObject = 0, Files = maps.GetAllImages() }; if (s.ShowDialog() == DialogResult.OK) { maps.UploadFile(s.ToLoadFile); var obj = new MapsObject(s.NameObject, e.Location, (int)MapsOType.Camera, s.Camera, s.SelectFile); l.Add(obj); } maps.Manifest.Objects = l.ToArray(); //maps.Save(); LoadCameras(); } else if (add == MapsOType.Delete) { add = MapsOType.None; var l = maps.Manifest.Objects.ToList(); if ((sender is PictureBox pb1) && pb1.Name.Contains("camera")) { var od = l.Where(t => t.Name == pb1.Name.Split('_')[1]).First(); l.Remove(od); } maps.Manifest.Objects = l.ToArray(); //maps.Save(); LoadCameras(); } }
private void Pp_MouseDoubleClick(object sender, MouseEventArgs e) { var pp = sender as PictureBox; var name = pp.Name.Split('_').LastOrDefault(); var l = maps.Manifest.Objects.ToList(); var id = l.IndexOf(l.Where(t => t.Name == name).FirstOrDefault()); var s = new MapsObjectSetting() { TypeObject = 0, NameObject = l[id].Name, Files = maps.GetAllImages() }; s.Camera = l[id].OID; s.SelectFile = l[id].Image; var d = s.ShowDialog(); if (d == DialogResult.OK) { maps.UploadFile(s.ToLoadFile); l[id].Name = s.NameObject; l[id].OID = s.Camera; l[id].Image = s.SelectFile; } maps.Manifest.Objects = l.ToArray(); }