public DeleteControler(Model.Etiquette e) { foreach (Model.Etiquette d in GlowingEarth.getInstance().getMaster().getTags()) { if (d.getID().Equals(e.getID())) { GlowingEarth.getInstance().getMaster().getTags().Remove(d); break; } } foreach (Model.Resource r in GlowingEarth.getInstance().getMaster().getResources()) { foreach (Model.Etiquette et in r.getTags()) { if (et.getID().Equals(e.getID())) { r.getTags().Remove(et); break; } } r.setTags(r.getTags()); //Cudna greska bez ovoga -.- } success = true; }
public bool chckTag() { foreach (Etiquette t in GlowingEarth.getInstance().getMaster().getTags()) { if (t.getID().Equals(e.getID())) { success = false; return(false); } } return(true); }
public ModifyControler(View.TagEditor resed) { tage = resed; if ((tag = makeTag()) != null) { for (int i = 0; i < GlowingEarth.getInstance().getMaster().getTags().Count; i++) { if (tag.getID().Equals(GlowingEarth.getInstance().getMaster().getTags()[i].getID())) { GlowingEarth.getInstance().getMaster().getTags()[i] = tag; break; } } } else { success = false; return; } foreach (Model.Resource r in GlowingEarth.getInstance().getMaster().getResources()) { List <Model.Etiquette> temp = r.getTags(); int j = 0; foreach (Model.Etiquette et in temp) { if (et.getID().Equals(tag.getID())) { temp[j] = tag; break; } j++; } r.setTags(temp); } success = true; GlowingEarth.getInstance().getMaster().notifyChange(); }