/// <summary> /// Вычилсить прибыль и добавить строчку в таблицу /// </summary> /// <param name="ore">тип руды</param> /// <param name="netYield">The net yield.</param> /// <param name="quantity">количество руды для процессинга</param> private double InsertProfitLine(Ore ore, double netYield, int quantity) { int unitProcess = quantity - quantity % ore.UnitsToRefine; int numberOfCycles = quantity / ore.UnitsToRefine; MineralsOut minout = ore.GetMineralsOut(netYield, quantity); double profit = minout.GetMineralProfit(); //Добавляем строчку DataGridViewRow row = new DataGridViewRow(); DataGridViewCell[] cells = new DataGridViewCell[dataGridViewCalc.ColumnCount]; cells[ColumnOreCalc.Index] = new DataGridViewTextBoxCell { Value = ore.Name }; cells[ColumnVolume.Index] = new DataGridViewTextBoxCell { Value = (unitProcess * ore.Volume).ToString("F2") // + " m3" }; cells[ColumnRefVolume.Index] = new DataGridViewTextBoxCell { Value = ((ore.MineralsOut.Tritanium + ore.MineralsOut.Pyerite + ore.MineralsOut.Mexallon + ore.MineralsOut.Isogen + ore.MineralsOut.Nocxium + ore.MineralsOut.Zydrine + ore.MineralsOut.Megacyte + ore.MineralsOut.Morphite) * numberOfCycles * ore.GetEfficiency(netYield) * 0.01).ToString("F2") }; cells[ColumnProfit.Index] = new DataGridViewTextBoxCell { Value = profit.ToString("#,#.##") }; // + " ISK"}; cells[ColumnDelete2.Index] = new DataGridViewButtonCell { Value = "x" }; row.Cells.AddRange(cells); dataGridViewCalc.Rows.Add(row); return(profit); }
/// <summary> /// Called when [mouse enter]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void OnMouseEnter(object sender, EventArgs e) { Control ctrl = sender as Control; if (!toolTipInfo.Active && ctrl != null) { string tooltip = ""; if (ctrl is PictureBox && ctrl.Tag is Ore) { toolTipInfo.ToolTipTitle = "Ore"; Ore ore = (Ore)ctrl.Tag; tooltip = ore.Name; try { double netYield = Convert.ToDouble(textBoxNetYield.Text) / 100; tooltip += string.Format(Environment.NewLine + "Efficiency: {0}", ore.GetEfficiency(netYield)); } catch (FormatException) {} } else if (ctrl is PictureBox && ctrl.Tag is Mineral) { toolTipInfo.ToolTipTitle = "Mineral"; Mineral m = ctrl.Tag as Mineral; tooltip = m.Name + Environment.NewLine + "price: " + m.Price.ToString("F3"); } if (tooltip.Length > 0) { toolTipInfo.SetToolTip(ctrl, tooltip); } toolTipInfo.Active = true; } }