public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            TabInfo item       = value as TabInfo;
            Grid    g          = new Grid();
            Tab     tab        = ApplicationState.Stash[ApplicationState.CurrentLeague].Tabs.Find(t => t.i == item.ID);
            var     tabControl = TabFactory.GenerateTab(tab, new List <IFilter>());

            g.Children.Add(tabControl);
            return(g);
        }
Exemple #2
0
        //Todo: Get this to handle the premium tabs
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
            {
                return(null);
            }

            cache = cache ?? new Dictionary <string, Grid>();

            Item   item = value as Item;
            string key  = getKey(item);

            if (cache.ContainsKey(key))
            {
                return(cache[key]);
            }

            int  inventoryId = int.Parse(item.InventoryId.Replace("Stash", "")) - 1;
            Grid g           = new Grid();

            Tab tab        = ApplicationState.Stash[ApplicationState.CurrentLeague].Tabs.Find(t => t.i == inventoryId);
            var tabControl = TabFactory.GenerateTab(tab, new List <IFilter>()
            {
                new ItemFilter(item)
            });
            Image tabImage = getImage(tab, true);


            RowDefinition imageRow = new RowDefinition();

            imageRow.Height = new GridLength(26);
            g.RowDefinitions.Add(imageRow);
            g.RowDefinitions.Add(new RowDefinition());
            tabImage.SetValue(Grid.RowProperty, 0);
            tabControl.SetValue(Grid.RowProperty, 1);
            g.Children.Add(tabImage);
            g.Children.Add(tabControl);
            cache.Add(key, g);

            tabControl.ForceUpdate();
            return(g);
        }