51 lines
1.5 KiB
C#
51 lines
1.5 KiB
C#
using System;
|
|
using System.Windows;
|
|
using ChatController.Klassen;
|
|
|
|
using Point = System.Windows.Point;
|
|
|
|
|
|
namespace ownChat
|
|
{
|
|
public partial class MainWindow
|
|
{
|
|
private readonly ChatEmojisView _EmojiView;
|
|
|
|
public MainWindow(ChatDatenUebergabe x)
|
|
{
|
|
InitializeComponent();
|
|
|
|
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.SpeichereMessageInfoInDatei();
|
|
Environment.Exit(0);
|
|
}
|
|
|
|
private void ChatMainControl_OnOnClose()
|
|
{
|
|
ChatMainControl.SpeichereMessageInfoInDatei();
|
|
Environment.Exit(0);
|
|
}
|
|
}
|
|
}
|