Agregado boton the cerrar a la ventana de notificacion.

This commit is contained in:
Miguel 2024-07-15 14:08:37 +02:00
parent 0a14530315
commit d58f5c496a
2 changed files with 18 additions and 23 deletions

View File

@ -1,14 +1,13 @@
<Window x:Class="GTPCorrgir.notificacion"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="100" Width="300"
Topmost="True" ShowInTaskbar="False"
WindowStyle="None" AllowsTransparency="True"
Background="Transparent">
<Window x:Class="GTPCorrgir.notificacion" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="100" Width="300" Topmost="True"
ShowInTaskbar="False" WindowStyle="None" AllowsTransparency="True" Background="Transparent">
<Border CornerRadius="10" Background="#AAF0F0F0">
<StackPanel>
<TextBlock x:Name="TitleText" FontSize="16" FontWeight="Bold" Margin="10" />
<TextBlock x:Name="MessageText" FontSize="14" Margin="10" />
<Button Content="Cerrar" Width="75" Height="20" Margin="0" Click="CloseButton_Click"
HorizontalAlignment="Right" />
</StackPanel>
</Border>
</Window>

View File

@ -1,16 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows;
using Application = System.Windows.Application;
namespace GTPCorrgir
{
@ -24,22 +13,29 @@ namespace GTPCorrgir
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 = Screen.FromPoint(cursorPosition);
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();
}
}
}