diff --git a/bin/MataSharp.XML b/bin/MataSharp.XML
index 6402102..bc11cba 100644
--- a/bin/MataSharp.XML
+++ b/bin/MataSharp.XML
@@ -94,6 +94,24 @@
The content to add infront of the original message.
A new MagisterMessage instance ready to be send.
+
+
+ Moves the current Message to the given folder.
+
+ The folder to move the current message to.
+
+
+
+ Moves the current Message to the given folder.
+
+ The folder to move the current message to.
+
+
+
+ Moves the current Message to the given folder.
+
+ The folder to move the current message to.
+
CAUTION: Permanently deletes the current message on the server.
diff --git a/bin/MataSharp.dll b/bin/MataSharp.dll
index 7aa81a7..989aabb 100644
Binary files a/bin/MataSharp.dll and b/bin/MataSharp.dll differ
diff --git a/src/MataSharp/Attachment.cs b/src/MataSharp/Attachment.cs
index 61191f9..3cef274 100644
--- a/src/MataSharp/Attachment.cs
+++ b/src/MataSharp/Attachment.cs
@@ -75,5 +75,5 @@ internal enum AttachmentType
Assignment_teacher,
Assignment_pupil,
StudyGuide
- };
+ }
}
diff --git a/src/MataSharp/MagisterMessage.cs b/src/MataSharp/MagisterMessage.cs
index 6d4ce5f..681edf4 100644
--- a/src/MataSharp/MagisterMessage.cs
+++ b/src/MataSharp/MagisterMessage.cs
@@ -13,7 +13,7 @@ public partial class MagisterMessage : IComparable, ICloneable
public int ID { get; set; }
public object Ref { get; set; } // Even Schoolmaster doesn't know what this is, it's mysterious. Just keep it in case.
public string Subject { get; set; }
- public MagisterPerson Sender { get; set; }
+ public MagisterPerson Sender { get; internal set; }
public string Body { get; set; }
public List Recipients { get; set; }
public List CC { get; set; }
@@ -40,20 +40,10 @@ public bool IsRead
public List Attachments { get; internal set; }
internal int _Folder { get; set; }
- public MessageFolder Folder
- {
+ public MessageFolder Folder
+ {
get { return (MessageFolder)this._Folder; }
- set
- {
- if (this._Folder == (int)value) return;
-
- var thisCopied = (MagisterMessage)this.MemberwiseClone();
-
- this._Folder = (int)value;
-
- _Session.HttpClient.Put(this.URL(), JsonConvert.SerializeObject(this.ToMagisterStyle()));
- thisCopied.Delete();
- }
+ set { this.Move(value); }
}
public bool Deleted { get; internal set; }
@@ -259,6 +249,34 @@ public MagisterMessage CreateReplyMessage(string ContentAdd)
};
}
+ ///
+ /// Moves the current Message to the given folder.
+ ///
+ /// The folder to move the current message to.
+ public void Move(MessageFolder Folder) { this.Move((int)Folder); }
+
+ ///
+ /// Moves the current Message to the given folder.
+ ///
+ /// The folder to move the current message to.
+ public void Move(MagisterMessageFolder Folder) { this.Move(Folder.ID); }
+
+ ///
+ /// Moves the current Message to the given folder.
+ ///
+ /// The folder to move the current message to.
+ public void Move(int FolderID)
+ {
+ if (this._Folder == FolderID) return;
+
+ var thisCopied = (MagisterMessage)this.MemberwiseClone();
+
+ this._Folder = FolderID;
+
+ _Session.HttpClient.Put(this.URL(), JsonConvert.SerializeObject(this.ToMagisterStyle()));
+ thisCopied.Delete();
+ }
+
///
/// CAUTION: Permanently deletes the current message on the server.
///
@@ -332,7 +350,7 @@ internal MagisterStyleMessage ToMagisterStyle()
public override string ToString()
{
- return "From: " + this.Sender.Description + "\nSent: " + this.SentDate.DayOfWeek + " " + this.SentDate.ToString() + "\nTo: " + String.Join(", ", this.Recipients.Select(x => x.Name)) + ((this.Attachments.Count > 0) ? ("\nAttachments (" + this.Attachments.Count + "): " + String.Join(", ", this.Attachments)) : "") + "\nSubject: " + this.Subject + "\n\n\"" + this.Body + "\"";
+ return "From: " + this.Sender.Description + "\nSent: " + this.SentDate.ToString(false) + "\nTo: " + String.Join(", ", this.Recipients.Select(x => x.Name)) + ((this.Attachments.Count > 0) ? ("\nAttachments (" + this.Attachments.Count + "): " + String.Join(", ", this.Attachments)) : "") + "\nSubject: " + this.Subject + "\n\n\"" + this.Body + "\"";
}
public int CompareTo(MagisterMessage other)
diff --git a/src/MataSharp/Mata.cs b/src/MataSharp/Mata.cs
index b007100..06297e7 100644
--- a/src/MataSharp/Mata.cs
+++ b/src/MataSharp/Mata.cs
@@ -112,7 +112,6 @@ public List GetMessageFolders()
List tmplst = new List();
foreach (var messageFolder in MessageFolders)
{
- var tmpFolderType = (Enum.IsDefined(typeof(MessageFolder), messageFolder.Id)) ? (MessageFolder)messageFolder.Id : MessageFolder.Unknown;
tmplst.Add(new MagisterMessageFolder()
{
Name = messageFolder.Naam,
@@ -122,7 +121,7 @@ public List GetMessageFolders()
Ref = messageFolder.Ref,
MessagesURI = messageFolder.BerichtenUri,
Mata = this,
- FolderType = tmpFolderType
+ FolderType = (MessageFolder)messageFolder.Id
});
}
return tmplst;
diff --git a/src/MataSharp/MessageFolder.cs b/src/MataSharp/MessageFolder.cs
index 7f957b5..ba484c4 100644
--- a/src/MataSharp/MessageFolder.cs
+++ b/src/MataSharp/MessageFolder.cs
@@ -25,8 +25,7 @@ public enum MessageFolder : int
{ //Defines the folders where messages can be in, server handles it as ID's. We? We handle it as an enum :D
Inbox = -101,
SentMessages = -103,
- Bin = -102,
- Unknown = 0
+ Bin = -102
}
internal partial struct MagisterStyleMessageFolderListItem
diff --git a/src/MataSharp/bin/Release/MataSharp.XML b/src/MataSharp/bin/Release/MataSharp.XML
index 6402102..bc11cba 100644
--- a/src/MataSharp/bin/Release/MataSharp.XML
+++ b/src/MataSharp/bin/Release/MataSharp.XML
@@ -94,6 +94,24 @@
The content to add infront of the original message.
A new MagisterMessage instance ready to be send.
+
+
+ Moves the current Message to the given folder.
+
+ The folder to move the current message to.
+
+
+
+ Moves the current Message to the given folder.
+
+ The folder to move the current message to.
+
+
+
+ Moves the current Message to the given folder.
+
+ The folder to move the current message to.
+
CAUTION: Permanently deletes the current message on the server.
diff --git a/src/MataSharp/bin/Release/MataSharp.dll b/src/MataSharp/bin/Release/MataSharp.dll
index 7aa81a7..989aabb 100644
Binary files a/src/MataSharp/bin/Release/MataSharp.dll and b/src/MataSharp/bin/Release/MataSharp.dll differ
diff --git a/src/MataSharp/bin/Release/MataSharp.pdb b/src/MataSharp/bin/Release/MataSharp.pdb
index 39fa5f2..8ef69e6 100644
Binary files a/src/MataSharp/bin/Release/MataSharp.pdb and b/src/MataSharp/bin/Release/MataSharp.pdb differ
diff --git a/src/MataSharp/obj/Release/MataSharp.dll b/src/MataSharp/obj/Release/MataSharp.dll
index 7aa81a7..989aabb 100644
Binary files a/src/MataSharp/obj/Release/MataSharp.dll and b/src/MataSharp/obj/Release/MataSharp.dll differ
diff --git a/src/MataSharp/obj/Release/MataSharp.pdb b/src/MataSharp/obj/Release/MataSharp.pdb
index 39fa5f2..8ef69e6 100644
Binary files a/src/MataSharp/obj/Release/MataSharp.pdb and b/src/MataSharp/obj/Release/MataSharp.pdb differ
diff --git a/src/MataTest/Program.cs b/src/MataTest/Program.cs
index cc88ade..a36371b 100644
--- a/src/MataTest/Program.cs
+++ b/src/MataTest/Program.cs
@@ -41,13 +41,6 @@ static void Main(string[] args)
var clonedMata = mata.Clone();
Console.WriteLine("Equal?: " + clonedMata.Equals(mata));
- new MagisterMessage()
- {
- Body = "test",
- Subject = "test",
- Recipients = new List() { mata.Person }
- }.Send();
-
twentyMessages.First(m => m.Attachments.Count != 0).Attachments[0].Download(true);
var utilitiesTest = mata.GetDigitalSchoolUtilities();
@@ -64,7 +57,7 @@ static void Main(string[] args)
Console.WriteLine(assignment.Description);
assignment.Attachments.ForEach(a => a.Download(true));
}
- assignmentTest.ElementAt(0).Attachments.ForEach(a => a.Download(true));
+ assignmentTest.First().Attachments.ForEach(a => a.Download(true));
new MagisterMessage()
{
@@ -73,6 +66,8 @@ static void Main(string[] args)
Recipients = new List() { mata.Person },
CC = new List() { mata.Person },
}.Send();
+ mata.ComposeAndSendMessage("Hallotjees :D", "TESSST D:", new List() { mata.Person });
+ //Both do the same thing, except the first method is more customizable and, in this example, adds a person to the CC field.
#region Message
var Inbox = mata.Inbox;
diff --git a/src/MataTest/bin/Debug/MataSharp.dll b/src/MataTest/bin/Debug/MataSharp.dll
index 7aa81a7..989aabb 100644
Binary files a/src/MataTest/bin/Debug/MataSharp.dll and b/src/MataTest/bin/Debug/MataSharp.dll differ
diff --git a/src/MataTest/bin/Debug/MataSharp.pdb b/src/MataTest/bin/Debug/MataSharp.pdb
index 39fa5f2..8ef69e6 100644
Binary files a/src/MataTest/bin/Debug/MataSharp.pdb and b/src/MataTest/bin/Debug/MataSharp.pdb differ
diff --git a/src/MataTest/bin/Debug/MataSharp.xml b/src/MataTest/bin/Debug/MataSharp.xml
index 6402102..bc11cba 100644
--- a/src/MataTest/bin/Debug/MataSharp.xml
+++ b/src/MataTest/bin/Debug/MataSharp.xml
@@ -94,6 +94,24 @@
The content to add infront of the original message.
A new MagisterMessage instance ready to be send.
+
+
+ Moves the current Message to the given folder.
+
+ The folder to move the current message to.
+
+
+
+ Moves the current Message to the given folder.
+
+ The folder to move the current message to.
+
+
+
+ Moves the current Message to the given folder.
+
+ The folder to move the current message to.
+
CAUTION: Permanently deletes the current message on the server.
diff --git a/src/MataTest/bin/Debug/MataTest.exe b/src/MataTest/bin/Debug/MataTest.exe
index b8fc883..7a863e6 100644
Binary files a/src/MataTest/bin/Debug/MataTest.exe and b/src/MataTest/bin/Debug/MataTest.exe differ
diff --git a/src/MataTest/bin/Debug/MataTest.pdb b/src/MataTest/bin/Debug/MataTest.pdb
index 2446434..0653c3e 100644
Binary files a/src/MataTest/bin/Debug/MataTest.pdb and b/src/MataTest/bin/Debug/MataTest.pdb differ
diff --git a/src/MataTest/obj/Debug/MataTest.csprojResolveAssemblyReference.cache b/src/MataTest/obj/Debug/MataTest.csprojResolveAssemblyReference.cache
index 72230a9..d8a9994 100644
Binary files a/src/MataTest/obj/Debug/MataTest.csprojResolveAssemblyReference.cache and b/src/MataTest/obj/Debug/MataTest.csprojResolveAssemblyReference.cache differ
diff --git a/src/MataTest/obj/Debug/MataTest.exe b/src/MataTest/obj/Debug/MataTest.exe
index b8fc883..7a863e6 100644
Binary files a/src/MataTest/obj/Debug/MataTest.exe and b/src/MataTest/obj/Debug/MataTest.exe differ
diff --git a/src/MataTest/obj/Debug/MataTest.pdb b/src/MataTest/obj/Debug/MataTest.pdb
index 2446434..0653c3e 100644
Binary files a/src/MataTest/obj/Debug/MataTest.pdb and b/src/MataTest/obj/Debug/MataTest.pdb differ