///<summary> Обработчик нажатия на пункт меню отправить сообщение</summary> private void ContextMenuWriteMessage_OnClick(object sender, RoutedEventArgs e) { if (_viewModelCallHistory.CurrentModelCallHistoryPeer.ModelPeerObj.IsDodicall) { WindowMain.ShowInRightWorkspace(new ViewChatMessageDetail(_viewModelCallHistory.CurrentModelCallHistoryPeer.ModelPeerObj.ModelContactObj)); } }
///<summary> Обработчик нажатия на пункт меню учасники чата </summary> private void ContextMenuChatMembers_OnClick(object sender, RoutedEventArgs e) { var modelChat = ListBoxChat.SelectedItem as ModelChat; if (modelChat == null) { return; } //var rightWorkspaceContent = WindowMain.GetRightWorkspaceContent(); //var existChatMessageDetail = rightWorkspaceContent != null ? rightWorkspaceContent is ViewChatMessageDetail : true; //var chatMessageDetail = existChatMessageDetail ? rightWorkspaceContent as ViewChatMessageDetail : null; //var createNewViewChatMessageDetail = chatMessageDetail != null ? chatMessageDetail.CurrentModelChat.Id != _viewModelChat.CurrentModelChat.Id: false; var chatMessageDetail = WindowMain.GetRightWorkspaceContent() as ViewChatMessageDetail; if (chatMessageDetail?.CurrentModelChat.Id != _viewModelChat.CurrentModelChat.Id) { var viewChatMessageDetail = new ViewChatMessageDetail(modelChat); WindowMain.ShowInRightWorkspace(viewChatMessageDetail); viewChatMessageDetail.OnInviteMembers_MouseClick(null, null); } else { chatMessageDetail?.OnInviteMembers_MouseClick(null, null); } }
/// <summary> Обработчик клика по профилю </summary> private void OpenUserDetail(object sender, MouseButtonEventArgs e) { var viewUserDetail = new ViewUserDetail(_modelUser); viewUserDetail.IsVisibleChanged += (o, args) => { Background = (bool)args.NewValue ? Brushes.WhiteSmoke : Brushes.Transparent; }; WindowMain.ShowInRightWorkspace(viewUserDetail); }
/// <summary> Обработчик выбора контакта </summary> private void ItemContact_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { var modelContact = ListBoxContact.SelectedItem as ModelContact; WindowMain.ShowInRightWorkspace(new ViewChatMessageDetail(modelContact, _listRedirectModelMessage)); ViewChat.CurrentViewChat.SetModelChat(modelContact); OnCloseWindow(); }
///<summary> Обработчик нажатия на кнопку приглашений и запросов </summary> private void ButtonRequestInvite_OnClick(object sender, RoutedEventArgs e) { var viewContactRequestInvite = new ViewContactRequestInvite(); WindowMain.ShowInRightWorkspace(viewContactRequestInvite); GridRequestInvite.Background = Brushes.WhiteSmoke; viewContactRequestInvite.IsVisibleChanged += ViewContactRequestInviteOnIsVisibleChanged; }
///<summary> Обработчик нажатия на кнопку поиска новых контактов </summary> private void ButtonFindNewContact_OnClick(object sender, RoutedEventArgs e) { var viewContactDirectory = new ViewContactDirectory(); WindowMain.ShowInRightWorkspace(viewContactDirectory); GridFindNewContact.Background = Brushes.WhiteSmoke; viewContactDirectory.IsVisibleChanged += ViewContactDirectoryOnIsVisibleChanged; }
///<summary> Обработчик смены текущего чата </summary> private void Grid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { var modelChat = ListBoxChat.SelectedItem as ModelChat; if (modelChat == null) { return; } WindowMain.ShowInRightWorkspace(new ViewChatMessageDetail(modelChat)); }
///<summary> Обработчик клика по элементу звонка в ListBoxCallHistory </summary> private void GridCallItem_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (ListBoxCallHistory.SelectedItem != null && !(WindowMain.GetRightWorkspaceContent() is ViewCallHistoryDetail)) { var modelCallHistoryPeer = (ModelCallHistoryPeer)ListBoxCallHistory.SelectedItem; _viewModelCallHistory.SetModelCallHistoryReaded(modelCallHistoryPeer); WindowMain.ShowInRightWorkspace(new ViewCallHistoryDetail(modelCallHistoryPeer)); } }
///<summary> Обработчик изменения выбора ListBoxCallHistory </summary> private void ListBoxCallHistory_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { if (ListBoxCallHistory.SelectedItem != null) { var modelCallHistoryPeer = (ModelCallHistoryPeer)ListBoxCallHistory.SelectedItem; _viewModelCallHistory.SetModelCallHistoryReaded(modelCallHistoryPeer); WindowMain.ShowInRightWorkspace(new ViewCallHistoryDetail(modelCallHistoryPeer)); } }
///<summary> Добавить контакт в список (Временный кастыль для демо !!!) </summary> public void AddContactListBoxContact(ModelContact modelContact, bool showDetailInRightWorkspace) { var modelContactFromList = _viewModelContact.CurrentListModelContact.FirstOrDefault(obj => obj.Id == modelContact.Id); if (modelContactFromList == null) { _viewModelContact.ListModelContact.Add(modelContact); _viewModelContact.ApplyFilter(); } if (showDetailInRightWorkspace) { SetSelectedListBoxContact(modelContact); WindowMain.ShowInRightWorkspace(new ViewContactDetail(modelContact)); } }
///<summary> Удалить контакт из списока (Временный кастыль для демо !!!) </summary> public void DeleteContactListBoxContact(ModelContact modelContact) { var modelContactFromList = _viewModelContact.CurrentListModelContact.FirstOrDefault(obj => obj.Id == modelContact.Id); if (modelContactFromList != null) { _viewModelContact.ListModelContact.Remove(modelContact); _viewModelContact.ApplyFilter(); } var userControl = WindowMain.GetRightWorkspaceContent() as ViewContactDetail; if (userControl != null && userControl.CurrentModelContact.Id == modelContact.Id) { WindowMain.ShowInRightWorkspace(null); } }
///<summary> Открыть карточку контакта </summary> private void OpenModelContactDetail(ModelContact modelContact) { if (modelContact == null) { return; } var userControl = WindowMain.GetRightWorkspaceContent(); if (userControl != null && (userControl as ViewContactDetail)?.CurrentModelContact.Id == modelContact.Id) { var userControlFront = WindowMain.GetRightWorkspaceFrontContent(); // проверить на null и попробовать привести к ViewCallActive if (userControlFront != null && userControlFront is ViewCallActive) { WindowMain.CloseInRightWorkspaceFront(); } return; } WindowMain.ShowInRightWorkspace(new ViewContactDetail(modelContact)); }
///<summary> Обработчик нажатия на кнопку чат (из трех сервисов под аватаром) </summary> private void ButtonChat_OnClick(object sender, RoutedEventArgs e) { WindowMain.ShowInRightWorkspace(new ViewChatMessageDetail(CurrentModelContact)); }
///<summary> Обработчик нажатия на кнопку чат (из трех сервисов) </summary> private void ButtonChat_OnClick(object sender, RoutedEventArgs e) { WindowMain.ShowInRightWorkspace(new ViewChatMessageDetail(_viewModelCallHistoryDetail.ModelContactObj)); }
///<summary> Обработчик нажатия на пункт меню отправить сообщение </summary> private void ContextMenuWriteMessage_OnClick(object sender, RoutedEventArgs e) { WindowMain.ShowInRightWorkspace(new ViewChatMessageDetail(_viewModelContact.CurrentModelContact)); }