Null-Check bei Klick auf Benachrichtigung. Führte zu Exception im BeWoPlaner

This commit is contained in:
Lyndon Jetten
2021-02-25 12:33:00 +01:00
parent deb585fbb8
commit 7377dd30d1
3 changed files with 20 additions and 5 deletions

View File

@@ -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<string> callBackAction)
{

View File

@@ -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) =>
{