Client/GamerServices/Systems/Friend.cs

60 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace GamerServices {
public class Friend {
public String Username;
public String AvatarURL;
public FormChat ChatWindow;
public bool Online;
public short GameID;
public int UserID;
public FormMain Main;
public Friend(FormMain mainform) {
Main = mainform;
}
public void OpenChat() {
if (ChatWindow != null && !ChatWindow.IsDisposed)
return;
ChatWindow = new FormChat(Main);
ChatWindow.ChattingWith = this;
ChatWindow.Icon = Main.Icon;
ChatWindow.Text = "Chat - " + Username;
ChatWindow.Show();
}
public void ChatMessage(string msg) {
if (ChatWindow == null)
OpenChat();
ChatWindow.AddMessage(Username, msg);
}
public void SetPlaying(short id) {
GameID = id;
if (ChatWindow != null)
ChatWindow.UpdateStatus();
}
public void SetOnline(bool online) {
Online = online;
Main.Popup(Username, online ? "Is now online!" : "Is now offline!", online ? (byte)1 : (byte)0, 1);
if (ChatWindow != null){
ChatWindow.AddMessage(online ? Username + " is now online!" : Username + " is now offline!");
ChatWindow.button1.Enabled = online;
}
Main.UpdateFriendList();
}
}
}