void setTabBuyout_Click(object sender, RoutedEventArgs e) { try { IStashControl stash = getStash(sender); var tabName = ApplicationState.Stash[ApplicationState.CurrentLeague].GetTabNameByTabId(stash.TabNumber); var pricingInfo = new PricingInfo(); if (Settings.TabsBuyouts.ContainsKey(tabName)) { pricingInfo.Update(Settings.TabsBuyouts[tabName]); } SetTabBuyoutView buyoutView = new SetTabBuyoutView(pricingInfo, tabName); buyoutView.WindowStartupLocation = WindowStartupLocation.CenterScreen; buyoutView.Update += buyoutView_Update; buyoutView.ShowDialog(); } catch (Exception ex) { Logger.Log("Exception in setTabBuyout_Click: " + ex.ToString()); MessageBox.Show("Error setting tabwide buyout, error details logged to DebugInfo.log, please open a ticket at https://github.com/Stickymaddness/Procurement/issues", "Error setting tabwide buyout", MessageBoxButton.OK, MessageBoxImage.Error); } }
private static IStashControl getStash(object sender) { MenuItem source = sender as MenuItem; IStashControl stash = source.Tag as IStashControl; return(stash); }
void refresh_Click(object sender, RoutedEventArgs e) { IStashControl stash = getStash(sender); stash.RefreshTab(ApplicationState.AccountName); ScreenController.Instance.RefreshRecipeScreen(); ScreenController.Instance.UpdateTrading(); }
private MenuItem getMenuItem(IStashControl 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, IStashControl itemStash) { ContextMenu contextMenu = new ContextMenu(); if (!ApplicationState.Model.Offline) { contextMenu.Items.Add(getMenuItem(itemStash, "Refresh", refresh_Click)); } contextMenu.Items.Add(getMenuItem(itemStash, "Set Tabwide Buyout", setTabBuyout_Click)); item.ContextMenu = contextMenu; }
public TabContent(int index, TabItem tabItem, IStashControl stash) { this.Index = index; this.TabItem = tabItem; this.Stash = stash; }
public TabContent(int index, TabItem tabItem, IStashControl stash) { Index = index; TabItem = tabItem; Stash = stash; }