conversation.cs

来自「这个版本(InteliIM Open Kernel Release 2)是目前最」· CS 代码 · 共 154 行

CS
154
字号
#region Using Directives

using System; 

#endregion

namespace Org.InteliIM.Applications.Messenger.Conversations
{
	/// <summary>
	/// Represents a conversation.
	/// </summary>
	public class Conversation
	{
		/// <summary>
		/// Initializes a new instance of the Conversation class.
		/// </summary>
		public Conversation(string initiatorId, string acceptorId)
		{
			this.InitiatorId = initiatorId;
			this.AcceptorId = acceptorId;
		}

		/// <summary>
		/// Initializes a new instance of the Conversation class.
		/// </summary>
		public Conversation()
		{
		}

		/// <summary>
		/// Gets the opposite.
		/// </summary>
		/// <param name="id"></param>
		/// <returns></returns>
		public string GetOpposite(string id)
		{
			if (id.Equals(this.InitiatorId))
				return this.AcceptorId;
			else
				return this.InitiatorId;
		}

		private string id;
		
		/// <summary>
		/// Gets or sets the id.
		/// </summary>
		public string Id
		{
			get
			{
				if(this.id == null)
					this.id = Guid.NewGuid().ToString();
				
				return this.id;
			}
			set
			{
				this.id = value;
			}
		}

		private string description;

		/// <summary>
		/// Gets or sets the description.
		/// </summary>
		public string Description
		{
			get
			{
				if(this.description == null)
					this.description = "";

				return this.description;
			}
			set
			{
				this.description = value;
			}
		}
		
		private string initiatorId = null;
		
		/// <summary>
		/// Gets or sets the initiator's id.
		/// </summary>
		public string InitiatorId
		{
			get
			{
				return this.initiatorId;
			}
			set
			{
				if (this.initiatorId != value)
				{
					this.initiatorId = value;
				}
			}
		}

		private string acceptorId;

		/// <summary>
		/// Gets or sets the acceptor's id.
		/// </summary>
		/// <value></value>
		public string AcceptorId
		{
			get
			{
				return this.acceptorId;
			}
			set
			{
				if (this.acceptorId != value)
				{
					this.acceptorId = value;
				}
			}
		}

		private ConversationPlace place;

		/// <summary>
		/// Gets or sets the conversation place.
		/// </summary>
		public ConversationPlace Place
		{
			get
			{
				if(this.place == null)
					this.place = new ConversationPlace();

				return this.place;
			}
			set
			{
				this.place = value;
			}
		}
        
		public void OnChatMessageReceived(object sender, ChatMessageReceivedEventArgs ea)
		{
			if (this.ChatMessageReceived != null)
				this.ChatMessageReceived(sender, ea);
		}
    	
		public event ChatMessageReceivedEventHandler ChatMessageReceived;
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?