Example #1
0
        /// <summary>
        /// Returns the friend with the specified steam id
        /// </summary>
        /// <param name="steamId"></param>
        /// <returns></returns>
        public static Friend GetFriendBySteamId(String steamId)
        {
            FriendsAdapter adapter = SteamAdapters.GetFriendsAdapter();

            for (int i = 0; i < adapter.Count; i++)
            {
                if (adapter.GetFriendAt(i).SteamId.ToString() == steamId)
                {
                    return(adapter.GetFriendAt(i));
                }
            }

            throw new Exception("Error retrieving friend by Steam ID: " + steamId);
        }
Example #2
0
        protected override void OnListItemClick(ListView l, View v, int position, long id)
        {
            base.OnListItemClick(l, v, position, id);

            FriendsAdapter adapter = SteamAdapters.GetFriendsAdapter();
            Friend         friend  = adapter.GetFriendAt(position);

            if (SteamService.GetClient().Friends.GetPersonaState() == SteamKit2.EPersonaState.Offline)
            {
                SteamAlerts.ShowToast("Your state is set to offline");
            }
            else if (friend.State == SteamKit2.EPersonaState.Offline)
            {
                SteamAlerts.ShowToast(friend.Name + " is offline");
            }
            else
            {
                Intent chatIntent = new Intent(this, typeof(Chat));
                chatIntent.PutExtra("steam_id", friend.SteamId.ToString());
                StartActivity(chatIntent);
            }
        }