Merge branch 'master' of ssh://float.beyondsoft.de/git/beyondSoft/Chat
This commit is contained in:
@@ -322,64 +322,83 @@ namespace ChatController
|
||||
|
||||
private void SelectContact(Contact pContact)
|
||||
{
|
||||
if(pContact == null)
|
||||
try
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ShouldInterruptContactsThread = true;
|
||||
|
||||
StartWaitingImmediately();
|
||||
|
||||
_ScrollPrueferAktivieren = false;
|
||||
|
||||
if (pContact.HasUnreadMessages)
|
||||
{
|
||||
pContact.HasUnreadMessages = false;
|
||||
|
||||
Clientlist.Items.Refresh();
|
||||
}
|
||||
|
||||
var currentContact = pContact;
|
||||
pContact.IsNewMessage = false;
|
||||
|
||||
var shouldChangeIcon = _ContactList.Any(contact => contact.IsNewMessage);
|
||||
if(shouldChangeIcon)
|
||||
{
|
||||
ContainingWindow.Icon = Utils.ConvertIconToImageSource(Resource.ownchat_favicon);
|
||||
}
|
||||
|
||||
CurrentContact = currentContact;
|
||||
|
||||
if(Clientlist.Items.Contains(pContact))
|
||||
{
|
||||
Clientlist.SelectedItem = pContact;
|
||||
}
|
||||
|
||||
_ChatMessages.Clear();
|
||||
|
||||
Chat.LoadChatMessagesForContactAsync(currentContact, GetFirstMessage(), chatMessages =>
|
||||
{
|
||||
this.Dispatch(() =>
|
||||
if (pContact == null)
|
||||
{
|
||||
_ChatMessages.AddRangeIfElementsNotIn(chatMessages);
|
||||
return;
|
||||
}
|
||||
|
||||
WpfUtils.ScrollToBottomOfListBox(ChatListBox);
|
||||
ShouldInterruptContactsThread = true;
|
||||
|
||||
ChatListBox.ContextMenu = Chat.ErstelleKontextMenue();
|
||||
SetContextHandler();
|
||||
_ScrollPrueferAktivieren = true;
|
||||
StartWaitingImmediately();
|
||||
|
||||
ListenForMessages();
|
||||
Cursor = Cursors.Arrow;
|
||||
_ScrollPrueferAktivieren = false;
|
||||
|
||||
WriteToNewSyncFile();
|
||||
if (pContact.HasUnreadMessages)
|
||||
{
|
||||
pContact.HasUnreadMessages = false;
|
||||
|
||||
ShouldInterruptContactsThread = false;
|
||||
Clientlist.Items.Refresh();
|
||||
}
|
||||
|
||||
EndWaiting();
|
||||
var currentContact = pContact;
|
||||
pContact.IsNewMessage = false;
|
||||
|
||||
var shouldChangeIcon = _ContactList.Any(contact => contact.IsNewMessage);
|
||||
if (shouldChangeIcon)
|
||||
{
|
||||
ContainingWindow.Icon = Utils.ConvertIconToImageSource(Resource.ownchat_favicon);
|
||||
}
|
||||
|
||||
CurrentContact = currentContact;
|
||||
|
||||
if (Clientlist.Items.Contains(pContact))
|
||||
{
|
||||
Clientlist.SelectedItem = pContact;
|
||||
}
|
||||
|
||||
_ChatMessages.Clear();
|
||||
|
||||
Chat.LoadChatMessagesForContactAsync(currentContact, GetFirstMessage(), chatMessages =>
|
||||
{
|
||||
this.Dispatch(() =>
|
||||
{
|
||||
_ChatMessages.AddRangeIfElementsNotIn(chatMessages);
|
||||
|
||||
WpfUtils.ScrollToBottomOfListBox(ChatListBox);
|
||||
|
||||
ChatListBox.ContextMenu = Chat.ErstelleKontextMenue();
|
||||
SetContextHandler();
|
||||
_ScrollPrueferAktivieren = true;
|
||||
|
||||
ListenForMessages();
|
||||
Cursor = Cursors.Arrow;
|
||||
|
||||
WriteToNewSyncFile();
|
||||
|
||||
ShouldInterruptContactsThread = false;
|
||||
|
||||
EndWaiting();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
catch(Exception exception)
|
||||
{
|
||||
#if DEBUG
|
||||
var desktop = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
|
||||
|
||||
using(var fileStream = new FileStream(Path.Combine(desktop, "ownchat_log.txt"), FileMode.OpenOrCreate))
|
||||
{
|
||||
using(var streamWriter = new StreamWriter(fileStream))
|
||||
{
|
||||
streamWriter.WriteLine(exception.ToString());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
MessageBox.Show(exception.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetContextHandler()
|
||||
|
||||
@@ -255,7 +255,7 @@ namespace ChatController.HauptKlassen
|
||||
{
|
||||
var messageCounter = JsonConvert.DeserializeObject<MessageCounter>(response.Content);
|
||||
|
||||
callback?.Invoke(messageCounter.MessageCount);
|
||||
callback?.Invoke(messageCounter?.MessageCount ?? 0);
|
||||
});
|
||||
}
|
||||
catch(Exception exception)
|
||||
@@ -1029,7 +1029,10 @@ namespace ChatController.HauptKlassen
|
||||
{
|
||||
_Contacts.Clear();
|
||||
|
||||
_Contacts.AddRange(GenerateContactsFromServerResponse(chatDaten.Response.Groups.ToArray()));
|
||||
if(chatDaten?.Response != null)
|
||||
{
|
||||
_Contacts.AddRange(GenerateContactsFromServerResponse(chatDaten.Response.Groups.ToArray()));
|
||||
}
|
||||
|
||||
return _Contacts;
|
||||
}
|
||||
|
||||
@@ -101,11 +101,6 @@ namespace ChatController
|
||||
//_ChatCode = "K2UPV-qrirb";
|
||||
//_Benutzername = "lyndon";
|
||||
//Password = "lyndon2travemünde";
|
||||
|
||||
_Kundennummer = "4368658436";
|
||||
_ChatCode = "B7x0b-FhhJA";
|
||||
_Benutzername = "jettenl";
|
||||
Password = "n8-yR+3Q=6nX#";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user