public void DeleteObject(Notifier element) { List <ObservableCollection <BaseDrawClass> > listCollection = new List <ObservableCollection <BaseDrawClass> >() { ListColorVMA, ListColorVMB, ListColorVMV, ListColorVMG }; List <ObservableCollection <FrameworkElement> > listCollectionElement = new List <ObservableCollection <FrameworkElement> >() { ListColorElementA, ListColorElementB, ListColorElementV, ListColorElementG }; listCollection.ForEach(ListColorVM => { var numberView = listCollection.Select((item, index) => new { item, index }) .Where(ix => ix.item == ListColorVM) .Select(ix => ix.index) .FirstOrDefault(); var el = ListColorVM.ToList().Find(x => x == element); if (el == null) { return; } ListColorVM.Remove(el); listCollectionElement[numberView].Remove(el.ParentEl); }); }
private void reverseBackGroundElement(DataRow curentColor, List <ObservableCollection <BaseDrawClass> > listCollection, string key) { listCollection.ForEach(ListColorVM => { ListColorVM .ToList() .FindAll(y => y is VMSchemeElement) .FindAll(x => (x as VMSchemeElement).Name == key) .ForEach(ColorVM => { ColorVM.ReverseBackGround( Color.FromArgb(Convert.ToInt32(curentColor["R"]), Convert.ToInt32(curentColor["G"]), Convert.ToInt32(curentColor["B"])), AppDomain.CurrentDomain.BaseDirectory + @"\SVG\" + ColorVM.PathToImg); }); }); }
public void ClearColorAll() { List <ObservableCollection <BaseDrawClass> > listCollection = new List <ObservableCollection <BaseDrawClass> >() { ListColorVMA, ListColorVMB, ListColorVMV, ListColorVMG }; List <ObservableCollection <FrameworkElement> > listCollectionElement = new List <ObservableCollection <FrameworkElement> >() { ListColorElementA, ListColorElementB, ListColorElementV, ListColorElementG }; listCollection.ForEach(ListColorVM => { var numberView = listCollection.Select((item, index) => new { item, index }) .Where(ix => ix.item == ListColorVM) .Select(ix => ix.index) .FirstOrDefault(); ListColorVM.ToList().FindAll(x => (x.Name == "Логотип движение") || (x is VMLogoPlace) || (x.Name == "polosa")).ForEach(x => { listCollectionElement[numberView].Remove(x.ParentEl); ListColorVM.Remove(x); }); }); Mouse.OverrideCursor = Cursors.Wait; DataClass dc = new DataClass("KontinentDBEntity.db"); DataTable dt = dc.SelectQuery("select * from _colorRGB"); var colorList = dt.AsEnumerable().ToList(); dictDefaultColor.Keys .ToList() .ForEach(key => { var curentColor = colorList.Find(x => x["nameInRAL"].ToString() == dictDefaultColor[key].ToString()); dictColorElem[key] = dictDefaultColor[key]; reverseBackGroundElement(curentColor, listCollection, key); }); Mouse.OverrideCursor = null; return; }