public void IssueDetail_DragDrop(object sender, DragEventArgs e)
{
if (CommentEdit.Visible)
CommentAdd_Click(null, null);
try
{
// Load in preferred order
bool ishtml = false;
if ((ishtml = e.Data.GetDataPresent(DataFormats.Html)) || e.Data.GetDataPresent(DataFormats.UnicodeText))
{
string text = e.Data.GetData(ishtml ? DataFormats.Html : DataFormats.UnicodeText).ToString();
if (!ishtml) text = fixUp(text);
CommentBodyRaw.Text = CommentBody.Document.Body.InnerHtml = text;
}
else if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
var files = (string[])e.Data.GetData(DataFormats.FileDrop);
using (var s = new FileStream(files[0], FileMode.Open))
LoadFromFile(s);
}
else
{
var s = (MemoryStream)e.Data.GetData(e.Data.GetFormats()[0]);
LoadFromFile(s);
}
}
catch (Exception ex)
{
MessageBox.Show(this, "Error when loading file: " + ex.ToString(), "Error from BEurtle", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}