Exemplo n.º 1
0
        public void Initialize(GearSetBuild build)
        {
            Build = build;

            foreach (var kv in Build.FilterTestItems)
            {
                //kv.Value.Sort((a, b) => a.ML < b.ML ? -1 : (a.ML > b.ML ? 1 : string.Compare(a.Name, b.Name, true)));
                kv.Value.Sort((a, b) => string.Compare(a.Name, b.Name, true));
                TreeViewItem tvi = new TreeViewItem();
                TextBlock    tb  = new TextBlock {
                    Text = kv.Key.ToString(), FontWeight = FontWeights.Bold
                };
                tvi.Header = tb;
                tvi.Tag    = kv.Key;
                tvSlots.Items.Add(tvi);
                foreach (var item in kv.Value)
                {
                    TreeViewItem tvii = new TreeViewItem();
                    tvii.Header = item.Name;
                    tvii.Tag    = item;
                    foreach (var p in item.Properties)
                    {
                        BuildFilterProperty(tvii, item, p, kv.Key.ToSlotType());
                        BuildFilterProperty(tvii, item, p, SlotType.None);
                    }
                    if (tvii.HasItems)
                    {
                        tvi.Items.Add(tvii);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void Initialize(GearSetBuild build, Dictionary <EquipmentSlotType, EquipmentSlotControl> equipslots)
        {
            CurrentBuild   = build;
            EquipmentSlots = equipslots;

            foreach (var cb in CurrentBuild.Filters)
            {
                if (cb.Key != SlotType.None)
                {
                    cbFiltersSlotAdd.Items.Add(cb.Key);
                }
            }

            FiltersReset_Clicked(null, null);
        }
Exemplo n.º 3
0
        public static GearSetBuild FromXml(XmlDocument doc, bool filters, bool results)
        {
            GearSetBuild build = new GearSetBuild();

            try
            {
                build.AppVersion   = doc.DocumentElement.GetAttribute("version");
                build.MinimumLevel = int.Parse(doc.GetElementsByTagName("MinimumLevel")[0].InnerText);
                build.MaximumLevel = int.Parse(doc.GetElementsByTagName("MaximumLevel")[0].InnerText);

                if (filters)
                {
                    XmlElement xe = doc.GetElementsByTagName("Filters")[0] as XmlElement;
                    if (xe != null)
                    {
                        foreach (XmlElement xf in xe.ChildNodes)
                        {
                            BuildFilter bf = BuildFilter.FromXml(xf);
                            build.Filters[bf.Slot].Add(bf);
                        }
                    }
                }

                if (results)
                {
                    XmlElement xe = doc.GetElementsByTagName("BuildResults")[0] as XmlElement;
                    if (xe != null)
                    {
                        foreach (XmlElement xb in xe.ChildNodes)
                        {
                            GearSetEvaluation gse = GearSetEvaluation.FromXml(xb);
                            build.BuildResults.Add(gse);
                        }
                    }
                }

                return(build);
            }
            catch
            {
                return(null);
            }
        }