public void ShowContextMenu(Control displayControl, FriendControl friendControl, Point point) { if (friendControl.Friend.SteamID == SteamContext.SteamUser.GetSteamID()) { return; } contextMenu.Show(displayControl, point); contextMenu.Tag = friendControl; }
private void removeAliasToolStripMenuItem_Click(object sender, EventArgs e) { FriendControl fc = contextMenu.Tag as FriendControl; if (fc == null) { return; } SteamContext.ClientFriends.SetFriendAlias(fc.Friend.SteamID, ""); }
void HandleStateChange(PersonaStateChange_t param) { FriendControl fc = friendsFlow.GetFriendControl(new Friend(param.m_ulSteamID)); if (fc == null) { return; } // force update fc.SetSteamID(fc.Friend); }
private void setAliasToolStripMenuItem_Click(object sender, EventArgs e) { FriendControl fc = contextMenu.Tag as FriendControl; if (fc == null) { return; } AliasForm af = new AliasForm(); if (af.ShowDialog(this) != DialogResult.OK) { return; } SteamContext.ClientFriends.SetFriendAlias(fc.Friend.SteamID, af.Alias); }
void ReloadFriends() { List<Friend> friendsList = GetFriends(); friendsList.Sort( ( a, b ) => { if ( a.IsInGame() && b.IsInGame() ) return StringComparer.OrdinalIgnoreCase.Compare( a.GetName(), b.GetName() ); if ( !a.IsOnline() && !b.IsOnline() ) return StringComparer.OrdinalIgnoreCase.Compare( a.GetName(), b.GetName() ); if ( a.IsOnline() && !a.IsInGame() && b.IsOnline() && !b.IsInGame() ) return StringComparer.OrdinalIgnoreCase.Compare( a.GetName(), b.GetName() ); if ( a.IsInGame() && !b.IsInGame() ) return -1; if ( a.IsOnline() && !b.IsOnline() ) return -1; if ( !a.IsInGame() && b.IsInGame() ) return 1; if ( !a.IsOnline() && b.IsOnline() ) return 1; return 0; } ); int scroll = friendsFlow.VerticalScroll.Value; friendsFlow.SuspendLayout(); friendsFlow.Controls.Clear(); foreach ( Friend friend in friendsList ) { FriendControl fc = new FriendControl( friend ); friendsFlow.Controls.Add( fc ); } ResizeFriends(); friendsFlow.ResumeLayout(); friendsFlow.PerformLayout(); friendsFlow.Refresh(); friendsFlow.VerticalScroll.Value = scroll; }
public void ShowContextMenu( Control displayControl, FriendControl friendControl, Point point ) { if ( friendControl.Friend.SteamID == SteamContext.SteamUser.GetSteamID() ) return; contextMenu.Show( displayControl, point ); contextMenu.Tag = friendControl; }
void ReloadFriends() { List <Friend> friendsList = GetFriends(); friendsList.Sort((a, b) => { if (a.IsInGame() && b.IsInGame()) { return(StringComparer.OrdinalIgnoreCase.Compare(a.GetName(), b.GetName())); } if (!a.IsOnline() && !b.IsOnline()) { return(StringComparer.OrdinalIgnoreCase.Compare(a.GetName(), b.GetName())); } if (a.IsOnline() && !a.IsInGame() && b.IsOnline() && !b.IsInGame()) { return(StringComparer.OrdinalIgnoreCase.Compare(a.GetName(), b.GetName())); } if (a.IsInGame() && !b.IsInGame()) { return(-1); } if (a.IsOnline() && !b.IsOnline()) { return(-1); } if (!a.IsInGame() && b.IsInGame()) { return(1); } if (!a.IsOnline() && b.IsOnline()) { return(1); } return(0); }); int scroll = friendsFlow.VerticalScroll.Value; friendsFlow.SuspendLayout(); friendsFlow.Controls.Clear(); foreach (Friend friend in friendsList) { FriendControl fc = new FriendControl(friend); friendsFlow.Controls.Add(fc); } ResizeFriends(); friendsFlow.ResumeLayout(); friendsFlow.PerformLayout(); friendsFlow.Refresh(); friendsFlow.VerticalScroll.Value = scroll; }