public object aspect_value(object rowObject) { CalculatorItem listItem = (CalculatorItem)rowObject; CoinMarketCapTicker priceItem = PreferenceManager.CoinMarketCapPreferences.Tickers.FirstOrDefault(item => item.symbol == listItem.symbol); Decimal total = 0; if (priceItem != null) { total = numericUpDown_usd.Value / priceItem.price_usd; } return(total.ToString("N8")); }
private void listView_SelectionChanged(object sender, EventArgs e) { if (listView.SelectedItem != null) { CalculatorItem item = listView.SelectedObject as CalculatorItem; numericUpDown_symbol.Value = item.value; label_symbol.Text = item.symbol; pictureBox_symbol.Image = ContentManager.ResizeImage(ContentManager.GetSymbolIcon(item.symbol), PreferenceManager.preferences.IconSize.Width, PreferenceManager.preferences.IconSize.Height); } else { LogManager.AddLogMessage(Name, "listView_SelectionChanged", "IS NULL", LogManager.LogMessageType.DEBUG); } }
private void InitializeSymbolList() { symbolList.Clear(); //LogManager.AddLogMessage(Name, "InitializeSymbolList", ExchangeManager.preferences.symbolList.Count + " Symmbols in List", LogManager.LogMessageType.DEBUG); foreach (string symbol in PreferenceManager.preferences.SymbolWatchList) { //LogManager.AddLogMessage(Name, "InitializeSymbolList", symbol, LogManager.LogMessageType.DEBUG); CalculatorItem item = new CalculatorItem() { symbol = symbol, value = 0 }; symbolList.Add(item); } UpdateUI(); }
public object aspect_icon(object rowObject) { //Machine m = (Machine)rowObject; CalculatorItem e = (CalculatorItem)rowObject; if (e != null) { //return DataManager.ResizeImage(ExchangeManager.GetExchangeImage(e.exchange), 24, 24); return(ContentManager.ResizeImage(ContentManager.GetSymbolIcon(e.symbol), listView.RowHeightEffective, listView.RowHeightEffective)); } else { return(ContentManager.ResizeImage(Properties.Resources.ConnectionStatus_DISABLED, listView.RowHeightEffective, listView.RowHeightEffective)); } }
private void listView_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { if (listView.FocusedItem.Bounds.Contains(e.Location) == true) { if (listView.SelectedObject != null) { CalculatorItem item = listView.SelectedObject as CalculatorItem; ContextMenuStrip menu = new ContextMenuStrip(); ToolStripMenuItem menuItem = new ToolStripMenuItem() { Text = "Remove " + item.symbol }; menuItem.Click += new EventHandler(RemoveItem_Menu_Click); menu.Items.Add(menuItem); menu.Show(Cursor.Position); } } } }