private void buttonDecode_Click(object sender, RoutedEventArgs e)
 {
     if (checkBoxEncrypted.IsChecked == true)
     {
         try
         {
             textBoxText.Text = AESUtility.DecryptStringAES(SteganographyUtility.extractText(_image), passwordBox.Password);
         }
         catch (Exception)
         {
             MessageBox.Show("Wrong password!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
     else
     {
         textBoxText.Text = SteganographyUtility.extractText(_image);
     }
 }
 private void buttonEncode_Click(object sender, RoutedEventArgs e)
 {
     //Check if text fits in image and if not empty
     if (textBoxText.Text.Length == 0)
     {
         MessageBox.Show("The text you want to hide can't be empty", "Error", MessageBoxButton.OK,
                         MessageBoxImage.Error);
     }
     else if (textBoxText.Text.Length > _image.Height * _image.Width * 0.375)
     {
         MessageBox.Show("This text is too long (" + textBoxText.Text.Length + " characters) for the image.\n" +
                         "The maximum number of characters you can use: " + Math.Floor(_image.Height * _image.Width * 0.375), "Error", MessageBoxButton.OK,
                         MessageBoxImage.Error);
     }
     else
     {
         if (checkBoxEncrypted.IsChecked == true)
         {
             if (passwordBox.Password.Length < 6)
             {
                 MessageBox.Show("Password must have at least 6 characters.", "Error", MessageBoxButton.OK,
                                 MessageBoxImage.Error);
             }
             else
             {
                 _image =
                     SteganographyUtility.embedText(
                         AESUtility.EncryptStringAES(textBoxText.Text, passwordBox.Password),
                         _image);
                 textBoxText.Text = "";
             }
         }
         else
         {
             _image =
                 SteganographyUtility.embedText(
                     textBoxText.Text,
                     _image);
             textBoxText.Text = "";
         }
     }
 }