private int Sort(VolumeGraphItem x, VolumeGraphItem y) { int result; try { if (x.Price == 0.0) { if (y.Price == 0.0) { result = 0; } else if (y.Price > 0.0) { result = -1; } else { result = 1; } } else if (y.Price == 0.0 && x.Price > 0.0) { result = 1; } else if (y.Price == 0.0 && x.Price < 0.0) { result = -1; } else { int num = x.Price.CompareTo(y.Price); if (num != 0) { result = num; } else { result = x.Price.CompareTo(y.Price); } } } catch (Exception ex) { throw new Exception("Function Sort clsGraphPanel " + ex.Message); } return result; }
public void Add(double dblPrice, long lngAccVol, long lngBuyVol, long lngSellVol) { try { VolumeGraphItem volumeGraphItem = new VolumeGraphItem(); volumeGraphItem.Price = dblPrice; volumeGraphItem.AccVol = lngAccVol; if (lngAccVol > this._lngMaxVol) { this._lngMaxVol = lngAccVol; } volumeGraphItem.BuyVol = lngBuyVol; volumeGraphItem.SellVol = lngSellVol; volumeGraphItem.AtoCVol = (double)(volumeGraphItem.AccVol - volumeGraphItem.SellVol - volumeGraphItem.BuyVol); this._graphItems.Add(volumeGraphItem); } catch (Exception ex) { throw new Exception("Sub Add clsGraphPanel " + ex.Message); } }