⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 conversation.cs

📁 该源代码用 C# 写成
💻 CS
字号:
using System;

namespace Org.InteliIM.Activities.Conversations
{
	/// <summary>
	/// 谈话
	/// </summary>
	public class Conversation
	{
		/// <summary>
		/// 构造函数
		/// </summary>
		public Conversation(string initiatorId, string acceptorId)
		{
			this.InitiatorId = initiatorId;
			this.AcceptorId = acceptorId;
		}

		/// <summary>
		/// 默认构造函数
		/// </summary>
		public Conversation()
		{
		}

		/// <summary>
		/// 获取参与谈话的另一方
		/// </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>
		/// 编号
		/// </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>
		/// 描述
		/// </summary>
		public string Description
		{
			get
			{
				if(this.description == null)
					this.description = "";

				return this.description;
			}
			set
			{
				this.description = value;
			}
		}
		
		private string initiatorId = null;
		
		/// <summary>
		/// 发起方用户名
		/// </summary>
		public string InitiatorId
		{
			get
			{
				return this.initiatorId;
			}
			set
			{
				if (this.initiatorId != value)
				{
					this.initiatorId = value;
				}
			}
		}

		private string acceptorId;

		/// <summary>
		/// 接受方用户名
		/// </summary>
		/// <value></value>
		public string AcceptorId
		{
			get
			{
				return this.acceptorId;
			}
			set
			{
				if (this.acceptorId != value)
				{
					this.acceptorId = value;
				}
			}
		}

		private ConversationPlace place;

		/// <summary>
		/// 相关联的谈话场所对象
		/// </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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -