Files
FSI.BT.IR.Tools/FSI.Lib/Guis/DeEncryptMessage/FrmMain.xaml.cs
maier_S a0095a0516 Squashed 'FSI.Lib/' content from commit 6aa4846
git-subtree-dir: FSI.Lib
git-subtree-split: 6aa48465a834a7bfdd9cbeae8d2e4f769d0c0ff8
2022-03-23 10:15:26 +01:00

62 lines
1.8 KiB
C#

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;
namespace FSI.Lib.Guis.DeEncryptMessage
{
/// <summary>
/// Interaktionslogik für FrmMain.xaml
/// </summary>
public partial class FrmMain : Window
{
public string Password { get; set; }
public bool CloseAtLostFocus { get; set; }
public FrmMain()
{
InitializeComponent();
Deactivated += FrmMain_Deactivated;
DataContext = new MVVM.ViewModel.CurrentTimeViewModel();
}
private void FrmMain_Deactivated(object sender, System.EventArgs e)
{
if (CloseAtLostFocus)
Visibility = Visibility.Hidden;
}
private void btnDeCrypt_Click(object sender, RoutedEventArgs e)
{
try
{
tboutput.Text = DeEncryptString.DeEncrypt.DecryptString(tbInput.Text, Password);
}
catch (Exception)
{
MessageBox.Show("Text kann nicht entschlüsselt werden!", "Achtung", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
private void btnCrypt_Click(object sender, RoutedEventArgs e)
{
try
{
tboutput.Text = DeEncryptString.DeEncrypt.CryptString(tbInput.Text, Password);
}
catch (Exception)
{
MessageBox.Show("Text kann nicht verschlüsselt werden!", "Achtung", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
}
}