/// <summary>
        /// Lurkers the trade accepted.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        private async void Lurker_TradeAccepted(object sender, Patreon.Events.TradeAcceptedEvent e)
        {
            if (this._activeOffer == null)
            {
                return;
            }

            if (!string.IsNullOrEmpty(this.SettingsService.ThankYouMessage))
            {
                var tradeEvent = this._activeOffer.Event;
                await this._keyboardHelper.Whisper(tradeEvent.PlayerName, TokenHelper.ReplaceToken(this.SettingsService.ThankYouMessage, tradeEvent));
            }

            var activePlayer = this._playerService.FirstPlayer;

            if (activePlayer != null && this.SettingsService.AutoKickEnabled)
            {
                await this._keyboardHelper.Kick(activePlayer.Name);
            }

            await this.InsertEvent(this._activeOffer.Event);

            this.RemoveOffer(this._activeOffer);
            this._activeOffer  = null;
            this._removeActive = null;
        }
        /// <summary>
        /// Removes the offer.
        /// </summary>
        /// <param name="offer">The offer.</param>
        private void RemoveOffer(OutgoingOfferViewModel offer)
        {
            if (offer == this._activeOffer)
            {
                this._removeActive?.Invoke();
            }

            this._timer.Stop();
            Execute.OnUIThread(() => this.Offers.Remove(offer));
            this._timer.Start();
        }
Beispiel #3
0
        /// <summary>
        /// Lurkers the trade accepted.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        private void Lurker_TradeAccepted(object sender, Events.TradeAcceptedEvent e)
        {
            if (this._activeOffer == null)
            {
                return;
            }

            if (!string.IsNullOrEmpty(this._settingsService.ThankYouMessage))
            {
                this._keyboardHelper.Whisper(this._activeOffer.Event.PlayerName, this._settingsService.ThankYouMessage);
            }

            this.RemoveOffer(this._activeOffer);
            this._activeOffer  = null;
            this._removeActive = null;
        }
Beispiel #4
0
        /// <summary>
        /// Sets the active offer.
        /// </summary>
        /// <param name="offer">The offer.</param>
        private void SetActiveOffer(OutgoingOfferViewModel offer)
        {
            if (this._activeOffer != null)
            {
                this._activeOffer.Active = false;
            }

            this._activeOffer = offer;
            this._activeOffer.SetActive();

            this._eventAggregator.PublishOnUIThread(new LifeBulbMessage()
            {
                View   = new TradeValueViewModel(offer.Event),
                OnShow = (a) => { this._removeActive = a; },
                Action = () => { this._keyboardHelper.Trade(offer.Event.PlayerName); }
            });
        }
        /// <summary>
        /// Lurkers the trade accepted.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        private void Lurker_TradeAccepted(object sender, Patreon.Events.TradeAcceptedEvent e)
        {
            if (this._activeOffer == null)
            {
                return;
            }

            if (!string.IsNullOrEmpty(this.SettingsService.ThankYouMessage))
            {
                var tradeEvent = this._activeOffer.Event;
                this._keyboardHelper.Whisper(tradeEvent.PlayerName, TokenHelper.ReplaceToken(this.SettingsService.ThankYouMessage, tradeEvent));
            }

            this.InsertEvent(this._activeOffer.Event);
            this.RemoveOffer(this._activeOffer);
            this._activeOffer  = null;
            this._removeActive = null;
        }
        /// <summary>
        /// Sets the active offer.
        /// </summary>
        /// <param name="offer">The offer.</param>
        private void SetActiveOffer(OutgoingOfferViewModel offer)
        {
            this.DockingHelper.SetForeground();

            if (offer.Active)
            {
                return;
            }

            if (this._activeOffer != null)
            {
                this._activeOffer.Active = false;
            }

            this._activeOffer = offer;
            this._activeOffer.SetActive();

            this._eventAggregator.PublishOnUIThread(new LifeBulbMessage()
            {
                View   = new TradeValueViewModel(offer.Event, this.SettingsService),
                OnShow = (a) => { this._removeActive = a; },
                Action = async() => { await this._keyboardHelper.Trade(offer.Event.PlayerName); },
            });
        }