예제 #1
0
        private void treeViewTrade_AfterSelect(object sender, TreeViewEventArgs e)
        {
            textBoxNodeInfo.Text = "";
            TreeNode currentNode = treeViewTrade.SelectedNode;

            if (currentNode.Tag.Equals(NodeLevel.Item))
            {
                string       newText     = currentNode.Text;
                BuySellItem  item        = buySellItems.Find(x => x.id == Convert.ToInt32(currentNode.Name));
                BuySellGroup parentGroup = buySellGroups.Find(x => x.id == Convert.ToInt32(currentNode.Parent.Name));
                if (!parentGroup.isBuy)
                {
                    newText += string.Format(" :: Quality: {0}, Durability: {1}, Price level: {2}"
                                             , item.quality
                                             , item.durability
                                             , item.priceLevel);
                }
                textBoxNodeInfo.Text = Environment.NewLine + newText;
                currentNode          = currentNode.Parent;
            }
            if (currentNode.Tag.Equals(NodeLevel.Group))
            {
                string       newText         = "";
                BuySellGroup currentGroup    = buySellGroups.Find(x => x.id == Convert.ToInt32(currentNode.Name));
                MerchantInfo currentMerchant = merchantInfos.Find(x => x.name == currentNode.Parent.Parent.Name);

                if (currentGroup.isBuy)
                {
                    newText = string.Format("{0} (buy with price level {1})", currentGroup.name, currentGroup.priceLevel);
                }
                else if (currentMerchant.buyallsellitems)
                {
                    newText = string.Format("{0} (sell, buy with price level {1})", currentGroup.name, currentGroup.priceLevel);
                }
                else
                {
                    newText = string.Format("{0} (sell only)", currentGroup.name);
                }
                textBoxNodeInfo.Text = Environment.NewLine + newText + textBoxNodeInfo.Text;
                currentNode          = currentNode.Parent;
            }
            if (currentNode.Tag.Equals(NodeLevel.BuySell))
            {
                currentNode = currentNode.Parent;
            }
            if (currentNode.Tag.Equals(NodeLevel.Merchant))
            {
                string       newText         = string.Format("{0}", currentNode.Name);
                MerchantInfo currentMerchant = merchantInfos.Find(x => x.name == currentNode.Name);
                if (currentMerchant.buyallsellitems)
                {
                    newText += "  (buy all sold items as well)";
                }
                textBoxNodeInfo.Text = newText + textBoxNodeInfo.Text;
            }
        }
예제 #2
0
        private void lastToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode clickedNode = treeViewTrade.SelectedNode;

            BuySellGroup currentGroup = buySellGroups.Find(x => x.id == Convert.ToInt32(clickedNode.Name));

            currentGroup.sort = 9999;
            ResortGroup(clickedNode.Parent);
            RebuildTree();
        }
예제 #3
0
        // context Menue Group
        private void addGroupToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode clickedNode = treeViewTrade.SelectedNode;

            EditGroup editDialog = new EditGroup("new", clickedNode.Name == "1");

            if (editDialog.ShowDialog() == DialogResult.OK)
            {
                int          maxId    = buySellGroups.Max(x => x.id);
                BuySellGroup newGroup = new BuySellGroup(maxId + 1, editDialog.groupName, clickedNode.Parent.Name, 9999, editDialog.isBuy, editDialog.priceLevel);
                buySellGroups.Add(newGroup);
                ResortGroup(clickedNode);
                RebuildTree();
                toolStripStatusLabel.Text = string.Format("Group {0} added", newGroup.name);
                statusStrip.Refresh();
                isEdited = true;
            }
        }
예제 #4
0
        private void deleteGroupWillAllItemsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int      iCount      = 0;
            TreeNode clickedNode = treeViewTrade.SelectedNode;

            treeViewTrade.SelectedNode = treeViewTrade.SelectedNode.Parent;
            foreach (BuySellItem itemToRemove in buySellItems.Where(x => x.buySellGroup == Convert.ToInt32(clickedNode.Name)).ToList <BuySellItem>())
            {
                buySellItems.Remove(itemToRemove);
                iCount++;
            }
            BuySellGroup groupToRemove = buySellGroups.Find(x => x.id == Convert.ToInt32(clickedNode.Name));

            toolStripStatusLabel.Text = string.Format("Group {0} with {1} items removed", groupToRemove.name, iCount);
            buySellGroups.Remove(groupToRemove);
            RebuildTree();
            statusStrip.Refresh();
            isEdited = true;
        }
예제 #5
0
        private void editGroupToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode clickedNode = treeViewTrade.SelectedNode;

            BuySellGroup group      = buySellGroups.Find(x => x.id == Convert.ToInt32(clickedNode.Name));
            EditGroup    editDialog = new EditGroup(group.name, group.isBuy, group.priceLevel);

            if (editDialog.ShowDialog() == DialogResult.OK)
            {
                if (editDialog.groupName != group.name || editDialog.priceLevel != group.priceLevel)
                {
                    group.name       = editDialog.groupName;
                    group.priceLevel = editDialog.priceLevel;
                    RebuildTree();
                    toolStripStatusLabel.Text = string.Format("Group {0} edited", group.name);
                    statusStrip.Refresh();
                    isEdited = true;
                }
            }
        }