Generelle Ausnahmenanzeige

This commit is contained in:
2023-03-03 21:23:48 +01:00
parent 101ce32c06
commit 6ea4a47b98
18 changed files with 1226 additions and 1346 deletions

View File

@@ -17,6 +17,9 @@ namespace ownChat
{
InitializeComponent();
var currentDomain = AppDomain.CurrentDomain;
currentDomain.UnhandledException += ExceptionHandler;
ChatMainControl.ContainingWindow = this;
ChatMainControl.InitMitChatdaten(x);
@@ -24,6 +27,13 @@ namespace ownChat
_EmojiView = new ChatEmojisView(ChatMainControl);
}
private void ExceptionHandler(object sender, UnhandledExceptionEventArgs args)
{
var exception = (Exception)args.ExceptionObject;
new ExceptionWindow(exception) { Owner = this }.Show();
}
private void ChatMainControl_OnOnEmojii(System.Windows.Controls.Button emojiButton)
{
_EmojiView.Visibility = Visibility.Visible;
@@ -31,11 +41,13 @@ namespace ownChat
var pointToScreen = emojiButton.PointToScreen(new Point(0, 0));
var presentationSource = PresentationSource.FromVisual(emojiButton);
if(presentationSource?.CompositionTarget != null)
if(presentationSource?.CompositionTarget == null)
{
_EmojiView.Top = pointToScreen.Y / presentationSource.CompositionTarget.TransformToDevice.M22 - _EmojiView.Height - 5;
_EmojiView.Left = pointToScreen.X / presentationSource.CompositionTarget.TransformToDevice.M11 - 270;
return;
}
_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)