60 lines
1.7 KiB
C#
60 lines
1.7 KiB
C#
using System.Configuration;
|
|
using System.Data;
|
|
using System.Windows;
|
|
using System;
|
|
using System.Windows;
|
|
using System.Windows.Forms; // Necesitas agregar una referencia a System.Windows.Forms
|
|
using Application = System.Windows.Application;
|
|
|
|
namespace GTPCorrgir
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for App.xaml
|
|
/// </summary>
|
|
public partial class App : Application
|
|
{
|
|
gtpask GTP = new gtpask();
|
|
protected override void OnStartup(StartupEventArgs e)
|
|
{
|
|
base.OnStartup(e);
|
|
|
|
if (System.Windows.Clipboard.ContainsText())
|
|
{
|
|
GTP.TextoACorregir = System.Windows.Clipboard.GetText();
|
|
|
|
|
|
}
|
|
|
|
// Inicia y espera la tarea asíncrona
|
|
Task.Run(async () =>
|
|
{
|
|
await GTP.CorregirTexto();
|
|
|
|
// Asegúrate de cerrar la aplicación en el hilo de la UI
|
|
Dispatcher.Invoke(() =>
|
|
{
|
|
System.Windows.Clipboard.SetText(GTP.TextoCorregido);
|
|
MostrarNotificacion("Correccion Lista", GTP.TextoCorregido);
|
|
Application.Current.Shutdown();
|
|
});
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
private void MostrarNotificacion(string titulo, string mensaje)
|
|
{
|
|
NotifyIcon notificacion = new NotifyIcon
|
|
{
|
|
Icon = SystemIcons.Information,
|
|
BalloonTipTitle = titulo,
|
|
BalloonTipText = mensaje,
|
|
Visible = true
|
|
};
|
|
notificacion.ShowBalloonTip(1000); // Muestra la notificación por 3000 milisegundos
|
|
}
|
|
}
|
|
|
|
}
|