0

I am developing sample application using Lync 2010 SDK. In that application i want to capture Lync IM window resize event.

As I know Lync 2010 SDK do provides API's to capture re-size event for the Lync IM window.

The application is launched successfully and on launching an IM window i do get the Lync Conversation Added event, but after that i don't get resize event for it on resizing the same Lync IM window. Here is the code of sample application. Please review the code and let me know if something is missing.

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");
    }
}

}

4

1 回答 1

0

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

如果我们没有将此 IM 停靠到另一个窗口,我们将不会收到调整大小事件。

于 2012-12-17T08:20:47.170 回答