public void UpdateDir(EnmDir dir) { /* if (_dir == dir) * return; */ if (_volume == 0) { _labelVolume.Background = Brushes.White; _labelPrice.Background = Brushes.White; return; } if (EnmDir.Up == dir) { _labelVolume.Background = Brushes.Pink; _labelPrice.Background = Brushes.Pink; } else if (EnmDir.Down == dir) { _labelVolume.Background = Brushes.LightGreen; _labelPrice.Background = Brushes.LightGreen; } }
public void UpdateVolumesNewStock(EnmDir dir) { decimal price = 0; long volume = 0; int rowNum = 0; int i = 0; try { List <List <CStock> > stockList = null;// ModelMarket.OutpStockClass.StockList; for (i = 0; i < stockList[(sbyte)dir].Count; i++) { CStock stk = stockList[(sbyte)dir][i]; //note if we retrieve price =0 than all other elements are zeroes //and nothing to process if (stk.Price == 0) { //Find lowest and highest from curr stock if (i > 0) { if (dir == EnmDir.Up) { _highestStockPrice = stockList[(sbyte)dir][i - 1].Price; } else if (dir == EnmDir.Down) { _lowestStockPrice = stockList[(sbyte)dir][i - 1].Price; } } break; } price = stk.Price; volume = stk.Volume; //Rownum for current items rowNum = GetRownumByPrice(price); ((CStockRecord)ListBoxStock.Items[rowNum]).Volume = volume; if (volume != 0) { ((CStockRecord)ListBoxStock.Items[rowNum]).Dir = dir; } //for all prices beetwen neighbours prices in stock model fill zeroes //in stock fill zeroes //TO DO move to model or ViewModel if (i > 0) { decimal prevPrice = stockList[(sbyte)dir][i - 1].Price; if (price - prevPrice > _minStep) { int iFrom = GetRownumByPrice(price); int iTo = GetRownumByPrice(prevPrice); for (int j = iFrom + 1; j < iTo; j++) { ((CStockRecord)ListBoxStock.Items[j]).Volume = 0; } } } } } catch (Exception e) { string st = ""; } }