#pragma once


namespace Auswertung {

	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;

	/// <summary>
	/// Zusammenfassung für Form1
	///
	/// Warnung: Wenn Sie den Namen dieser Klasse ändern, müssen Sie auch
	///          die Ressourcendateiname-Eigenschaft für das Tool zur Kompilierung verwalteter Ressourcen ändern,
	///          das allen RESX-Dateien zugewiesen ist, von denen diese Klasse abhängt.
	///          Anderenfalls können die Designer nicht korrekt mit den lokalisierten Ressourcen
	///          arbeiten, die diesem Formular zugewiesen sind.
	/// </summary>
	public ref class Form1 : public System::Windows::Forms::Form
	{
	public:
		Form1(void)
		{
			InitializeComponent();
			//
			//TODO: Konstruktorcode hier hinzufügen.
			//
		}

	protected:
		/// <summary>
		/// Verwendete Ressourcen bereinigen.
		/// </summary>
		~Form1()
		{
			if (components)
			{
				delete components;
			}
		}
   private: System::Windows::Forms::Label^  label1;
   protected: 
   private: System::Windows::Forms::TextBox^  textBox1;

	private:
		/// <summary>
		/// Erforderliche Designervariable.
		/// </summary>
		System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
		/// <summary>
		/// Erforderliche Methode für die Designerunterstützung.
		/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
		/// </summary>
		void InitializeComponent(void)
		{
         this->label1 = (gcnew System::Windows::Forms::Label());
         this->textBox1 = (gcnew System::Windows::Forms::TextBox());
         this->SuspendLayout();
         // 
         // label1
         // 
         this->label1->AutoSize = true;
         this->label1->Location = System::Drawing::Point(75, 43);
         this->label1->Name = L"label1";
         this->label1->Size = System::Drawing::Size(103, 13);
         this->label1->TabIndex = 0;
         this->label1->Text = L"Text ohne Umlaute :";
         // 
         // textBox1
         // 
         this->textBox1->Location = System::Drawing::Point(198, 36);
         this->textBox1->Name = L"textBox1";
         this->textBox1->Size = System::Drawing::Size(199, 20);
         this->textBox1->TabIndex = 1;
         this->textBox1->TextChanged += gcnew System::EventHandler(this, &Form1::textBox1_TextChanged);
         // 
         // Form1
         // 
         this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
         this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
         this->ClientSize = System::Drawing::Size(472, 206);
         this->Controls->Add(this->textBox1);
         this->Controls->Add(this->label1);
         this->Name = L"Form1";
         this->Text = L"Benutzereingaben auswerten";
         this->ResumeLayout(false);
         this->PerformLayout();

      }
#pragma endregion
   private: 
      void textBox1_TextChanged(Object^  sender, EventArgs^  e) 
      {
         String^ s = textBox1->Text;

         if (!String::IsNullOrEmpty(s))
         {
           switch( (char) s[s->Length - 1])
           {
           case 'ä':   s = s->Substring(0, s->Length - 1);
                       s = s + "ae";
                       break;
           case 'Ä':   s = s->Substring(0, s->Length - 1);
                       s = s + "Ae";
                       break;
           case 'ö':   s = s->Substring(0, s->Length - 1);
                       s = s + "oe";
                       break;
           case 'Ö':   s = s->Substring(0, s->Length - 1);
                       s = s + "Oe";
                       break;
           case 'ü':   s = s->Substring(0, s->Length - 1);
                       s = s + "ue";
                       break;
           case 'Ü':   s = s->Substring(0, s->Length - 1);
                       s = s + "Ue";
                       break;
           case 'ß':   s = s->Substring(0, s->Length - 1);
                       s = s + "ss";
                       break;
           }

         textBox1->Text = s;
         textBox1->SelectionStart = textBox1->Text->Length;
         }
     }
   };
}

