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 lvPlayer2_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (CollectionJ2.SelectedItem() == null)
     {
         return;
     }
     _idCardShow     = ((PlayerCard)CollectionJ2.SelectedItem()).Id;
     img_card.Source = FormExecution.AssetsManager.GetPics(new string[] { "BattleCityAlpha", "pics", ((PlayerCard)CollectionJ2.SelectedItem()).Id + ".jpg" });
 }
        private void _admin_InitTrade(int id, PlayerInfo[] players, Dictionary <int, BCA.Common.PlayerCard>[] Collections)
        {
            _id              = id;
            _players         = players;
            this.Title       = _players[0].Username + " & " + _players[1].Username;
            this.nameJ1.Text = "Collection de " + _players[0].Username;
            this.nameJ2.Text = "Collection de " + _players[1].Username;

            CollectionJ1.UpdateCollection(Collections[0]);
            CollectionJ2.UpdateCollection(Collections[1]);

            btnValidate.IsEnabled = true;
        }
        private void _admin_UpdateCardsToOffer(List <PlayerCard> cards)
        {
            CollectionJ1.Clear();
            foreach (var card in _cardsToOffer)
            {
                CollectionJ1.Add(card.Value);
            }
            CollectionJ2.Clear();
            foreach (PlayerCard card in cards)
            {
                CollectionJ2.Add(card);
            }

            btnValidate.IsEnabled = true;
        }
        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;
        }