diff --git a/ChatController/HauptKlassen/Chat.cs b/ChatController/HauptKlassen/Chat.cs index 17d55e3..1596640 100644 --- a/ChatController/HauptKlassen/Chat.cs +++ b/ChatController/HauptKlassen/Chat.cs @@ -87,13 +87,14 @@ namespace ChatController.HauptKlassen Kontaktliste.Add(new KontaktlistBuilder(value.Name, AvatarToImageSourceConverter(value.Avatar), message, timeformated, value.Oid, null)); + if(lastMS != null && lastMS.Timestamp != null && lastMS.Timestamp.Date != null) { + TimeSpan span = (DateTime.Parse(lastMS.Timestamp.Date) - new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc)); + long unixTime = System.Convert.ToInt64(span.TotalSeconds); - TimeSpan span = (DateTime.Parse(lastMS.Timestamp.Date) - new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc)); - long unixTime = System.Convert.ToInt64(span.TotalSeconds); - - if (lastTimeStamp < unixTime) - { - lastTimeStamp = unixTime; + if (lastTimeStamp < unixTime) + { + lastTimeStamp = unixTime; + } } } } @@ -683,12 +684,14 @@ namespace ChatController.HauptKlassen Kontakt.Add(new KontaktlistBuilder(value.Name, AvatarToImageSourceConverter(value.Avatar), message, timeformated, value.Oid, null)); - TimeSpan span = (DateTime.Parse(lastMS.Timestamp.Date) - new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc)); - long unixTime = System.Convert.ToInt64(span.TotalSeconds); + if (lastMS != null && lastMS.Timestamp != null && lastMS.Timestamp.Date != null) { + TimeSpan span = (DateTime.Parse(lastMS.Timestamp.Date) - new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc)); + long unixTime = System.Convert.ToInt64(span.TotalSeconds); - if (lastTimeStamp < unixTime) - { - lastTimeStamp = unixTime; + if (lastTimeStamp < unixTime) + { + lastTimeStamp = unixTime; + } } } diff --git a/ChatController/LoginControl.xaml.cs b/ChatController/LoginControl.xaml.cs index e2f7026..cb3fc24 100644 --- a/ChatController/LoginControl.xaml.cs +++ b/ChatController/LoginControl.xaml.cs @@ -114,7 +114,7 @@ namespace ChatController } catch (Exception exception) { - MessageBox.Show("Fehler:"+exception.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error); + MessageBox.Show("Fehler: " + exception.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error); Cursor = Cursors.Arrow; } }