예제 #1
0
        /// <summary>
        /// 关闭所有会话
        /// </summary>
        public static void CloseAllConversation(Action CallBack)
        {
            try
            {
                //离开会话
                if (LyncHelper.MainConversation != null)
                {
                    //关闭所有会话
                    //离开当前会话
                    //LyncHelper.MainConversation.Close();
                    LyncHelper.MainConversation.Close();
                    foreach (var conversation in ConversationCodeEnterEntity.conversationManager.Conversations)
                    {
                        ConversationWindow window = ConversationCodeEnterEntity.lyncAutomation.GetConversationWindow(conversation);
                        window.Close();
                    }

                    LyncHelper.MainConversation = null;
                }
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(typeof(LyncHelper), ex);
            }
            finally
            {
            }
        }
예제 #2
0
 //Ends the current meeting
 private void EndMeeting_Button_Click_1(object sender, RoutedEventArgs e)
 {
     try
     {
         if (_ConversationWindow != null)
         {
             _ConversationWindow.Close();
         }
         ConferenceAccessInformation_block.Text = "";
         MeetingRoster_Listbox.Items.Clear();
     }
     catch (NotInitializedException) {}
 }
        private void ContactAction(string login)
        {
            if (!ConversationWindows.Any(cmv => cmv.Recipeint == login))
            {
                var conversationWindow    = new ConversationWindow();
                var conversationViewModel = new ConversationViewModel(_logicClient);
                conversationViewModel.OnRequestClose += (s, ee) =>
                {
                    conversationWindow.Close();
                    DeleteFromConversationList(conversationViewModel.Recipeint);
                };
                conversationViewModel.Initialize(login);
                conversationWindow.DataContext = conversationViewModel;
                conversationWindow.Show();

                ConversationWindows.Add(conversationViewModel);
            }
        }
        public void ProceedCommand(object sender, RepeaterEventArgs e)
        {
            if (e.Type == ActionTypes.ContactList)
            {
                if (e.Result)
                {
                    var users = (List <User>)e.Data;

                    DispatchService.Invoke(() =>
                    {
                        Contacts.Clear();
                        users.ForEach(u =>
                        {
                            var contactViewModel =
                                new ContactViewModel(new ContactModel
                            {
                                Login          = u.Login,
                                Status         = u.Status,
                                StatusImageUri = getStatusImage(u.Status)
                            });
                            Contacts.Add(contactViewModel);
                        });
                    });
                }
            }
            else if (e.Type == ActionTypes.Message)
            {
                if (e.Result)
                {
                    var messageReq = (MessageReq)e.Data;
                    if (!ConversationWindows.Any(cmv => cmv.Recipeint == messageReq.Login))
                    {
                        DispatchService.Invoke(() =>
                        {
                            var conversationWindow                = new ConversationWindow();
                            var conversationViewModel             = new ConversationViewModel(_logicClient);
                            conversationViewModel.OnRequestClose += (s, ee) =>
                            {
                                conversationWindow.Close();
                                DeleteFromConversationList(conversationViewModel.Recipeint);
                            };

                            var messageModel = new MessageModel
                            {
                                DateTimeDelivery = messageReq.SendTime.ToString("yy-MM-dd hh:dd"),
                                Message          = messageReq.Message,
                                Sender           = messageReq.Login,
                                Image            = GetImageFromAttach(messageReq.Attachment)
                            };
                            conversationViewModel.Initialize(messageReq.Login);
                            conversationViewModel.AddMessage(messageModel);
                            conversationWindow.DataContext = conversationViewModel;
                            conversationWindow.Show();

                            ConversationWindows.Add(conversationViewModel);
                        });
                    }
                }
            }
            else if (e.Type == ActionTypes.PresenceNotification)
            {
                var presenceNotification = (PresenceStatusNotification)e.Data;

                ContactViewModel contact = Contacts.SingleOrDefault(c => c.Login == presenceNotification.Login);
                if (contact != null)
                {
                    contact.Status         = presenceNotification.PresenceStatus;
                    contact.StatusImageUri = getStatusImage(presenceNotification.PresenceStatus);
                }
            }
        }
예제 #5
0
        /// <summary>
        /// 会议卡片加载
        /// </summary>
        public void RoomCardInit(ConferenceRoomItem roomItem, ConferenceInformationEntityPC item)
        {
            try
            {
                if (this.ItemClickCallBackToMainPage != null)
                {
                    #region old solution

                    //if(Constant.lyncClient.ConversationManager.Conversations.Count>0)
                    //{
                    //    Constant.lyncClient.ConversationManager.Conversations.Clear();
                    //}

                    #endregion

                    //离开会话
                    if (LyncHelper.MainConversation != null)
                    {
                        //离开当前会话
                        //LyncHelper.MainConversation.Close();
                        LyncHelper.MainConversation.Close();
                        foreach (var conversation in Constant.lyncClient.ConversationManager.Conversations)
                        {
                            ConversationWindow window = Constant.lyncAutomation.GetConversationWindow(conversation);
                            window.Close();
                        }

                        ModelManage.ConferenceLyncConversation.LeaveConversation(Constant.ConferenceName, Constant.SelfUri, new Action <bool>((isSuccessed) =>
                        {
                        }));
                        LyncHelper.MainConversation = null;
                    }

                    //当前选择的会议聊天室
                    if (this.CurrentConferenceRoomItem != null)
                    {
                        this.CurrentConferenceRoomItem.StyleChangeToNoSelected();
                    }
                    //临时存储的会议信息
                    MainWindow.MainPageInstance.TempConferenceInformationEntity = item;
                    this.CurrentConferenceRoomItem = roomItem;
                    this.CurrentConferenceRoomItem.StyleChangeToSelected();

                    MainWindow.MainPageInstance.MyConferenceView.TipShow(true);

                    //点击回调
                    this.ItemClickCallBackToMainPage(item, new Action(() =>
                    {
                        //刷新数据
                        MainWindow.MainPageInstance.MyConferenceView.FillDataSource();
                        MainWindow.MainPageInstance.MyConferenceView.TipShow(false);
                    }));
                }
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(this.GetType(), ex);
            }
            finally
            {
            }
        }