예제 #1
0
        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);
        }
예제 #2
0
        void setTabBuyout_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                StashControl 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);
            }
        }
예제 #3
0
        private static StashControl getStash(object sender)
        {
            MenuItem     source = sender as MenuItem;
            StashControl stash  = source.Tag as StashControl;

            return(stash);
        }
예제 #4
0
        void refresh_Click(object sender, RoutedEventArgs e)
        {
            MenuItem     source = sender as MenuItem;
            StashControl stash  = source.Tag as StashControl;

            stash.RefreshTab();
        }
예제 #5
0
        void refresh_Click(object sender, RoutedEventArgs e)
        {
            MenuItem     source = sender as MenuItem;
            StashControl stash  = source.Tag as StashControl;

            stash.RefreshTab();
            ScreenController.Instance.InvalidateRecipeScreen();
        }
예제 #6
0
        void refresh_Click(object sender, RoutedEventArgs e)
        {
            StashControl stash = getStash(sender);

            stash.RefreshTab(ApplicationState.AccountName);
            ScreenController.Instance.InvalidateRecipeScreen();
            ScreenController.Instance.UpdateTrading();
        }
예제 #7
0
        void refresh_Click(object sender, RoutedEventArgs e)
        {
            StashControl stash = getStash(sender);

            stash.RefreshTab(Settings.UserSettings["AccountName"]);
            ScreenController.Instance.InvalidateRecipeScreen();
            ScreenController.Instance.UpdateTrading();
        }
예제 #8
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
                };

                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);
        }
예제 #9
0
        private void refreshTab(object sender)
        {
            StashControl stash = getStash(sender);

            stash.RefreshTab(ApplicationState.AccountName);
            ScreenController.Instance.InvalidateRecipeScreen();
            ScreenController.Instance.InvalidateTradingScreen();
            ScreenController.Instance.UpdateTrading();
        }
예제 #10
0
        private void MouseEnterDrawRectangle(object sender, System.Windows.Input.MouseEventArgs e)
        {
            // Clear canvas before drawing new rectangle
            front_canvas.Children.Clear();

            // Start timer to clear canvas after some time
            StartDispatcherTimer();

            // Cast sender as StashControl
            StashControl stashControl = (StashControl)sender;

            double x = stashControl.GetTItem.StashPosition.X;

            double y = stashControl.GetTItem.StashPosition.Y;

            // Nomber of stash columns
            int nbrRectStash = 12;

            // Set rectangle size by dividing canvas by number of columns
            double rectDimensionX = ((front_canvas.Width) / 12);

            // Check if stash is quad. If true divide rectangle size and multiply number of columns by 2
            foreach (var item in Settings.Default.QuadStash)
            {
                if (item == stashControl.GetTItem.Stash)
                {
                    rectDimensionX = rectDimensionX / 2;
                    nbrRectStash   = nbrRectStash * 2;
                }
            }

            for (int iX = 1; iX <= nbrRectStash; iX++)
            {
                // Create the rectangle
                Rectangle rectangleHighlight = new Rectangle()
                {
                    Width           = rectDimensionX,
                    Height          = rectDimensionX,
                    Stroke          = Brushes.Red,
                    StrokeThickness = 1,
                };

                if (iX == x)
                {
                    for (int iY = 1; iY <= nbrRectStash; iY++)
                    {
                        if (iY == y)
                        {
                            front_canvas.Children.Add(rectangleHighlight);
                            Canvas.SetLeft(rectangleHighlight, (iX - 1) * rectDimensionX);
                            Canvas.SetTop(rectangleHighlight, (iY - 1) * rectDimensionX);
                        }
                    }
                }
            }
        }
예제 #11
0
        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);
        }
예제 #12
0
        public void AddButton(TradeItem tItemArgs)
        {
            UpdateLocationAndSize();

            if (ContainsItem(tItemArgs) == false && !String.IsNullOrEmpty(tItemArgs.Stash))
            {
                StashControl sCtrl = new StashControl(tItemArgs);

                sCtrl.MouseEnter += MouseEnterDrawRectangle;

                spnl_Buttons.Children.Add(sCtrl);
            }
        }
예제 #13
0
        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, "Set Tabwide Buyout", setTabBuyout_Click));

            item.ContextMenu = contextMenu;
        }
        private void MouseEnterDrawPoint(object sender, System.Windows.Input.MouseEventArgs e)
        {
            front_canvas.Children.Clear();

            StartDispatcherTimer();

            StashControl stashControl = (StashControl)sender;

            double x = stashControl.GetTItem.StashPosition.X;

            double y = stashControl.GetTItem.StashPosition.Y;

            int nbrRectStash = 12;

            double rectDimensionX = ((front_canvas.Width) / 12);

            foreach (var item in Settings.Default.QuadStash)
            {
                if (item == stashControl.GetTItem.Stash)
                {
                    rectDimensionX = rectDimensionX / 2;
                    nbrRectStash   = nbrRectStash * 2;
                }
            }

            for (int iX = 1; iX <= nbrRectStash; iX++)
            {
                // Create the rectangle
                Rectangle rectangleHighlight = new Rectangle()
                {
                    Width           = rectDimensionX,
                    Height          = rectDimensionX,
                    Stroke          = Brushes.Red,
                    StrokeThickness = 1,
                };

                if (iX == x)
                {
                    for (int iY = 1; iY <= nbrRectStash; iY++)
                    {
                        if (iY == y)
                        {
                            front_canvas.Children.Add(rectangleHighlight);
                            Canvas.SetLeft(rectangleHighlight, (iX - 1) * rectDimensionX);
                            Canvas.SetTop(rectangleHighlight, (iY - 1) * rectDimensionX);
                        }
                    }
                }
            }
        }
        public void AddButton(TradeItem tItemArgs)
        {
            UpdateLocation();

            foreach (StashControl item in spnl_Buttons.Children)
            {
                if (item.GetTItem.Item == tItemArgs.Item && item.GetTItem.Customer == tItemArgs.Customer && item.GetTItem.Price == tItemArgs.Price)
                {
                    return;
                }
            }
            StashControl sCtrl = new StashControl(tItemArgs);

            sCtrl.MouseEnter += MouseEnterDrawPoint;

            spnl_Buttons.Children.Add(sCtrl);
        }
        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);
        }
예제 #17
0
 public WhatsInTheBox(int index, TabItem tabItem, StashControl stash)
 {
     this.Index   = index;
     this.TabItem = tabItem;
     this.Stash   = stash;
 }
예제 #18
0
 public TabContent(int index, TabItem tabItem, StashControl stash)
 {
     this.Index   = index;
     this.TabItem = tabItem;
     this.Stash   = stash;
 }