Ungereimtheiten beim Konvertieren der Zeitangaben ausgemerzt.
Manche Datumsangaben waren im lokalen Zeitformat und nicht im Utc-Format.
This commit is contained in:
@@ -138,7 +138,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="ownchat_favicon.ico" />
|
<Content Include="ownchat_favicon.ico" />
|
||||||
<None Include="Resources\IconNewMessages.ico" />
|
|
||||||
<None Include="Resources\oC-favico_NewMessage.ico" />
|
<None Include="Resources\oC-favico_NewMessage.ico" />
|
||||||
<Content Include="Resources\ownchat_favicon.ico" />
|
<Content Include="Resources\ownchat_favicon.ico" />
|
||||||
<Resource Include="Ressourcen\ownchat_favicon.ico" />
|
<Resource Include="Ressourcen\ownchat_favicon.ico" />
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
@@ -20,6 +19,7 @@ using ChatController.HauptKlassen;
|
|||||||
using ChatController.LoginKlassen;
|
using ChatController.LoginKlassen;
|
||||||
using ChatController.Utilities;
|
using ChatController.Utilities;
|
||||||
using ChatController.Utilities.Extensions;
|
using ChatController.Utilities.Extensions;
|
||||||
|
|
||||||
using Button = System.Windows.Controls.Button;
|
using Button = System.Windows.Controls.Button;
|
||||||
using Cursors = System.Windows.Input.Cursors;
|
using Cursors = System.Windows.Input.Cursors;
|
||||||
using DataFormats = System.Windows.DataFormats;
|
using DataFormats = System.Windows.DataFormats;
|
||||||
@@ -51,7 +51,7 @@ namespace ChatController
|
|||||||
|
|
||||||
private bool _ScrollPrueferAktivieren;
|
private bool _ScrollPrueferAktivieren;
|
||||||
|
|
||||||
public bool _ShouldInterruptContactsThread = true;
|
public bool ShouldInterruptContactsThread = true;
|
||||||
|
|
||||||
private readonly List<string> _CreatedTempFiles = new List<string>();
|
private readonly List<string> _CreatedTempFiles = new List<string>();
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ namespace ChatController
|
|||||||
public void InitMitChatdaten(ChatDatenUebergabe cdu)
|
public void InitMitChatdaten(ChatDatenUebergabe cdu)
|
||||||
{
|
{
|
||||||
_Chat = new Chat(cdu);
|
_Chat = new Chat(cdu);
|
||||||
|
|
||||||
_ContactList = _Chat.AddContacts();
|
_ContactList = _Chat.AddContacts();
|
||||||
|
|
||||||
Clientlist.ItemsSource = _ContactList;
|
Clientlist.ItemsSource = _ContactList;
|
||||||
@@ -85,7 +85,7 @@ namespace ChatController
|
|||||||
|
|
||||||
var isYounger = contact.TimeStamp > dateTimeFromFile;
|
var isYounger = contact.TimeStamp > dateTimeFromFile;
|
||||||
|
|
||||||
contact.IsNewMessage = isYounger || isUnread;
|
contact.IsNewMessage = isUnread;
|
||||||
contact.HasUnreadMessages = contact.IsNewMessage;
|
contact.HasUnreadMessages = contact.IsNewMessage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -93,14 +93,14 @@ namespace ChatController
|
|||||||
var view = (CollectionView) CollectionViewSource.GetDefaultView(Clientlist.ItemsSource);
|
var view = (CollectionView) CollectionViewSource.GetDefaultView(Clientlist.ItemsSource);
|
||||||
view.Filter = UserFilter;
|
view.Filter = UserFilter;
|
||||||
|
|
||||||
_GlobalListeningThreadtimer?.Stop();
|
GlobalListeningThreadtimer?.Stop();
|
||||||
_GlobalListeningThreadtimer = null;
|
GlobalListeningThreadtimer = null;
|
||||||
InitGlobalListeningThread();
|
InitGlobalListeningThread();
|
||||||
|
|
||||||
Clientlist.Items.Refresh();
|
Clientlist.Items.Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShowNotification(string pTitle, string pMessage, long pGroupId)
|
public void ShowNotification(string pTitle, string pMessage, int pGroupId)
|
||||||
{
|
{
|
||||||
if (!_Group2NotifyIcons.ContainsKey(pGroupId))
|
if (!_Group2NotifyIcons.ContainsKey(pGroupId))
|
||||||
{
|
{
|
||||||
@@ -172,7 +172,12 @@ namespace ChatController
|
|||||||
|
|
||||||
private void SelectContact(Contact pContact)
|
private void SelectContact(Contact pContact)
|
||||||
{
|
{
|
||||||
_ShouldInterruptContactsThread = true;
|
if(pContact == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ShouldInterruptContactsThread = true;
|
||||||
|
|
||||||
Cursor = Cursors.Wait;
|
Cursor = Cursors.Wait;
|
||||||
_ScrollPrueferAktivieren = false;
|
_ScrollPrueferAktivieren = false;
|
||||||
@@ -218,7 +223,7 @@ namespace ChatController
|
|||||||
|
|
||||||
WriteToNewSyncFile();
|
WriteToNewSyncFile();
|
||||||
|
|
||||||
_ShouldInterruptContactsThread = false;
|
ShouldInterruptContactsThread = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetContextHandler()
|
private void SetContextHandler()
|
||||||
@@ -616,15 +621,15 @@ namespace ChatController
|
|||||||
InitListeningThread((CurrentContact)AktChatUserList.Items[0]);
|
InitListeningThread((CurrentContact)AktChatUserList.Items[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Timer _ListeningThreadTimer;
|
public Timer _ListeningThreadTimer;
|
||||||
private Timer _GlobalListeningThreadtimer;
|
public Timer GlobalListeningThreadtimer { get; set; }
|
||||||
|
|
||||||
private void InitGlobalListeningThread()
|
private void InitGlobalListeningThread()
|
||||||
{
|
{
|
||||||
_GlobalListeningThreadtimer = new Timer();
|
GlobalListeningThreadtimer = new Timer();
|
||||||
_GlobalListeningThreadtimer.Tick += GlobalListeningThreadTimerTickEvent;
|
GlobalListeningThreadtimer.Tick += GlobalListeningThreadTimerTickEvent;
|
||||||
_GlobalListeningThreadtimer.Interval = 2000;
|
GlobalListeningThreadtimer.Interval = 2000;
|
||||||
_GlobalListeningThreadtimer.Start();
|
GlobalListeningThreadtimer.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GlobalListeningThreadTimerTickEvent(object sender, EventArgs e)
|
private void GlobalListeningThreadTimerTickEvent(object sender, EventArgs e)
|
||||||
@@ -713,7 +718,7 @@ namespace ChatController
|
|||||||
|
|
||||||
private void ListenForMessagesForCurrentContact(CurrentContact pCurrentContact)
|
private void ListenForMessagesForCurrentContact(CurrentContact pCurrentContact)
|
||||||
{
|
{
|
||||||
if (!_ShouldInterruptContactsThread)
|
if (!ShouldInterruptContactsThread)
|
||||||
{
|
{
|
||||||
var hasNewMessages = _Chat.CheckIfNewMessagesExist(pCurrentContact);
|
var hasNewMessages = _Chat.CheckIfNewMessagesExist(pCurrentContact);
|
||||||
|
|
||||||
@@ -898,7 +903,7 @@ namespace ChatController
|
|||||||
|
|
||||||
foreach (var contact in _ContactList.ToList().Where(contact => contact.ReceivedMessage != null))
|
foreach (var contact in _ContactList.ToList().Where(contact => contact.ReceivedMessage != null))
|
||||||
{
|
{
|
||||||
var text = contact.GroupId + ";" + contact.TimeStamp + ";" + contact.IsNewMessage + ";";
|
var text = contact.GroupId + ";" + contact.TimeStamp.ToUniversalTime() + ";" + contact.IsNewMessage + ";";
|
||||||
var bytes = enc.GetBytes(text);
|
var bytes = enc.GetBytes(text);
|
||||||
var base64String = Convert.ToBase64String(bytes);
|
var base64String = Convert.ToBase64String(bytes);
|
||||||
|
|
||||||
@@ -938,8 +943,6 @@ namespace ChatController
|
|||||||
var dateTime = DateTime.Parse(splitPlainText[1]);
|
var dateTime = DateTime.Parse(splitPlainText[1]);
|
||||||
var isUnread = splitPlainText.Length <= 2 || string.IsNullOrEmpty(splitPlainText[2]) || bool.Parse(splitPlainText[2]);
|
var isUnread = splitPlainText.Length <= 2 || string.IsNullOrEmpty(splitPlainText[2]) || bool.Parse(splitPlainText[2]);
|
||||||
|
|
||||||
Debug.WriteLine($"{groupId}: {dateTime:dd.MM.yyyy HH:mm:ss}; Is unread: {isUnread}");
|
|
||||||
|
|
||||||
_GroupId2DateTime.Add(groupId, new SyncFileInfoStruct(isUnread, dateTime));
|
_GroupId2DateTime.Add(groupId, new SyncFileInfoStruct(isUnread, dateTime));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -953,8 +956,8 @@ namespace ChatController
|
|||||||
latestDateTime = id2dateTime.Value.TimeStamp;
|
latestDateTime = id2dateTime.Value.TimeStamp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//_Chat.LastTimeStamp = !latestDateTime.Equals(Utils.DefaultDate) ? latestDateTime.GetUnixTimeStamp() : DateTime.UtcNow.GetUnixTimeStamp();
|
_Chat.LastTimeStamp = latestDateTime.GetUnixTimeStamp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ using Newtonsoft.Json;
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
@@ -22,6 +21,7 @@ using System.Windows.Media.Imaging;
|
|||||||
using ChatController.LoginKlassen;
|
using ChatController.LoginKlassen;
|
||||||
using ChatController.Utilities;
|
using ChatController.Utilities;
|
||||||
using ChatController.Utilities.Extensions;
|
using ChatController.Utilities.Extensions;
|
||||||
|
|
||||||
using Application = System.Windows.Forms.Application;
|
using Application = System.Windows.Forms.Application;
|
||||||
using Clipboard = System.Windows.Forms.Clipboard;
|
using Clipboard = System.Windows.Forms.Clipboard;
|
||||||
using Color = System.Drawing.Color;
|
using Color = System.Drawing.Color;
|
||||||
@@ -53,21 +53,6 @@ namespace ChatController.HauptKlassen
|
|||||||
ChatDaten = chatDaten;
|
ChatDaten = chatDaten;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChatMessage PrevisouslyLatestMessage { get; set; }
|
|
||||||
public ChatMessage GetLatestMessage()
|
|
||||||
{
|
|
||||||
ChatMessage latestMessage = null;
|
|
||||||
foreach (var message in Messages)
|
|
||||||
{
|
|
||||||
if (latestMessage == null || latestMessage.SendTime < message.SendTime)
|
|
||||||
{
|
|
||||||
latestMessage = message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return latestMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IOrderedEnumerable<Contact> AddContacts()
|
public IOrderedEnumerable<Contact> AddContacts()
|
||||||
{
|
{
|
||||||
foreach (var contact in ChatDaten.AlleGruppen.Response)
|
foreach (var contact in ChatDaten.AlleGruppen.Response)
|
||||||
|
|||||||
Reference in New Issue
Block a user