Exemplo n.º 1
0
        public static AbstractStashTabControl GenerateTab(Tab tab, List <IFilter> filters)
        {
            AbstractStashTabControl stashTab;

            switch (tab.Type)
            {
            case TabType.Currency:
                stashTab = new CurrencyStashTab(tab.i, filters);
                break;

            case TabType.Essence:
                stashTab = new EssenceStashTab(tab.i, filters);
                break;

            case TabType.Fragment:
                stashTab = new FragmentStashTab(tab.i, filters);
                break;

            default:
                stashTab = new StashTabControl(tab.i, filters);
                break;
            }

            return(stashTab);
        }
Exemplo n.º 2
0
        void stashView_Loaded(object sender, RoutedEventArgs e)
        {
            for (var i = 1; i <= ApplicationState.Stash[ApplicationState.CurrentLeague].NumberOfTabs; i++)
            {
                var stash      = ApplicationState.Stash[ApplicationState.CurrentLeague];
                var currentTab = stash.Tabs[i - 1];

                var item = new TabItem
                {
                    Header = StashHelper.GenerateTabImage(currentTab, false),
                    Tag    = currentTab.Name,
                    HorizontalAlignment = HorizontalAlignment.Left,
                    VerticalAlignment   = VerticalAlignment.Top,
                    Background          = Brushes.Transparent,
                    BorderBrush         = Brushes.Transparent
                };

                AbstractStashTabControl stashTab;

                switch (currentTab.Type)
                {
                case TabType.Currency:
                    stashTab = new CurrencyStashTab(currentTab.i, getUserFilter(string.Empty));
                    break;

                case TabType.Essence:
                    stashTab = new EssenceStashTab(currentTab.i, getUserFilter(string.Empty));
                    break;

                case TabType.Fragment:
                    stashTab = new FragmentStashTab(currentTab.i, getUserFilter(string.Empty));
                    break;

                default:
                    stashTab = new StashTabControl(currentTab.i, getUserFilter(string.Empty));
                    break;
                }

                CraftTabAndContent(item, stashTab, i);

                stashView.tabControl.Items.Add(item);
            }

            stashView.Loaded -= stashView_Loaded;
        }
Exemplo n.º 3
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();

            StashTabControl tabControl = new StashTabControl(inventoryId);
            Tab             tab        = ApplicationState.Stash[ApplicationState.CurrentLeague].Tabs.Find(t => t.i == inventoryId);
            Image           tabImage   = getImage(tab, true);

            tabControl.SetValue(StashTabControl.FiltersProperty, new List <IFilter>()
            {
                new ItemFilter(item)
            });
            tabControl.ForceUpdate();
            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);

            return(g);
        }