GTPCorrgir/notificacion.xaml.cs

42 lines
1.2 KiB
C#
Raw Normal View History

using System.Windows;
using Application = System.Windows.Application;
namespace GTPCorrgir
{
/// <summary>
/// Interaction logic for notificacion.xaml
/// </summary>
public partial class notificacion : Window
{
public notificacion()
{
InitializeComponent();
PositionWindow();
}
private void PositionWindow()
{
// Obtener la posición del cursor
var cursorPosition = System.Windows.Forms.Cursor.Position;
// Determinar en qué pantalla está el cursor
var screen = System.Windows.Forms.Screen.FromPoint(cursorPosition);
// Configurar la ubicación de la ventana para que aparezca en la esquina inferior derecha
this.Left = screen.WorkingArea.Right - this.Width;
this.Top = screen.WorkingArea.Bottom - this.Height;
}
public void UpdateNotification(string title, string message)
{
TitleText.Text = title;
MessageText.Text = message;
}
private void CloseButton_Click(object sender, RoutedEventArgs e)
{
Application.Current.Shutdown();
}
}
}