本文整理汇总了C#中Friend类的典型用法代码示例。如果您正苦于以下问题:C# Friend类的具体用法?C# Friend怎么用?C# Friend使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Friend类属于命名空间,在下文中一共展示了Friend类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddFriend
public void AddFriend(string name)
{
Friend friend = new Friend();
friend.Name = name;
friends.Add(friend);
}
示例2: AddFriend
public void AddFriend(Friend f, bool program = false)
{
if (!friends.Contains(f, (new FriendsComparer())))
{
friends.Add(f);
TabItem t = new TabItem();
t.Header = f.NickName;
MyTabItem m = new MyTabItem(ref f, nickname,program);
t.Content = m;
tabControl1.Items.Add(t);
if (!program || tabControl1.Items.Count == 1)
{
((TabItem)tabControl1.Items[tabControl1.Items.Count - 1]).Focus();
tabControl1.SelectedIndex = tabControl1.Items.Count - 1;
}
}
else
{
bool find = false;
for (int i = 0; i < friends.Count && !find; i++)
{
if (friends[i].Thread_Id == f.Thread_Id)
{
find = true;
((TabItem)tabControl1.Items[i]).Focus();
}
}
}
Show();
}
示例3: HashSetTest
// No duplicate entries
public void HashSetTest()
{
Friend chris = new Friend("Chris",10,1230,1);
Friend john = new Friend("John",5,234,3);
Friend annie = new Friend("Annie",7,902,2);
Friend rosy = new Friend("Rosy",1,10,4);
HashSet<Friend> friend_list = new HashSet<Friend>();
friend_list.Add(chris);
friend_list.Add(john);
friend_list.Add(annie);
friend_list.Add(rosy);
StringBuilder str = new StringBuilder();
foreach(Friend friend in friend_list)
{
str.Append("Name: ");str.Append(friend.name);
str.Append(" / ");
str.Append("Level: ");str.Append(friend.level);
str.Append(" / ");
str.Append("Point: ");str.Append(friend.point);
str.Append(" / ");
str.Append("Rank: ");str.Append(friend.rank);
str.Append("\n");
}
textResult.text = str.ToString();
}
示例4: StartByInvitation
public void StartByInvitation(Friend friend, OperationCompleteEvent opCompleteEvent, object tag)
{
object[] objs = (object[])tag;
string sbIP = (string)objs[0];
int sbPort = (int)objs[1];
string hash = (string)objs[2];
string sessionID = (string)objs[3];
try
{
Proxy.IConnection conn = this.control.CreateConnection();
conn.Connect("", 0, sbIP, sbPort, Proxy.ConnectionType.Tcp);
sbRouter = new MessageRouter(this.protocol, conn, null, null);
RegisterCodeEvents();
sbRouter.SendMessage(Message.ConstructMessage("ANS",
this.settings.Username + " " + hash + " " + sessionID),
new ResponseReceivedHandler(OnAnswerResponse), opCompleteEvent);
}
catch
{
opCompleteEvent.Execute(new OperationCompleteArgs("Could not connect", true));
}
}
示例5: OnClick
void OnClick()
{
var friendContentUIManager = (FriendContentUIManager)FindObjectOfType<FriendContentUIManager>();
if (friendContentUIManager)
{
friendContentUIManager.hideFriendContentWindow();
}
string friendName = Title.text;
long uid = 0;
Friend f = new Friend();
List<Friend> applyLsit = MonoInstancePool.getInstance<FriendManager>().applyLsit;
foreach (Friend friend in applyLsit)
{
if (friend.friendName == friendName)
{
uid = friend.fiendId;
f = friend;
}
}
MonoInstancePool.getInstance<FriendManager>().applyLsit.Remove(f);
MonoInstancePool.getInstance<SendFriendSystemHander>().SendAgreeOrDisagree(uid, true);
var inviteListUIManager = (InviteListUIManager)FindObjectOfType<InviteListUIManager> ();
inviteListUIManager.deleteInviteFriendObject (uid);
//MonoInstancePool.getInstance<FriendManager>().inviteObject.Remove(transform.parent.gameObject);
//Destroy(transform.parent.gameObject);
//for(int i =0; i < MonoInstancePool.getInstance<FriendManager>().inviteObject.Count; i++)
//{
// MonoInstancePool.getInstance<FriendManager>().inviteObject[i].transform.localPosition = new Vector3(-370, 90 - (i * 108), 0);
//}
}
示例6: GetStatusColor
public Color GetStatusColor(Friend steamid)
{
Color inGame = this.settings.Color.StatusIngameFore;
Color online = this.settings.Color.StatusOnlineFore;
Color offline = this.settings.Color.StatusOfflineFore;
Color blocked = this.settings.Color.StatusBlockedFore;
Color invited = this.settings.Color.StatusInvitedFore;
Color requesting = this.settings.Color.StatusInvitedBack;
if (steamid.IsAcceptingFriendship())
{
return invited;
}
else if (steamid.IsRequestingFriendship())
{
return requesting;
}
else if (steamid.IsBlocked())
{
return blocked;
}
else if (steamid.IsInGame())
{
return inGame;
}
else if (!steamid.IsOnline())
{
return offline;
}
return online;
}
示例7: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
m_FriendUserID = _Request.Get<int>("uid", Method.Get, 0);
if (_Request.IsClick("shieldfriend"))
{
Shield();
return;
}
using (ErrorScope es = new ErrorScope())
{
m_FriendToShield = FriendBO.Instance.GetFriend(MyUserID, m_FriendUserID);
WaitForFillSimpleUser<Friend>(m_FriendToShield);
if (es.HasUnCatchedError)
{
es.CatchError<ErrorInfo>(delegate(ErrorInfo error)
{
ShowError(error);
return;
});
}
}
}
示例8: ReadPacket
public void ReadPacket(PacketReader reader)
{
Unknown1 = reader.ReadInt32();
var count = reader.ReadInt32();
Friends = new List<Friend>();
for (int i = 0; i < count; i++)
{
Friend friend = new Friend();
friend.UserID1 = reader.ReadInt64();
friend.UserID2 = reader.ReadInt64();
friend.Username = reader.ReadString();
friend.FacebookID = reader.ReadString();
friend.Unknown3 = reader.ReadString();
friend.Unknown4 = reader.ReadInt32();
friend.Level = reader.ReadInt32();
friend.Unknown6 = reader.ReadInt32();
friend.Trophies = reader.ReadInt32();
friend.HasClan = reader.ReadBoolean();
if (friend.HasClan)
{
friend.ClanID = reader.ReadInt64();
friend.ClanUnknown1 = reader.ReadInt32();
friend.ClanName = reader.ReadString();
friend.ClanRole = reader.ReadInt32();
friend.ClanLevel = reader.ReadInt32();
}
Friends.Add(friend);
}
}
示例9: SaveFriend
public void SaveFriend(Friend friend)
{
using (var dataService = _dataServiceCreator())
{
dataService.SaveFriend(friend);
}
}
示例10: FriendshipBaseEvent
public FriendshipBaseEvent(Friend f)
{
this.mFriendRelationId = f.FriendRelationID;
this.mUser1 = f.User1;
this.mUser2 = f.User2;
this.mEventTime = f.FriendsSince;
}
示例11: onGetFriendList
//获取好友列表
public void onGetFriendList(SocketModel module)
{
FriendMessage.MsgFriendListRep msg = MsgSerializer.Deserialize<FriendMessage.MsgFriendListRep>(module);
MonoInstancePool.getInstance<FriendManager>().friendList.Clear();
MonoInstancePool.getInstance<FriendManager>().applyLsit.Clear();
for (int i = 0; i < msg.FriendAry.Count; i++)
{
Friend friend = new Friend();
friend.fiendId = msg.FriendAry[i].uid;
friend.friendName = msg.FriendAry[i].name;
friend.friendLevel = msg.FriendAry[i].level;
friend.imageID = msg.FriendAry[i].headid;
friend.vipLevel = msg.FriendAry[i].vip;
if (msg.type == (int)GlobalDef.FriendType.FriendList)
{
MonoInstancePool.getInstance<FriendManager>().friendList.Add(friend);
}
else if (msg.type == (int)GlobalDef.FriendType.InviteList)
{
MonoInstancePool.getInstance<FriendManager>().applyLsit.Add(friend);
}
}
if (msg.type == (int)GlobalDef.FriendType.FriendList) //显示好友列表
{
MonoInstancePool.getInstance<FriendManager>().IsDirty = true;
}
else if (msg.type == (int)GlobalDef.FriendType.InviteList) //显示邀请好友列表
{
MonoInstancePool.getInstance<FriendManager>().IsDirty = true;
}
}
示例12: OnClick
void OnClick()
{
var friendContentUIManager = (FriendContentUIManager)FindObjectOfType<FriendContentUIManager>();
if (friendContentUIManager)
{
friendContentUIManager.hideFriendContentWindow();
}
string friendName = Title.text;
long uid = 0;
Friend f = new Friend();
List<Friend> applyLsit = MonoInstancePool.getInstance<FriendManager>().applyLsit;
foreach (Friend friend in applyLsit)
{
if (friend.friendName == friendName)
{
uid = friend.fiendId;
f = friend;
}
}
MonoInstancePool.getInstance<FriendManager>().applyLsit.Remove(f);
MonoInstancePool.getInstance<SendFriendSystemHander>().SendAgreeOrDisagree(uid, false);
var inviteListUIManager = (InviteListUIManager)FindObjectOfType<InviteListUIManager> ();
inviteListUIManager.deleteInviteFriendObject (uid);
//MonoInstancePool.getInstance<FriendManager>().inviteObject.Remove(transform.parent.gameObject);
//Destroy(transform.parent.gameObject);
}
示例13: OnNavigatedTo
protected override void OnNavigatedTo(NavigationEventArgs e)
{
string friendName;
NavigationContext.QueryString.TryGetValue("friend-name", out friendName);
if (friendName == null)
{
NavigationService.GoBack();
return;
}
Friend friend = App.IsolatedStorage.UserAccount.Friends.First(f => f.Name == friendName);
if (friend == null || App.IsolatedStorage.FriendsBests == null)
{
NavigationService.GoBack();
return;
}
_friend = friend;
LabelUserName.DataContext = App.IsolatedStorage.UserAccount.Friends.First(f => f.Name == friendName);
LabelDisplayName.DataContext = App.IsolatedStorage.UserAccount.Friends.First(f => f.Name == friendName);
Best usersBests;
App.IsolatedStorage.FriendsBests.TryGetValue(friend.Name, out usersBests);
if (usersBests == null)
{
usersBests = new Best
{
BestFriends = new string[] {},
Score = 0
};
}
DataContext = usersBests;
base.OnNavigatedTo(e);
}
示例14: GetAllAccount
public ICollection<Friend> GetAllAccount(Friend acc)
{
using (NHibernate.ISession session = SessionFactory.GetNewSession())
{
return session.CreateCriteria(typeof(Friend)).List<Friend>();
}
}
示例15: RefreshDynamicElements
public void RefreshDynamicElements(Player player, Friend friend)
{
this.DynamicElements["playerBeerBelly"].Text = player.BeerBelly.ToString();
this.DynamicElements["playerLife"].Text = player.Life.ToString();
this.DynamicElements["playerHealth"].Text = player.Health.ToString(CultureInfo.CurrentUICulture);
this.DynamicElements["friendLife"].Text = friend.Life.ToString();
this.DynamicElements["friendHealth"].Text = friend.Health.ToString(CultureInfo.CurrentUICulture);
}