private void updateitem(object sender, EventArgs e) { if (mainForm != null) { mainForm.UpdateItemListing(MarketAbuse.GetItem((int)(((Control)sender).Tag))); mainForm.BringToFront(); } }
public CreationForm(string name, List <CreationProcess> listOfItemsBeingCreated, MarketAbuse mainform) { mainForm = mainform; InitializeComponent(); Text = name; creationList = listOfItemsBeingCreated; OrganizeListbox(creationList.Where(a => a != null).OrderBy(a => a.completedItemsNameList).ToList()); Size = new Size(302, 320); }
public bool UpdateItemAdvancedData() { try { MarketAbuse.DownloadFile("http://api.rsbuddy.com/grandExchange?a=guidePrice&i=" + id, "tempItemData.txt"); StreamReader sr = new StreamReader("tempItemData.txt"); string allinfo = sr.ReadToEnd(); sr.Close(); FindItemBuyQuantity(allinfo); FindItemSellQuantity(allinfo); return(true); } catch { return(false); } }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { MarketAbuse.UpdateGEInformation(); itemCombinations.Items.Clear(); switch (comboBox1.Text) { case "Alphabatize": OrganizeListbox(creationList.Where(a => a.margin != "null").OrderBy(a => a.completedItemsNameList).ToList()); break; case "Highest Profit": OrganizeListbox(creationList.Where(a => a.margin != "null").OrderByDescending(a => int.Parse(a.margin)).ToList()); break; case "Lowest Profit": OrganizeListbox(creationList.Where(a => a.margin != "null").OrderBy(a => int.Parse(a.margin)).ToList()); break; } }
private void itemCombinations_DoubleClick(object sender, EventArgs e) { if (sender == null || ((ListBox)sender) == null || ((ListBox)sender).SelectedItem == null || ((ListBox)sender).SelectedItem.ToString() == null) { return; } MarketAbuse.UpdateGEInformation(); for (int i = 0; i < creationList.Count(); i++) { creationList[i].completedItems = UpdateList(creationList[i].completedItems); creationList[i].itemsNeeded = UpdateList(creationList[i].itemsNeeded); } this.Size = new Size(594, 320); CreationProcess process = ((ListBox)sender).SelectedItem as CreationProcess; if (process != null) { Point objectPosition = new Point(6, 16); foreach (object o in createdObjects) { if (o.GetType() == typeof(PictureBox)) { ((PictureBox)o).Dispose(); } else if (o.GetType() == typeof(Label)) { ((Label)o).Dispose(); } else if (o.GetType() == typeof(Panel)) { ((Panel)o).Dispose(); } } createdObjects.Clear(); foreach (Item i in process.itemsNeeded) { i.UpdateItemData(); string nameAmount = (i.quantity == 1) ? "Name: " + i.name : "Name: " + i.name + " x" + i.quantity; string buyamount = (i.quantity == 1) ? "Buy Price: " + (i.buyPrice).ToString("#,##0") : "Buy Price: " + (i.buyPrice * i.quantity).ToString("#,##0") + " (" + i.buyPrice + " ea)"; CreateLabel(nameAmount, ref objectPosition, ref createdObjects, groupBox3, process, i); Panel tempPanel = new Panel(); tempPanel.Location = ((Label)createdObjects[createdObjects.Count() - 1]).Location; CreateLabel(buyamount, ref objectPosition, ref createdObjects, groupBox3, process, i); Label label = ((Label)createdObjects[createdObjects.Count() - 1]); Size s = new Size(tempPanel.Width, label.Location.Y - tempPanel.Location.Y + label.Height); tempPanel.Size = s; tempPanel.DoubleClick += new EventHandler(updateitem); tempPanel.BorderStyle = BorderStyle.None; tempPanel.Parent = groupBox3; tempPanel.Tag = i.id; createdObjects.Add(tempPanel); } foreach (Item i in process.completedItems) { string nameAmount = (i.quantity == 1)? "Name: " + i.name: "Name: " + i.name + " x" + i.quantity; string sellamount = (i.quantity == 1) ? "Sell Price: " + (i.sellPrice).ToString("#,##0") : "Sell Price: " + (i.sellPrice * i.quantity).ToString("#,##0") + " (" + i.sellPrice + " ea)"; CreateLabel(nameAmount, ref objectPosition, ref createdObjects, groupBox3, process, i); Panel tempPanel = new Panel(); tempPanel.Location = ((Label)createdObjects[createdObjects.Count() - 1]).Location; CreateLabel(sellamount, ref objectPosition, ref createdObjects, groupBox3, process, i); Label label = ((Label)createdObjects[createdObjects.Count() - 1]); Size s = new Size(tempPanel.Width, label.Location.Y - tempPanel.Location.Y + label.Height); tempPanel.Size = s; tempPanel.DoubleClick += new EventHandler(updateitem); tempPanel.BorderStyle = BorderStyle.None; tempPanel.Parent = groupBox3; tempPanel.Tag = i.id; createdObjects.Add(tempPanel); } string margin = (process.margin == "null") ? "Margin: " + process.margin : "Margin: " + int.Parse(process.margin).ToString("#,##0"); CreateLabel(margin, ref objectPosition, ref createdObjects, groupBox3, process); } else { MessageBox.Show("This item has not been configured yet."); } }