Outlook AddIn:在Outlook中拖动邮件时显示弹出窗口

时间:2017-11-13 09:47:41

标签: c# wpf outlook

我有一个outlook addin,它在发送邮件后显示一个弹出窗口,询问用户是否要保存邮件。 问题是当邮件添加到已发送文件夹时会显示此弹出窗口。 因此,当您发送邮件并立即开始将邮件拖到另一个文件夹时,例如,你想要清理邮件,然后弹出窗口显示当你处于拖动中间时停止拖动并使问题弹出窗口无法响应鼠标。

有什么方法吗?

提前致谢!

将邮件添加到已发送文件夹的事件在功能区加载方法中设置:

        private void ItemSend(object item)
    {
        if (MessageBox.Show(@" Wilt u de zojuist verzonden e-mail opslaan?", @"Opslaan in Codex", MessageBoxButtons.YesNo) == DialogResult.Yes)
            ShowSaveWindow(item);
    }

问题如下:

 <body>
<form id="form1" runat="server">

    <%-- Video DIV --%>
    <div runat="server" id="VidDiv" class="fullscreen-bg">
    </div>
    <%-- IMAGE DIV --%>
    <div runat="server" id="container">
        <div runat="server" id="containers">
        </div>
        <%-- this is where the code gets dynamically created --%>
    </div>
</form>
 </body>
   <script src="Scripts/jquery-3.1.1.js"></script>
  <script id="CallMyFunction" type="text/javascript">
          var index = 1;
    document.getElementById("VidDiv").style.display = "none";

var ImageCount = 1;
autoSlide();

function autoSlide() {

    var x = document.getElementsByClassName("Images");
    var video_player = document.getElementsByClassName("fullscreen-bd__video");
    var count;
    var video;
    var videoSource = new Array(), vids, i;

    for (i = 0; i < x.length; i++) {
        x[i].style.display = "none";
    }
    if (index > x.length) {
        index = 1
    }

    x[index - 1].style.display = "block";

    count = x.length;

    if (ImageCount <= count) {
        index++;
        ImageCount = 1 + ImageCount;
        setTimeout(autoSlide, 8000);
    }
    else {
        //this is where we should switch from image div to video div 
        document.getElementById("container").style.display = "none";
        document.getElementById("VidDiv").style.display = "block";

        //create a counter to check the number of video tags
        video = document.getElementsByTagName('video'), numVideos = video.length;

        for (i = 0; i < numVideos; i++) {

            videoSource[i] = video.item(i).src;
            document.getElementById("myVideo" + i).style.display = "none";
        }

        var videoCount = 0;
        if (videoCount <= numVideos -1) {

            function videoPlay(videoNum) {
                if (videoCount > 0)
                {
                    document.getElementById("myVideo" + (videoCount - 1)).style.display = "none";
                }
                document.getElementById("myVideo" + videoCount).style.display = "block";

                document.getElementById("myVideo" + videoCount).setAttribute("src", "" + videoSource[videoCount] + "");
                document.getElementById("myVideo" + videoCount).load();
                document.getElementById("myVideo" + videoCount).play();
                onEndedVid = document.getElementById("myVideo" + videoCount);

                var onEndedVid;
                onEndedVid.onended = function () {
                    //at the end of the video, close full screen
                    myHandler();
                };

                videoCount = videoCount + 1;

            }

            function myHandler() {

                if (videoCount == numVideos) {
                    //this is where we should switch from image div to video div
                    document.getElementById("container").style.display = "none";
                    document.getElementById("VidDiv").style.display = "none";

                    location.reload();
                }
                else {
                    videoPlay(videoCount);
                }
            }
            myHandler();

        }
        else
        {
            ///back to images
            //refresh the page
            location.reload();
        }           
    }
}

1 个答案:

答案 0 :(得分:0)

我认为有一种方法可以找出控件是否在DoDragDrop Windows API函数中(您可以修补它并让修补版本在输入原始标记之前设置某种全局标记功能,但我认为在.Net中不会是个好主意。

尝试在Application.ItemSend事件处理程序中显示消息框,以某种方式标记消息(用户属性?),然后在没有消息框的情况下在Items.ItemAdd中进行处理。