示例#1
0
        public void SendPresence()
        {
            var status = new LeagueStatus(StatusMessage, Status);

            ShowType computed;

            if (DndStatuses.Contains(Status))
            {
                computed = ShowType.dnd;
            }
            else if (ChatMode == ChatMode.Away)
            {
                computed = ShowType.away;
            }
            else
            {
                computed = ShowType.chat;
            }

            var args = new StatusUpdatedEventArgs(status, ChatMode == ChatMode.Invisible ? PresenceType.invisible : PresenceType.available, computed);

            StatusUpdated?.Invoke(this, args);

            if (!connected)
            {
                return;
            }
            xmpp.Send(new Presence(computed, status.ToXML(), 100)
            {
                Type = args.PresenceType
            });
        }
示例#2
0
    public void UpdatePresence(Presence p) {
      IsOffline = p.Status == null;
      if (!IsOffline) {
        Status = new LeagueStatus(p.Status, p.Show);
        if (Status.GameStatus == ChatStatus.inGame) {
          RiotServices.GameService.RetrieveInProgressSpectatorGameInfo(User.Name).ContinueWith(GotGameDTO);
          if (Cache != null)
            CurrentGameFetcher.FetchGame(Cache.Data.Summoner.SummonerId, GotGameInfo);
        } else {
          CurrentGameDTO = null;
          CurrentGameInfo = null;
        }

        Session.Current.SummonerCache.GetData(User.Name, GotSummoner);
        Session.Current.ChatManager.ForceUpdate();
      }
    }
示例#3
0
        public void UpdatePresence(Presence p)
        {
            IsOffline = p.Status == null;
            if (!IsOffline)
            {
                Status = new LeagueStatus(p.Status, p.Show);
                if (Status.GameStatus == ChatStatus.inGame)
                {
                    RiotServices.GameService.RetrieveInProgressSpectatorGameInfo(User.Name).ContinueWith(GotGameDTO);
                    if (Cache != null)
                    {
                        CurrentGameFetcher.FetchGame(Cache.Data.Summoner.SummonerId, GotGameInfo);
                    }
                }
                else
                {
                    CurrentGameDTO  = null;
                    CurrentGameInfo = null;
                }

                Session.Current.SummonerCache.GetData(User.Name, GotSummoner);
                Session.Current.ChatManager.ForceUpdate();
            }
        }
示例#4
0
 public StatusUpdatedEventArgs(LeagueStatus status, PresenceType presenceType, ShowType show)
 {
     Status       = status;
     PresenceType = presenceType;
     Show         = show;
 }
示例#5
0
 public StatusUpdatedEventArgs(LeagueStatus status, PresenceType presenceType, ShowType show) {
   Status = status;
   PresenceType = presenceType;
   Show = show;
 }
示例#6
0
    public void SendPresence() {
      var status = new LeagueStatus(StatusMessage, Status);

      ShowType computed;
      if (DndStatuses.Contains(Status))
        computed = ShowType.dnd;
      else if (ChatMode == ChatMode.Away)
        computed = ShowType.away;
      else
        computed = ShowType.chat;

      var args = new StatusUpdatedEventArgs(status, ChatMode == ChatMode.Invisible ? PresenceType.invisible : PresenceType.available, computed);
      StatusUpdated?.Invoke(this, args);

      if (!connected) return;
      xmpp.Send(new Presence(computed, status.ToXML(), 100) { Type = args.PresenceType });
    }