示例#1
0
        internal void Cleanup()
        {
            GadgetItemsSource.Clear();
            GadgetCheckedCollection.Clear();

            m_CurrentEditGadget.CopyFrom(GadgetTest.CreateDefault);
        }
示例#2
0
        void SortItemsSourceCollection()
        {
            var list = GadgetItemsSource
                       .OrderBy(p => p.GadgetInfo)
                       .ToList()
            ;

            GadgetItemsSource.Clear();

            foreach (var item in list)
            {
                GadgetItemsSource.Add(item);
            }
        }
示例#3
0
        bool AddGadget(GadgetTest gadget)
        {
            var res = false;

            if (gadget.NotNull())
            {
                if (ContainsGadget(gadget.Id).IsFalse())
                {
                    GadgetItemsSource.Add(gadget);
                    res = true;
                }
            }

            return(res);
        }
示例#4
0
        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();
            }
        }
示例#5
0
        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));
                }
            }
        }