Not able to capture “NeedsSize” change event for Lync conversation window

最后都变了- 提交于 2020-01-25 06:53:11

问题


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

}


回答1:


We are only able get Lync IM resizing event, when we have docked that IM window in to some other window using Conversation.Dock( [other window handle] ).

If we haven't dock this IM in to another window we are not going to get the resizing event.



来源:https://stackoverflow.com/questions/13541338/not-able-to-capture-needssize-change-event-for-lync-conversation-window

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!