【发布时间】:2012-11-24 12:46:29
【问题描述】:
我正在使用 Lync 2010 SDK 开发示例应用程序。在该应用程序中,我想捕获 Lync IM 窗口调整大小事件。
据我所知,Lync 2010 SDK 确实提供 API 来捕获 Lync IM 窗口的重新调整大小事件。
应用程序已成功启动,并且在启动 IM 窗口时,我确实收到了 Lync Conversation added 事件,但在那之后,我在调整相同 Lync IM 窗口的大小时没有收到 resize 事件。这是示例应用程序的代码。请查看代码,如果缺少某些内容,请告诉我。
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");
}
}
}
【问题讨论】: