private static void OverlayClickEvent() { if (MainWindow.stashTabOverlay.IsOpen) { var selectedIndex = MainWindow.stashTabOverlay.StashTabOverlayTabControl.SelectedIndex; var isHit = false; var hitIndex = -1; var activeCells = GetAllActiveCells(selectedIndex); var buttonList = new List <ButtonAndCell>(); if (CheckForEditButtonHit(MainWindow.stashTabOverlay.EditModeButton)) { MainWindow.stashTabOverlay.HandleEditButton(); } if (StashTabList.StashTabs[selectedIndex].Quad) { var ctrl = MainWindow.stashTabOverlay.StashTabOverlayTabControl.SelectedContent as DynamicGridControlQuad; foreach (var cell in activeCells) { buttonList.Add(new ButtonAndCell { Button = ctrl.GetButtonFromCell(cell), Cell = cell }); } for (var b = 0; b < buttonList.Count; b++) { if (CheckForHit(GetCoordinates(buttonList[b].Button), buttonList[b].Button)) { isHit = true; hitIndex = b; } } if (isHit) { Data.ActivateNextCell(true, buttonList[hitIndex].Cell); } for (var stash = 0; stash < StashTabList.StashTabs.Count; stash++) { if (CheckForHeaderHit(StashTabList.StashTabs[stash])) { MainWindow.stashTabOverlay.StashTabOverlayTabControl.SelectedIndex = stash; } } } else { var ctrl = MainWindow.stashTabOverlay.StashTabOverlayTabControl.SelectedContent as DynamicGridControl; foreach (var cell in activeCells) { buttonList.Add(new ButtonAndCell { Button = ctrl.GetButtonFromCell(cell), Cell = cell }); } for (var b = 0; b < buttonList.Count; b++) { if (CheckForHit(GetCoordinates(buttonList[b].Button), buttonList[b].Button)) { isHit = true; hitIndex = b; } } if (isHit) { Data.ActivateNextCell(true, buttonList[hitIndex].Cell); } for (var stash = 0; stash < StashTabList.StashTabs.Count; stash++) { if (CheckForHeaderHit(StashTabList.StashTabs[stash])) { MainWindow.stashTabOverlay.StashTabOverlayTabControl.SelectedIndex = stash; } } } } }
// TODO: rework tabitems, tabheaders public new virtual void Show() { if (ChaosRecipeEnhancer.FetchingActive) { ChaosRecipeEnhancer.aTimer.Enabled = false; } if (StashTabList.StashTabs.Count != 0) { IsOpen = true; OverlayStashTabList.Clear(); _tabHeaderGap.Right = Properties.Settings.Default.TabHeaderGap; _tabHeaderGap.Left = Properties.Settings.Default.TabHeaderGap; TabMargin = new Thickness(Properties.Settings.Default.TabMargin, 0, 0, 0); //TabHeaderWidth = new Thickness(Properties.Settings.Default.TabHeaderWidth, 2, Properties.Settings.Default.TabHeaderWidth, 2); foreach (StashTab i in StashTabList.StashTabs) { //i.PrepareOverlayList(); //i.ActivateNextCell(true); TabItem newStashTabItem; TextBlock tbk = new TextBlock() { Text = i.TabName }; //TextBlock tbk = new TextBlock() { Text = i.TabName}; //if (i.ItemOrderList.Count > 0) //{ // if (Properties.Settings.Default.ColorStash != "") // { // tbk.Background = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString(Properties.Settings.Default.ColorStash)); // } // else // { // tbk.Background = Brushes.Red; // } //} //tbk.Background = i.TabHeaderColor; tbk.DataContext = i; tbk.SetBinding(TextBlock.BackgroundProperty, new System.Windows.Data.Binding("TabHeaderColor")); tbk.SetBinding(TextBlock.PaddingProperty, new System.Windows.Data.Binding("TabHeaderWidth")); //tbk.SetBinding(TextBlock.TextProperty, new System.Windows.Data.Binding("TabName")); //tbk.SetBinding(TextBlock.PaddingProperty, new System.Windows.Data.Binding("TabHeaderThickness")); tbk.FontSize = 16; //if(i..Co > 0) //{ // if (Properties.Settings.Default.ColorStash != "") // { // i.TabHeaderColor = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString(Properties.Settings.Default.ColorStash)); // } // else // { // i.TabHeaderColor = Brushes.Red; // } //} i.TabHeader = tbk; //TextBlockList.Add(tbk, i.TabIndex); //string name = i.TabName + "GridControl"; if (i.Quad) { newStashTabItem = new TabItem { Header = tbk, Content = new UserControls.DynamicGridControlQuad { ItemsSource = i.OverlayCellsList, } }; } else { newStashTabItem = new TabItem { Header = tbk, Content = new UserControls.DynamicGridControl { ItemsSource = i.OverlayCellsList } }; } OverlayStashTabList.Add(newStashTabItem); } StashTabOverlayTabControl.SelectedIndex = 0; Data.PrepareSelling(); Data.ActivateNextCell(true, null); if (Properties.Settings.Default.HighlightMode == 2) { foreach (ItemSet set in Data.ItemSetListHighlight) { foreach (Item i in set.ItemList) { StashTab currTab = Data.GetStashTabFromItem(i); currTab.ActivateItemCells(i); } } } MainWindow.overlay.OpenStashOverlayButtonContent = "Hide"; MouseHook.Start(); base.Show(); } else { System.Windows.MessageBox.Show("No StashTabs Available! Fetch before opening Overlay.", "Stashtab Error", MessageBoxButton.OK, MessageBoxImage.Error); } }