Aufgrund der Benutzung von Threads anstelle von Timern hat das Aufrufen der einzelnen Konversationen ca. 2 Sekunden gedauert. Die Synchronisationsdatei enthält, ob die letzte Nachrichte bereits gelesen wurde, sodass man, wenn man den Chat beendet bevor man eine neue Nachricht gelesen hat, diese nach dem erneuten Öffnen immer noch als neu angezeigt wird. - Dateinamen verbessert - Diverse Verbesserungen des Codes
49 lines
1.4 KiB
C#
49 lines
1.4 KiB
C#
using System;
|
|
using System.Windows;
|
|
|
|
using ChatController.LoginKlassen;
|
|
|
|
using Point = System.Windows.Point;
|
|
|
|
|
|
namespace ownChat
|
|
{
|
|
public partial class MainWindow
|
|
{
|
|
private readonly ChatEmojisView _EmojiView;
|
|
|
|
public MainWindow(ChatDatenUebergabe x)
|
|
{
|
|
InitializeComponent();
|
|
|
|
ChatMainControl.ContainingWindow = this;
|
|
|
|
ChatMainControl.InitMitChatdaten(x);
|
|
ChatMainControl.ResetStyle();
|
|
|
|
_EmojiView = new ChatEmojisView(ChatMainControl);
|
|
}
|
|
|
|
private void ChatMainControl_OnOnEmojii(System.Windows.Controls.Button emojiButton)
|
|
{
|
|
_EmojiView.Visibility = Visibility.Visible;
|
|
|
|
var pointToScreen = emojiButton.PointToScreen(new Point(0, 0));
|
|
var presentationSource = PresentationSource.FromVisual(emojiButton);
|
|
|
|
if(presentationSource?.CompositionTarget != null)
|
|
{
|
|
_EmojiView.Top = pointToScreen.Y / presentationSource.CompositionTarget.TransformToDevice.M22 - _EmojiView.Height - 5;
|
|
_EmojiView.Left = pointToScreen.X / presentationSource.CompositionTarget.TransformToDevice.M11 - 270;
|
|
}
|
|
}
|
|
|
|
private void MainWindow_OnClosed(object sender, EventArgs e)
|
|
{
|
|
ChatMainControl.WriteToNewSyncFile();
|
|
ChatMainControl.ClearNotifications();
|
|
Environment.Exit(0);
|
|
}
|
|
}
|
|
}
|