Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
v0.9.22.2
Browse files Browse the repository at this point in the history
Add a feature to send a draft message.
  • Loading branch information
rykoma committed Jul 10, 2018
1 parent 94e07b8 commit c99a2d4
Show file tree
Hide file tree
Showing 15 changed files with 545 additions and 29 deletions.
1 change: 1 addition & 0 deletions Office365APIEditor/GlobalSuppressions.cs
Expand Up @@ -117,4 +117,5 @@
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("AsyncUsage.CSharp.Reliability", "AvoidAsyncVoid:Avoid async void", Justification = "<Pending>", Scope = "member", Target = "~M:Office365APIEditor.MailboxViewerForm.GetTaskGroupPropsAsync(System.String)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("AsyncUsage.CSharp.Reliability", "AvoidAsyncVoid:Avoid async void", Justification = "<Pending>", Scope = "member", Target = "~M:Office365APIEditor.MailboxViewerForm.GetTaskFolderPropsAsync(System.String)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("AsyncUsage.CSharp.Reliability", "AvoidAsyncVoid:Avoid async void", Justification = "<Pending>", Scope = "member", Target = "~M:Office365APIEditor.UI.SendMailForm.Button_Save_Click(System.Object,System.EventArgs)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("AsyncUsage.CSharp.Reliability", "AvoidAsyncVoid:Avoid async void", Justification = "<Pending>", Scope = "member", Target = "~M:Office365APIEditor.UI.SendMailForm.SendMailForm_LoadAsync(System.Object,System.EventArgs)")]

4 changes: 2 additions & 2 deletions Office365APIEditor/Properties/AssemblyInfo.cs
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.22.1")]
[assembly: AssemblyFileVersion("0.9.22.1")]
[assembly: AssemblyVersion("0.9.22.2")]
[assembly: AssemblyFileVersion("0.9.22.2")]
1 change: 1 addition & 0 deletions Office365APIEditor/UI/AttachmentViewerForm.cs
Expand Up @@ -45,6 +45,7 @@ private async void AttachmentViewerForm_Load(object sender, EventArgs e)
{
case FolderContentType.Message:
case FolderContentType.MsgFolderRoot:
case FolderContentType.Drafts:
try
{
result = await viewerHelper.GetAttachmentsAsync(FolderContentType.Message, targetItemId);
Expand Down
31 changes: 31 additions & 0 deletions Office365APIEditor/UI/FolderViewerForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 58 additions & 7 deletions Office365APIEditor/UI/FolderViewerForm.cs
Expand Up @@ -4,6 +4,7 @@
using Codeplex.Data;
using Microsoft.Identity.Client;
using Microsoft.Office365.OutlookServices;
using Office365APIEditor.UI;
using Office365APIEditor.ViewerHelper;
using Office365APIEditor.ViewerHelper.Tasks;
using System;
Expand Down Expand Up @@ -40,15 +41,31 @@ private async void FolderViewerForm_Load(object sender, System.EventArgs e)
{
toolStripStatusLabel_Status.Text = "Loading all items...";

if (targetFolder.Type != FolderContentType.MsgFolderRoot)
{
Text = targetFolder.Type.ToString() + " items in " + targetFolderDisplayName;
}
else
string typeForWindowTitle = "";

switch (targetFolder.Type)
{
Text = FolderContentType.Message.ToString() + " items in " + targetFolderDisplayName;
case FolderContentType.Message:
case FolderContentType.MsgFolderRoot:
case FolderContentType.Drafts:
typeForWindowTitle = "Message items";
break;
case FolderContentType.Contact:
typeForWindowTitle = "Contact items";
break;
case FolderContentType.Calendar:
typeForWindowTitle = "Calendar items";
break;
case FolderContentType.Task:
typeForWindowTitle = "Task items";
break;
default:
typeForWindowTitle = "items";
break;
}

Text = typeForWindowTitle + " in " + targetFolderDisplayName;

viewerHelper = new ViewerHelper.ViewerHelper(pca, currentUser);

switch (targetFolder.Type)
Expand Down Expand Up @@ -124,6 +141,7 @@ private async void FolderViewerForm_Load(object sender, System.EventArgs e)

break;
case FolderContentType.MsgFolderRoot:
case FolderContentType.Drafts:
// Add columns.
PrepareMessageItemListColumns();

Expand Down Expand Up @@ -272,13 +290,24 @@ private void ShowMessages(List<MessageSummary> messages)
string subject = item.Subject ?? "";
string sender = (item.Sender != null && item.Sender.EmailAddress != null && item.Sender.EmailAddress.Address != null) ? item.Sender.EmailAddress.Address : "";
string recipients = (item.ToRecipients != null) ? ConvertRecipientsListToString(item.ToRecipients) : "";
string isDraft = item.IsDraft.ToString();

DataGridViewRow itemRow = new DataGridViewRow
{
Tag = item.Id
};
itemRow.CreateCells(dataGridView_ItemList, new object[] { subject, sender, recipients, receivedDateTime, createdDateTime, sentDateTime });
itemRow.ContextMenuStrip = contextMenuStrip_ItemList;

if (item.IsDraft)
{
// This item is draft.
itemRow.ContextMenuStrip = contextMenuStrip_ItemList_DraftItem;
}
else
{
// This item is not draft.
itemRow.ContextMenuStrip = contextMenuStrip_ItemList;
}

if (dataGridView_ItemList.InvokeRequired)
{
Expand Down Expand Up @@ -526,6 +555,7 @@ private void dataGridView_ItemList_CellClick(object sender, DataGridViewCellEven
{
case FolderContentType.Message:
case FolderContentType.MsgFolderRoot:
case FolderContentType.Drafts:
GetMessageItemDetail(id);
break;
case FolderContentType.Contact:
Expand Down Expand Up @@ -638,6 +668,16 @@ private void contextMenuStrip_ItemList_Opening(object sender, System.ComponentMo
}

private void ToolStripMenuItem_DisplayAttachments_Click(object sender, EventArgs e)
{
DisplayAttachments();
}

private void ToolStripMenuItem_DisplayAttachments_DraftItem_Click(object sender, EventArgs e)
{
DisplayAttachments();
}

private void DisplayAttachments()
{
if (dataGridView_ItemList.SelectedRows.Count == 0)
{
Expand Down Expand Up @@ -670,5 +710,16 @@ private void dataGridView_ItemProps_CellDoubleClick(object sender, DataGridViewC
};
propertyViewer.Show();
}

private void ToolStripMenuItem_Edit_DraftItem_Click(object sender, EventArgs e)
{
if (dataGridView_ItemList.SelectedRows.Count == 0)
{
return;
}

SendMailForm sendMailForm = new SendMailForm(pca, currentUser, dataGridView_ItemList.SelectedRows[0].Tag.ToString());
sendMailForm.Show();
}
}
}
12 changes: 12 additions & 0 deletions Office365APIEditor/UI/FolderViewerForm.resx
Expand Up @@ -126,12 +126,24 @@
<metadata name="Type.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Property.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Value.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Type.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="contextMenuStrip_ItemList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>296, 17</value>
</metadata>
<metadata name="contextMenuStrip_ItemList_DraftItem.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>412, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
Expand Down
30 changes: 27 additions & 3 deletions Office365APIEditor/UI/MailboxViewerForm.cs
Expand Up @@ -20,6 +20,8 @@ public partial class MailboxViewerForm : Form
// Current user's info.
Microsoft.Identity.Client.IUser currentUser;

IMailFolder draftsFolder;

bool doubleClicked = false;

bool expandingNodeHasDummyNode = false;
Expand Down Expand Up @@ -61,6 +63,9 @@ private bool Prepare()
{
viewerHelper = new ViewerHelper.ViewerHelper(pca, currentUser);

// Get the Drafts folder.
GetDraftsFolderAsync();

// Get the root folder.
PrepareMsgFolderRootAsync();

Expand All @@ -80,6 +85,11 @@ private bool Prepare()
}
}

private async void GetDraftsFolderAsync()
{
draftsFolder = await viewerHelper.GetDraftsFolderAsync();
}

private async void PrepareMsgFolderRootAsync()
{
// Get MsgFolderRoot and add it to the tree.
Expand Down Expand Up @@ -118,9 +128,21 @@ private async void PrepareChildMailFoldersAsync(string FolderId, TreeNode Folder

foreach (var folder in childMailFolders)
{
FolderContentType folderContentType;

if (folder.Id == draftsFolder.Id)
{
// This folder is the Drafts folder.
folderContentType = FolderContentType.Drafts;
}
else
{
folderContentType = FolderContentType.Message;
}

TreeNode node = new TreeNode(folder.DisplayName)
{
Tag = new FolderInfo() { ID = folder.Id, Type = FolderContentType.Message, Expanded = false },
Tag = new FolderInfo() { ID = folder.Id, Type = folderContentType, Expanded = false },
ContextMenuStrip = contextMenuStrip_FolderTreeNode
};

Expand Down Expand Up @@ -405,6 +427,7 @@ private void treeView_Mailbox_AfterSelect(object sender, TreeViewEventArgs e)
{
case FolderContentType.Message:
case FolderContentType.MsgFolderRoot:
case FolderContentType.Drafts:
GetMessageFolderProps(info.ID, treeView_Mailbox.SelectedNode.Text);
break;
case FolderContentType.Contact:
Expand Down Expand Up @@ -644,7 +667,7 @@ private void treeView_Mailbox_NodeMouseDoubleClick(object sender, TreeNodeMouseC
{
FolderInfo info = (FolderInfo)treeView_Mailbox.SelectedNode.Tag;

if (info.Type == FolderContentType.MsgFolderRoot || info.Type == FolderContentType.Message || info.Type == FolderContentType.Contact || info.Type == FolderContentType.Calendar || info.Type == FolderContentType.Task)
if (info.Type == FolderContentType.MsgFolderRoot || info.Type == FolderContentType.Message || info.Type == FolderContentType.Drafts || info.Type == FolderContentType.Contact || info.Type == FolderContentType.Calendar || info.Type == FolderContentType.Task)
{
// This is not a dummy node.
// Open selected folder.
Expand Down Expand Up @@ -721,7 +744,7 @@ private void treeView_Mailbox_BeforeExpand(object sender, TreeViewCancelEventArg
folderInfo.Expanded = true;
e.Node.Tag = folderInfo;
}
else if (folderInfo.Type == FolderContentType.Contact || folderInfo.Type == FolderContentType.Message || folderInfo.Type == FolderContentType.MsgFolderRoot)
else if (folderInfo.Type == FolderContentType.Contact || folderInfo.Type == FolderContentType.Message || folderInfo.Type == FolderContentType.Drafts || folderInfo.Type == FolderContentType.MsgFolderRoot)
{
expandingNodeHasDummyNode = true;

Expand All @@ -746,6 +769,7 @@ private void newSessionToolStripMenuItem_Click(object sender, EventArgs e)
if (Prepare())
{
// New session stated
Activate();
newSessionToolStripMenuItem.Enabled = false;
closeSessionToolStripMenuItem.Enabled = true;
windowToolStripMenuItem.Visible = true;
Expand Down
2 changes: 1 addition & 1 deletion Office365APIEditor/UI/NewAttachmentForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions Office365APIEditor/UI/NewAttachmentForm.cs
Expand Up @@ -24,7 +24,14 @@ private void NewAttachmentForm_Load(object sender, EventArgs e)
{
foreach (var attachment in originalAttachments)
{
listBox_Attachments.Items.Add(attachment.FullPath);
if (attachment.FullPath == "")
{
listBox_Attachments.Items.Add(attachment.Name);
}
else
{
listBox_Attachments.Items.Add(attachment.FullPath);
}
}
}

Expand All @@ -36,7 +43,7 @@ public DialogResult ShowDialog(out List<FileAttachment> SelectedAttachments)
return result;
}

private void button_Add_Click(object sender, EventArgs e)
private void Button_Add_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
Expand Down
2 changes: 1 addition & 1 deletion Office365APIEditor/UI/SendMailForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c99a2d4

Please sign in to comment.