@@ -13,7 +13,7 @@ public partial class MagisterMessage : IComparable<MagisterMessage>, ICloneable
1313 public int ID { get ; set ; }
1414 public object Ref { get ; set ; } // Even Schoolmaster doesn't know what this is, it's mysterious. Just keep it in case.
1515 public string Subject { get ; set ; }
16- public MagisterPerson Sender { get ; set ; }
16+ public MagisterPerson Sender { get ; internal set ; }
1717 public string Body { get ; set ; }
1818 public List < MagisterPerson > Recipients { get ; set ; }
1919 public List < MagisterPerson > CC { get ; set ; }
@@ -40,20 +40,10 @@ public bool IsRead
4040 public List < Attachment > Attachments { get ; internal set ; }
4141 internal int _Folder { get ; set ; }
4242
43- public MessageFolder Folder
44- {
43+ public MessageFolder Folder
44+ {
4545 get { return ( MessageFolder ) this . _Folder ; }
46- set
47- {
48- if ( this . _Folder == ( int ) value ) return ;
49-
50- var thisCopied = ( MagisterMessage ) this . MemberwiseClone ( ) ;
51-
52- this . _Folder = ( int ) value ;
53-
54- _Session . HttpClient . Put ( this . URL ( ) , JsonConvert . SerializeObject ( this . ToMagisterStyle ( ) ) ) ;
55- thisCopied . Delete ( ) ;
56- }
46+ set { this . Move ( value ) ; }
5747 }
5848
5949 public bool Deleted { get ; internal set ; }
@@ -259,6 +249,34 @@ public MagisterMessage CreateReplyMessage(string ContentAdd)
259249 } ;
260250 }
261251
252+ /// <summary>
253+ /// Moves the current Message to the given folder.
254+ /// </summary>
255+ /// <param name="Folder">The folder to move the current message to.</param>
256+ public void Move ( MessageFolder Folder ) { this . Move ( ( int ) Folder ) ; }
257+
258+ /// <summary>
259+ /// Moves the current Message to the given folder.
260+ /// </summary>
261+ /// <param name="Folder">The folder to move the current message to.</param>
262+ public void Move ( MagisterMessageFolder Folder ) { this . Move ( Folder . ID ) ; }
263+
264+ /// <summary>
265+ /// Moves the current Message to the given folder.
266+ /// </summary>
267+ /// <param name="FolderID">The folder to move the current message to.</param>
268+ public void Move ( int FolderID )
269+ {
270+ if ( this . _Folder == FolderID ) return ;
271+
272+ var thisCopied = ( MagisterMessage ) this . MemberwiseClone ( ) ;
273+
274+ this . _Folder = FolderID ;
275+
276+ _Session . HttpClient . Put ( this . URL ( ) , JsonConvert . SerializeObject ( this . ToMagisterStyle ( ) ) ) ;
277+ thisCopied . Delete ( ) ;
278+ }
279+
262280 /// <summary>
263281 /// CAUTION: Permanently deletes the current message on the server.
264282 /// </summary>
@@ -332,7 +350,7 @@ internal MagisterStyleMessage ToMagisterStyle()
332350
333351 public override string ToString ( )
334352 {
335- return "From: " + this . Sender . Description + "\n Sent: " + this . SentDate . DayOfWeek + " " + this . SentDate . ToString ( ) + "\n To: " + String . Join ( ", " , this . Recipients . Select ( x => x . Name ) ) + ( ( this . Attachments . Count > 0 ) ? ( "\n Attachments (" + this . Attachments . Count + "): " + String . Join ( ", " , this . Attachments ) ) : "" ) + "\n Subject: " + this . Subject + "\n \n \" " + this . Body + "\" " ;
353+ return "From: " + this . Sender . Description + "\n Sent: " + this . SentDate . ToString ( false ) + "\n To: " + String . Join ( ", " , this . Recipients . Select ( x => x . Name ) ) + ( ( this . Attachments . Count > 0 ) ? ( "\n Attachments (" + this . Attachments . Count + "): " + String . Join ( ", " , this . Attachments ) ) : "" ) + "\n Subject: " + this . Subject + "\n \n \" " + this . Body + "\" " ;
336354 }
337355
338356 public int CompareTo ( MagisterMessage other )
0 commit comments