diff --git a/ChatController/ChatMainControl.xaml.cs b/ChatController/ChatMainControl.xaml.cs index 1a7dcaf..65b4374 100644 --- a/ChatController/ChatMainControl.xaml.cs +++ b/ChatController/ChatMainControl.xaml.cs @@ -236,6 +236,11 @@ namespace ChatController { DisposeAndRemoveNotification((NotifyIcon)sender, pGroupId); + if(_ContainingWindow == null) + { + return; + } + if (_ContainingWindow.WindowState == WindowState.Minimized) { _ContainingWindow.WindowState = WindowState.Normal; @@ -243,7 +248,11 @@ namespace ChatController _ContainingWindow.Activate(); - SelectContact(_ContactList.FirstOrDefault(f => f.GroupId.Equals(pGroupId))); + var selectedContact = _ContactList?.FirstOrDefault(f => f?.GroupId == pGroupId); + if(selectedContact != null) + { + SelectContact(selectedContact); + } }; notifyIcon.BalloonTipClosed += (sender, args) => @@ -298,9 +307,9 @@ namespace ChatController private void Clientlist_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { - if(Clientlist.SelectedItem != null) + if(Clientlist?.SelectedItem != null && Clientlist?.SelectedItem is Contact selectedContact) { - SelectContact((Contact) Clientlist.SelectedItem); + SelectContact(selectedContact); } } @@ -1111,11 +1120,17 @@ namespace ChatController } // Wird im BeWoPlaner benutzt - public Contact GetCurrentContact() + public Contact GetCurrentContactWithUserIdManage() { return CurrentContact?.UserIdManage != null ? CurrentContact : null; } + // Wird im BeWoPlaner benutzt + public Contact GetCurrentContact() + { + return CurrentContact; + } + // Wird im BeWoPlaner benutzt public void AddContextMenu(string menuItemText, Action callBackAction) { diff --git a/ChatController/HauptKlassen/Chat.cs b/ChatController/HauptKlassen/Chat.cs index 0a5daf8..8184c7d 100644 --- a/ChatController/HauptKlassen/Chat.cs +++ b/ChatController/HauptKlassen/Chat.cs @@ -485,7 +485,7 @@ namespace ChatController.HauptKlassen request.AddParameter(Constants.CustomerId, ChatDaten.Kundennummer); request.AddParameter(Constants.MultipartContentTypeValue, requestBody, ParameterType.RequestBody); - + client.PostAsync(request, (response, handle) => { diff --git a/PrototypChat/.vs/PrototypChat/v16/.suo b/PrototypChat/.vs/PrototypChat/v16/.suo index d2905ca..b23ec57 100644 Binary files a/PrototypChat/.vs/PrototypChat/v16/.suo and b/PrototypChat/.vs/PrototypChat/v16/.suo differ