private void SellStocks(string stockid, INetworkTradeable tradeable, MarketState marketstate, int stockstosell) { try { if (SelectedServer.Version.Major > 0) { lock (SynchronizeRoot) { SendCommand(Commands.SellStocks); SendString(stockid); Game.ClientSellingStocks(SelectedServer.Version, this, tradeable, marketstate, stockstosell); } if (Game.UpdateStockInformationsEvent != null) { Synchronize.Invoke(Game.UpdateStockInformationsEvent, null); } if (Game.UpdatePlayerInformationsEvent != null) { Synchronize.Invoke(Game.UpdatePlayerInformationsEvent, null); } } } catch (System.ObjectDisposedException) { // The socket has been closed. } catch (System.Net.Sockets.SocketException ex) { switch (ex.SocketErrorCode) { case System.Net.Sockets.SocketError.ConnectionAborted: // Don't throw an excetion, the connection has just aborted. break; default: throw ex; } } catch (System.Exception ex) { throw ex; } }
public void ClientBuyingStocks(Version serverversion, ICommunicateable communicator, INetworkTradeable tradeable, MarketState marketstate, int stockstobuy) { try { if (serverversion.Major > 0) { lock (SynchronizeRoot) { tradeable.ClientBuyStocks(serverversion, communicator, marketstate, stockstobuy); } } } catch (System.Exception ex) { throw ex; } }