private void unselectPreviousTab(TabItem selectedTab) { Image i = selectedTab.Header as Image; Tab tab = i.Tag as Tab; selectedTab.Header = StashHelper.GenerateTabImage(tab, false); }
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); }
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 = new TabVisuals() { Name = currentTab.Name, Colour = currentTab.Colour }, HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top, Background = Brushes.Transparent, BorderBrush = Brushes.Transparent }; var stashTab = TabFactory.GenerateTab(currentTab, getUserFilter(string.Empty)); CraftTabAndContent(item, stashTab, i); stashView.tabControl.Items.Add(item); } stashView.Loaded -= stashView_Loaded; }
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 }; switch (currentTab.Type) { case TabType.Currency: var currencyStash = new CurencyStash(currentTab.i, getUserFilter(string.Empty)); item.Content = currencyStash; addContextMenu(item, currencyStash); tabsAndContent.Add(new TabContent(i - 1, item, currencyStash)); break; case TabType.Essence: var essenceStash = new EssenceStash(currentTab.i, getUserFilter(string.Empty)); item.Content = essenceStash; addContextMenu(item, essenceStash); tabsAndContent.Add(new TabContent(i - 1, item, essenceStash)); break; default: var itemStash = new StashControl(); itemStash.Filter = getUserFilter(string.Empty); itemStash.TabNumber = currentTab.i; item.Content = itemStash; addContextMenu(item, itemStash); tabsAndContent.Add(new TabContent(i - 1, item, itemStash)); break; } stashView.tabControl.Items.Add(item); } stashView.Loaded -= new System.Windows.RoutedEventHandler(stashView_Loaded); }
void tabControl_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (selectedTab != null) { unselectPreviousTab(selectedTab); } var item = stashView.tabControl.SelectedItem as TabItem; selectedTab = item; Image i = item.Header as Image; CroppedBitmap bm = (CroppedBitmap)i.Source; Tab tab = (Tab)i.Tag; item.Header = StashHelper.GenerateTabImage(tab, true); }
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; }
private Image getImage(Tab tab, bool mouseOver) { return(StashHelper.GenerateTabImage(tab, mouseOver)); }