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 AddEtiqControler(View.NewTag w) { wind = w; if (contAdd()) { e = new Etiquette(wind.IDbox.Text, wind.colorp.SelectedColor.ToString(), wind.descBox.Text); } else { success = false; return; } if (chckTag()) { addTag(); success = true; GlowingEarth.getInstance().getMaster().notifyChange(); return; } else { wind.Errl.Content = "Tag with this ID already exists"; success = false; return; } }
private void searchBox_TextChanged(object sender, TextChangedEventArgs e) { _selectedTag = null; if (searchBox.Text.Equals("")) { tags.Clear(); foreach (Model.Etiquette et in copy) { tags.Add(et); } return; } if (tags != null) { ObservableCollection <Model.Etiquette> tagz = new ObservableCollection <Model.Etiquette>(); foreach (Model.Etiquette et in refer.getMaster().tags) { if (et.getID().Contains(searchBox.Text)) { tagz.Add(et); } } tags.Clear(); foreach (Model.Etiquette et in tagz) { tags.Add(et); } } }
public Model.Etiquette makeTag() { if (contAddTag()) { Model.Etiquette t = new Model.Etiquette(tage.IDbox.Text, tage.colorPicker.SelectedColor.ToString(), tage.descBox.Text); success = true; return(t); } return(null); }
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(); }