📄 schedulesms.cs
字号:
namespace Imps.Client.Core
{
using Imps.Common;
using Imps.Utils;
using System;
using System.Collections;
using System.Runtime.CompilerServices;
using System.Xml;
public class ScheduleSms
{
private bool _beenGetInfo;
private string _id;
private Imps.Client.Core.ScheduleSmsList _list;
private string _message;
private string _newVersion;
private IicUri[] _receiverUris;
private DateTime _sendTime;
private string _version;
public event EventHandler InfoChanged;
public ScheduleSms()
{
this._message = string.Empty;
this._receiverUris = new IicUri[0];
this._sendTime = DateTime.MinValue;
}
public ScheduleSms(Imps.Client.Core.ScheduleSmsList list, string version, string id) : this(list, version, DateTime.MinValue, id, null, string.Empty)
{
}
public ScheduleSms(Imps.Client.Core.ScheduleSmsList list, DateTime sendTime, IicUri[] receiverUris, string message) : this(list, string.Empty, sendTime, string.Empty, receiverUris, message)
{
}
public ScheduleSms(Imps.Client.Core.ScheduleSmsList list, string version, DateTime sendTime, string id, IicUri[] receiverUris, string message)
{
this._message = string.Empty;
this._receiverUris = new IicUri[0];
this._sendTime = DateTime.MinValue;
this._list = list;
this._version = version;
this._sendTime = sendTime;
this._id = id;
this._receiverUris = receiverUris;
this._message = message;
}
internal void LoadXml(XmlNode node)
{
if (node != null)
{
string text = XmlHelper.ReadXmlAttributeString(node, "version");
DateTime time = XmlHelper.ReadXmlAttributeDateTime(node, "send-time", DateTime.MinValue);
string innerText = node.SelectSingleNode("message").InnerText;
XmlNode node3 = node.SelectSingleNode("receivers");
if (node3 != null)
{
XmlNodeList list = node3.SelectNodes("receiver");
if (list != null)
{
ArrayList list2 = new ArrayList();
foreach (XmlNode node4 in list)
{
string uriString = XmlHelper.ReadXmlAttributeString(node4, "uri");
list2.Add(new IicUri(uriString));
}
this.Version = text;
this.SendTime = time.ToLocalTime();
this.Message = innerText;
this.ReceiverUris = (IicUri[]) list2.ToArray(typeof(IicUri));
this.NewVersion = this.Version;
if (this.InfoChanged != null)
{
this.InfoChanged(this, EventArgs.Empty);
}
}
}
}
}
internal void WriteLocalXml(XmlTextWriter writer)
{
writer.WriteStartElement("schedule-sms");
writer.WriteAttributeString("id", this.Id);
if ((this.Message.Length == 0) && ((this.ReceiverUris == null) || (this.ReceiverUris.Length == 0)))
{
writer.WriteAttributeString("version", string.Empty);
}
else
{
writer.WriteAttributeString("version", this.Version);
}
writer.WriteAttributeString("send-time", this.SendTime.ToLongTimeString());
writer.WriteStartElement("message");
writer.WriteValue(this.Message);
writer.WriteEndElement();
writer.WriteStartElement("receivers");
if (this.ReceiverUris != null)
{
foreach (IicUri uri in this.ReceiverUris)
{
writer.WriteStartElement("receiver");
writer.WriteAttributeString("uri", uri.ToString());
writer.WriteEndElement();
}
}
writer.WriteEndElement();
writer.WriteEndElement();
}
internal bool BeenGetInfo
{
get
{
return this._beenGetInfo;
}
set
{
this._beenGetInfo = value;
}
}
public string DisplayMessage
{
get
{
return this._message;
}
}
public string DisplayReceviersName
{
get
{
if (this.ReceiverUris == null)
{
return string.Empty;
}
string text = string.Empty;
foreach (IicUri uri in this.ReceiverUris)
{
Contact contact = this.ScheduleSmsList.AllReceiverContacts[uri];
if (contact != null)
{
text = text + contact.DisplayName + "; ";
}
}
if (text.Length > 0)
{
text = text.Substring(0, text.Length - 2);
}
return text;
}
}
public string DisplaySendTime
{
get
{
return this._sendTime.ToString("yyyy-MM-dd HH:mm");
}
}
public string Id
{
get
{
return this._id;
}
internal set
{
this._id = value;
}
}
public string Message
{
get
{
return this._message;
}
set
{
this._message = value;
}
}
public string NewVersion
{
get
{
return this._newVersion;
}
internal set
{
this._newVersion = value;
}
}
public IicUri[] ReceiverUris
{
get
{
return this._receiverUris;
}
set
{
this._receiverUris = value;
foreach (IicUri uri in this._receiverUris)
{
Contact item = this._list.Owner.ContactList.FindOrCreateContact(uri.ToString(), null);
if (this._list.AllReceiverContacts[uri] == null)
{
this._list.AllReceiverContacts.Add(item);
}
}
}
}
protected Imps.Client.Core.ScheduleSmsList ScheduleSmsList
{
get
{
return this._list;
}
}
public DateTime SendTime
{
get
{
return this._sendTime;
}
set
{
this._sendTime = value;
}
}
public string Version
{
get
{
return this._version;
}
internal set
{
this._version = value;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -