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(); StashControl control = new StashControl() { TabNumber = inventoryId }; Tab tab = ApplicationState.Stash[ApplicationState.CurrentLeague].Tabs.Find(t => t.i == inventoryId); Image tabImage = getImage(tab, true); control.SetValue(StashControl.FilterProperty, new List<IFilter>() { new ItemFilter(item) }); control.ForceUpdate(); RowDefinition imageRow = new RowDefinition(); imageRow.Height = new GridLength(26); g.RowDefinitions.Add(imageRow); g.RowDefinitions.Add(new RowDefinition()); tabImage.SetValue(Grid.RowProperty, 0); control.SetValue(Grid.RowProperty, 1); g.Children.Add(tabImage); g.Children.Add(control); cache.Add(key, g); return g; }
private MenuItem getMenuItem(StashControl itemStash, string header, RoutedEventHandler handler) { MenuItem menuItem = new MenuItem() { Header = header }; menuItem.Tag = itemStash; menuItem.Click += new RoutedEventHandler(handler); return menuItem; }
private void addContextMenu(TabItem item, StashControl itemStash) { ContextMenu contextMenu = new ContextMenu(); if (!ApplicationState.Model.Offline) { contextMenu.Items.Add(getMenuItem(itemStash, "Refresh", refresh_Click)); contextMenu.Items.Add(getMenuItem(itemStash, "Refresh All Tabs", refreshAll_Click)); } contextMenu.Items.Add(getMenuItem(itemStash, "Set Tabwide Buyout", setTabBuyout_Click)); item.ContextMenu = contextMenu; }
public TabContent(int index, TabItem tabItem, StashControl stash) { this.Index = index; this.TabItem = tabItem; this.Stash = stash; }
void stashView_Loaded(object sender, System.Windows.RoutedEventArgs e) { var filter = string.Empty; for (int i = 1; i <= ApplicationState.Stash[ApplicationState.CurrentLeague].NumberOfTabs; i++) { TabItem item = new TabItem(); item.Header = StashHelper.GenerateTabImage(ApplicationState.Stash[ApplicationState.CurrentLeague].Tabs[i - 1], false); item.Tag = ApplicationState.Stash[ApplicationState.CurrentLeague].Tabs[i - 1].Name; item.HorizontalAlignment = HorizontalAlignment.Left; item.VerticalAlignment = VerticalAlignment.Top; item.Background = Brushes.Transparent; item.BorderBrush = Brushes.Transparent; StashControl itemStash = new StashControl(); itemStash.SetValue(StashControl.FilterProperty, getUserFilter(filter)); item.Content = itemStash; itemStash.TabNumber = ApplicationState.Stash[ApplicationState.CurrentLeague].Tabs[i - 1].i; addContextMenu(item, itemStash); stashView.tabControl.Items.Add(item); tabsAndContent.Add(new TabContent(i - 1, item, itemStash)); } stashView.Loaded -= new System.Windows.RoutedEventHandler(stashView_Loaded); }
public WhatsInTheBox(int index, TabItem tabItem, StashControl stash) { this.Index = index; this.TabItem = tabItem; this.Stash = stash; }
private void addContextMenu(TabItem item, StashControl itemStash) { ContextMenu contextMenu = new ContextMenu(); if (!ApplicationState.Model.Offline) contextMenu.Items.Add(getMenuItem(itemStash, Lang.RefreshStrValue, refresh_Click)); contextMenu.Items.Add(getMenuItem(itemStash, Lang.SetTabWideBOStrValue, setTabBuyout_Click)); item.ContextMenu = contextMenu; }