internal void Cleanup() { GadgetItemsSource.Clear(); GadgetCheckedCollection.Clear(); m_CurrentEditGadget.CopyFrom(GadgetTest.CreateDefault); }
void SortItemsSourceCollection() { var list = GadgetItemsSource .OrderBy(p => p.GadgetInfo) .ToList() ; GadgetItemsSource.Clear(); foreach (var item in list) { GadgetItemsSource.Add(item); } }
bool AddGadget(GadgetTest gadget) { var res = false; if (gadget.NotNull()) { if (ContainsGadget(gadget.Id).IsFalse()) { GadgetItemsSource.Add(gadget); res = true; } } return(res); }
void MaterialChanged() { if (m_CurrentMaterialGadget.ValidateId) { GadgetItemsSource.Clear(); foreach (var gadgetTest in GadgetFullCollection) { if (gadgetTest.Material.Equals(m_CurrentMaterialGadget.Material, StringComparison.InvariantCulture)) { var checkedItem = IsChecked(gadgetTest.Id); if (checkedItem.ValidateId.IsFalse()) { if (gadgetTest.Enabled) { if (gadgetTest.Busy.IsFalse()) { // only Target content if (gadgetTest.HasContentTarget) { gadgetTest.Material = m_CurrentMaterialGadget.Material; AddGadget(gadgetTest); } } } } else { AddGadget(checkedItem); } } } UpdateCurrentEditGadget(); SortItemsSourceCollection(); } }
void UpdateCurrentEditGadget() { if (m_CurrentEditGadget.ValidateId) { // remove my self var itemSource = ItemSourceById(m_CurrentEditGadget.Id); if (itemSource.ValidateId) { GadgetItemsSource.Remove(itemSource); } if (m_CurrentEditGadget.HasContentTest) { var contents = new Collection <GadgetTest> (); m_CurrentEditGadget.RequestContent(contents); foreach (var gadget in contents) { var gadgetTest = GadgetById(gadget.Id); if (gadgetTest.ValidateId) { gadgetTest.Material = m_CurrentMaterialGadget.Material; if (AddGadget(gadgetTest)) { AddChecked(gadgetTest); } } } } else { //AddChecked (TFactoryListItemInfo.Create (gadgetItem, isChecked: true)); } } }