コード例 #1
0
        private void ContentAdded(object sender, ContentCollectionChangedEventArgs e)
        {
            if (!string.IsNullOrEmpty(e.Item?.Title) && sender is ContentSharingModality csm && csm.Participant?.Contact is Contact contact)
            {
                var msg = new Message
                {
                    Direction      = contact == this.Self ? MessageDirection.Outgoing : MessageDirection.Incoming,
                    Contact        = contact.GetContactInformation(ContactInformationType.DisplayName)?.ToString(),
                    ContactEmail   = contact.GetContactInformation(ContactInformationType.PrimaryEmailAddress).ToString(),
                    AttachmentPath = $"{this.ConversationId}.{e.Item.Title}",
                };
                msg.Text = $"{msg.Contact} sent an attachment {e.Item.Title}";

                try
                {
                    var path = Path.Combine(Constants.LogFolder, msg.AttachmentPath);
                    Console.WriteLine($"Attempting to download file to {path}");
                    e.Item.BeginDownloadFile(path, this.ContentDownloadCallback, path);
                }
                catch (Exception ex)
                {
                    Console.WriteLine($"Download error: {ex.Message}");
                    throw;
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// 电子白板、ppt共享内容移除事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void ConversationCard_ContentRemoved(object sender, ContentCollectionChangedEventArgs e)
        {
            try
            {
                if (this.ShareableContentList.Contains(e.Item))
                {
                    this.ShareableContentList.Remove(e.Item);

                    //if (MainWindow.conversationResourceWindow != null)
                    //{
                    //    //跨线程(使用异步委托)
                    //    this.Dispatcher.BeginInvoke(new Action(() =>
                    //        {
                    //            try
                    //            {
                    //                //资源呈现刷新
                    //                MainWindow.conversationResourceWindow.RefleshViewByMesuare();
                    //            }
                    //            catch (Exception ex)
                    //            {
                    //                LogManage.WriteLog(this.GetType(), ex);
                    //            };
                    //        }));
                    //}
                }
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(this.GetType(), ex);
            }
        }
コード例 #3
0
ファイル: LyncHelper2.cs プロジェクト: Jackjet/conference
        /// <summary>
        /// 电子白板、ppt共享内容添加事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected static void ConversationCard_ContentAdded(object sender, ContentCollectionChangedEventArgs e)
        {
            try
            {
                App.Current.Dispatcher.BeginInvoke(new Action(() =>
                {
                    try
                    {
                        if (!ShareableContentList.Contains(e.Item))
                        {
                            //加载共享资源
                            ShareableContentList.Add(e.Item);
                        }

                        if (ContentAddCompleateCallBack != null)
                        {
                            ContentAddCompleateCallBack(e.Item.Title);
                        }
                        //属性更改事件(演示人)
                        e.Item.PropertyChanged += Item_PropertyChanged;

                        if (PresentCallBack != null)
                        {
                            if (e.Item.Owner != null)
                            {
                                object displayName = e.Item.Owner.GetContactInformation(ContactInformationType.DisplayName);
                                if (displayName != null)
                                {
                                    PresentCallBack(Convert.ToString(displayName));
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        LogManage.WriteLog(typeof(LyncHelper), ex);
                    }
                    finally
                    {
                    }
                }));
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(typeof(LyncHelper), ex);
            }
        }
コード例 #4
0
ファイル: LyncHelper2.cs プロジェクト: Jackjet/conference
 /// <summary>
 /// 电子白板、ppt共享内容移除事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected static void ConversationCard_ContentRemoved(object sender, ContentCollectionChangedEventArgs e)
 {
     try
     {
         App.Current.Dispatcher.BeginInvoke(new Action(() =>
         {
             if (ShareableContentList.Contains(e.Item))
             {
                 ShareableContentList.Remove(e.Item);
             }
         }));
     }
     catch (Exception ex)
     {
         LogManage.WriteLog(typeof(LyncHelper), ex);
     }
 }
コード例 #5
0
        /// <summary>
        /// 电子白板、ppt共享内容添加事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void ConversationCard_ContentAdded(object sender, ContentCollectionChangedEventArgs e)
        {
            try
            {
                if (!this.ShareableContentList.Contains(e.Item))
                {
                    this.ShareableContentList.Add(e.Item);
                    //跨线程(使用异步委托)
                    this.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        try
                        {
                            //if (MainWindow.conversationResourceWindow != null)
                            //{
                            //    //资源呈现刷新
                            //    MainWindow.conversationResourceWindow.RefleshViewByMesuare();
                            //}

                            ////隐藏标题
                            //MainWindow.mainWindow.UnDisplayHeader();

                            ////强制导航到会话管理界面
                            //MainWindow.mainWindow.ForceToNavicate(ConferenceNavicateType.ConvsersationManage);
                        }
                        catch (Exception ex)
                        {
                            LogManage.WriteLog(this.GetType(), ex);
                        };
                    }));
                }
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(this.GetType(), ex);
            }
        }
コード例 #6
0
ファイル: MainWindow.xaml.cs プロジェクト: mujiansu/Lync
 void _contentModality_ContentAdded(object sender, ContentCollectionChangedEventArgs e)
 {
     // lets be aware of when state of this content changes.
     e.Item.StateChanged += new EventHandler <ShareableContentStateChangedEventArgs>(Content_StateChanged);
 }