本文整理汇总了C#中Member.MarkAsDeleted方法的典型用法代码示例。如果您正苦于以下问题:C# Member.MarkAsDeleted方法的具体用法?C# Member.MarkAsDeleted怎么用?C# Member.MarkAsDeleted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Member
的用法示例。
在下文中一共展示了Member.MarkAsDeleted方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnRecievedData
// (4) Send The Recieved Data to All Clients in The Room
private static void OnRecievedData(IAsyncResult ar)
{
SocketCoderClient client = (SocketCoderClient)ar.AsyncState;
byte[] aryRet = client.GetRecievedData(ar);
if (aryRet.Length < 1)
{
// client.Sock.RemoteEndPoint - "has left the room"
client.ReadOnlySocket.Shutdown(SocketShutdown.Both);
client.ReadOnlySocket.Close();
// ClientsList.Remove(client);
return;
}
try
{
MemoryStream msgStream = new MemoryStream();
ClientCommand msgCommand = new ClientCommand();
msgStream.Write(aryRet, 0, aryRet.Length);
BinaryFormatter deserializer = new BinaryFormatter();
msgStream.Position = 0;
msgCommand = (ClientCommand)deserializer.Deserialize(msgStream);
switch (msgCommand.MessageType)
{
case ClientCommand.msgType.JoinRoom:
ArrayList RoomMembers;
if (Clients.ContainsKey(msgCommand.ChatRoomID))
{
RoomMembers = Clients[msgCommand.ChatRoomID];
client.username = msgCommand.Sender;
RoomMembers.Add(client);
Clients[msgCommand.ChatRoomID] = RoomMembers;
}
else
{
RoomMembers = new ArrayList();
client.username = msgCommand.Sender;
RoomMembers.Add(client);
Clients.Add(msgCommand.ChatRoomID, RoomMembers);
}
try
{
Member member = new Member();
member.AddNew();
member.ChatRoomID = msgCommand.ChatRoomID;
member.MemberID = msgCommand.Sender;
member.Save();
}
catch (Exception ex)
{
}
ArrayList Members1 = Clients[msgCommand.ChatRoomID];
for (int i = 0; i < Members1.Count; i++)
{
SocketCoderClient Current = (SocketCoderClient)Members1[i];
Current.ReadOnlySocket.Send(aryRet);
}
//OnLogText(null, new EventArgs(), "user : " + msgCommand.Sender + " has joined room : " + msgCommand.ChatRoomID.ToString());
break;
case ClientCommand.msgType.LeaveRoom:
try
{
Member memberToLeave = new Member();
memberToLeave.LoadByPrimaryKey(msgCommand.Sender, msgCommand.ChatRoomID);
memberToLeave.MarkAsDeleted();
memberToLeave.Save();
}
catch (Exception ex)
{
}
ArrayList Members2 = Clients[msgCommand.ChatRoomID];
for (int i = 0; i < Members2.Count; i++)
{
SocketCoderClient Current = (SocketCoderClient)Members2[i];
if (Current.username != msgCommand.Sender)
Current.ReadOnlySocket.Send(aryRet);
}
ArrayList MemberToRemove = Clients[msgCommand.ChatRoomID];
for (int i = 0; i < MemberToRemove.Count; i++)
{
SocketCoderClient Current = (SocketCoderClient)MemberToRemove[i];
if (Current.username != msgCommand.Sender)
continue;
else
{
MemberToRemove.Remove(Current);
Current.ReadOnlySocket.Shutdown(SocketShutdown.Both);
// prevent setup recieve call back for removed client
return;
// break;
}
}
break;
case ClientCommand.msgType.Message:
ArrayList Members = Clients[msgCommand.ChatRoomID];
//.........这里部分代码省略.........