无法捕获Lync对话窗口的“NeedsSize”更改事件

时间:2012-11-24 12:46:30

标签: c# lync lync-2010

我正在使用Lync 2010 SDK开发示例应用程序。在该应用程序中,我想捕获Lync IM窗口调整大小事件。

据我所知,Lync 2010 SDK确实提供了API来捕获Lync IM窗口的重新调整大小事件。

应用程序已成功启动,并且在启动IM窗口时,我确实获得了Lync Conversation Added事件,但之后我没有在调整同一Lync IM窗口的大小时获得调整大小事件。这是示例应用程序的代码。请查看代码,如果遗漏了某些内容,请告诉我。

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Lync.Model;
using Microsoft.Lync.Model.Conversation;
using Microsoft.Lync.Model.Extensibility;

namespace LyncWpfSample
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
    LyncClient _client = null;

    ConversationManager _conversationManager = null;

    Automation _automation = null;


    public Window1()
    {
        InitializeComponent();

        _client = LyncClient.GetClient();

        _conversationManager = _client.ConversationManager;

        _conversationManager.ConversationAdded += new EventHandler<ConversationManagerEventArgs>(ConversationManager_ConversationAdded);
    }

    void ConversationManager_ConversationAdded(object sender, ConversationManagerEventArgs e)
    {
        Conversation conv = e.Conversation;

        ConversationWindow convWindow = _automation.GetConversationWindow(conv);

        convWindow.NeedsSizeChange += new EventHandler<ConversationWindowNeedsSizeChangeEventArgs>(Conversation_convWindow_NeedsSizeChange);
        convWindow.NeedsAttention+=new EventHandler<ConversationWindowNeedsAttentionEventArgs>(Conversation_convWindowNeedsAttention);

    }

    void Conversation_convWindow_NeedsSizeChange(object sender, ConversationWindowNeedsSizeChangeEventArgs e)
    {
        MessageBox.Show("Conversation Window Size changed");
    }

    void Conversation_convWindowNeedsAttention(object sender, ConversationWindowNeedsAttentionEventArgs e)
    {
        MessageBox.Show("Conversation Window Needs Attention");
    }
}

}

1 个答案:

答案 0 :(得分:0)

当我们使用Conversation.Dock([其他窗口句柄])将IM窗口停靠到其他窗口时,我们才能获得Lync IM调整大小事件。

如果我们没有将此IM停靠到另一个窗口,我们将无法获得调整大小事件。

相关问题