public Trade(TradeAdministrator admin) { InitializeComponent(); this.MaxHeight = SystemParameters.MaximizedPrimaryScreenHeight; _admin = admin; Closed += Trade_Closed; this.MouseDown += Window_MouseDown; _admin.InitTrade += _admin_InitTrade; _admin.GetMessage += _admin_GetMessage; _admin.UpdateCardsToOffer += _admin_UpdateCardsToOffer; _admin.TradeExit += _admin_TradeExit; _admin.TradeEnd += _admin_TradeEnd; CollectionJ1.GetListview().SelectionChanged += lvPlayer1_SelectionChanged; CollectionJ2.GetListview().SelectionChanged += lvPlayer2_SelectionChanged; LoadStyle(); img_card.MouseEnter += Img_card_MouseEnter; img_card.MouseLeave += Img_card_MouseLeave; img_card.PreviewMouseWheel += Img_card_PreviewMouseWheel; }
private void Trade_Closed(object sender, EventArgs e) { if (!endTrade) { _admin.SendTradeExit(_id); } Closed -= Trade_Closed; _admin.InitTrade -= _admin_InitTrade; _admin.GetMessage -= _admin_GetMessage; _admin.UpdateCardsToOffer -= _admin_UpdateCardsToOffer; _admin.TradeExit -= _admin_TradeExit; _admin.TradeEnd -= _admin_TradeEnd; CollectionJ1.GetListview().SelectionChanged -= lvPlayer1_SelectionChanged; CollectionJ2.GetListview().SelectionChanged -= lvPlayer2_SelectionChanged; }