#pragma once
#include "OptionenDialog.h"
#include "OptionenNMDialog.h"

namespace Dialoge {

	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
	{
    private:
      OptionenDialog^ dlgOptionen;

    public:
      OptionenNMDialog^ dlgNMOptionen;

	public:
		Form1(void)
		{
			InitializeComponent();
			
			 // Modalen Dialog vorab erzeugen ...
			 dlgOptionen = gcnew OptionenDialog();

			 // ... und konfigurieren
			 dlgOptionen->radioButton1->Checked = true;
			 dlgOptionen->radioButton4->Checked = true;

			 // Feld des nicht modalen Dialogs auf nullptr setzen
			 dlgNMOptionen = nullptr;
      }

	protected:
		/// <summary>
		/// Verwendete Ressourcen bereinigen.
		/// </summary>
		~Form1()
		{
			if (components)
			{
				delete components;
			}
		}
   private: System::Windows::Forms::Label^  label2;
   private: System::Windows::Forms::MenuStrip^  menuStrip1;
   private: System::Windows::Forms::ToolStripMenuItem^  extrasToolStripMenuItem;
   private: System::Windows::Forms::ToolStripMenuItem^  optionenToolStripMenuItem;
   private: System::Windows::Forms::Label^  label1;
   private: System::Windows::Forms::ToolStripMenuItem^  programmToolStripMenuItem1;
   private: System::Windows::Forms::ToolStripMenuItem^  beendenToolStripMenuItem;
   private: System::Windows::Forms::ToolStripMenuItem^  nichtModaleOptionenToolStripMenuItem;

   protected: 

	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->label2 = (gcnew System::Windows::Forms::Label());
         this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
         this->programmToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
         this->beendenToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
         this->extrasToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
         this->optionenToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
         this->nichtModaleOptionenToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
         this->label1 = (gcnew System::Windows::Forms::Label());
         this->menuStrip1->SuspendLayout();
         this->SuspendLayout();
         // 
         // label2
         // 
         this->label2->AutoSize = true;
         this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 10, static_cast<System::Drawing::FontStyle>((System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Italic)), 
            System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0)));
         this->label2->Location = System::Drawing::Point(360, 117);
         this->label2->Name = L"label2";
         this->label2->Size = System::Drawing::Size(99, 17);
         this->label2->TabIndex = 1;
         this->label2->Text = L"Karl Jaspers";
         // 
         // menuStrip1
         // 
         this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->programmToolStripMenuItem1, 
            this->extrasToolStripMenuItem});
         this->menuStrip1->Location = System::Drawing::Point(0, 0);
         this->menuStrip1->Name = L"menuStrip1";
         this->menuStrip1->Size = System::Drawing::Size(524, 24);
         this->menuStrip1->TabIndex = 3;
         this->menuStrip1->Text = L"menuStrip1";
         // 
         // programmToolStripMenuItem1
         // 
         this->programmToolStripMenuItem1->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(1) {this->beendenToolStripMenuItem});
         this->programmToolStripMenuItem1->Name = L"programmToolStripMenuItem1";
         this->programmToolStripMenuItem1->Size = System::Drawing::Size(76, 20);
         this->programmToolStripMenuItem1->Text = L"&Programm";
         // 
         // beendenToolStripMenuItem
         // 
         this->beendenToolStripMenuItem->Name = L"beendenToolStripMenuItem";
         this->beendenToolStripMenuItem->Size = System::Drawing::Size(120, 22);
         this->beendenToolStripMenuItem->Text = L"&Beenden";
         this->beendenToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::beendenToolStripMenuItem_Click);
         // 
         // extrasToolStripMenuItem
         // 
         this->extrasToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->optionenToolStripMenuItem, 
            this->nichtModaleOptionenToolStripMenuItem});
         this->extrasToolStripMenuItem->Name = L"extrasToolStripMenuItem";
         this->extrasToolStripMenuItem->Size = System::Drawing::Size(49, 20);
         this->extrasToolStripMenuItem->Text = L"&Extras";
         // 
         // optionenToolStripMenuItem
         // 
         this->optionenToolStripMenuItem->Name = L"optionenToolStripMenuItem";
         this->optionenToolStripMenuItem->Size = System::Drawing::Size(197, 22);
         this->optionenToolStripMenuItem->Text = L"&modale Optionen";
         this->optionenToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::optionenToolStripMenuItem_Click);
         // 
         // nichtModaleOptionenToolStripMenuItem
         // 
         this->nichtModaleOptionenToolStripMenuItem->Name = L"nichtModaleOptionenToolStripMenuItem";
         this->nichtModaleOptionenToolStripMenuItem->Size = System::Drawing::Size(197, 22);
         this->nichtModaleOptionenToolStripMenuItem->Text = L"&nicht modale Optionen";
         this->nichtModaleOptionenToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::optionenNMToolStripMenuItem_Click);
         // 
         // label1
         // 
         this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 10, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
            static_cast<System::Byte>(0)));
         this->label1->Location = System::Drawing::Point(47, 52);
         this->label1->Name = L"label1";
         this->label1->Size = System::Drawing::Size(374, 55);
         this->label1->TabIndex = 4;
         this->label1->Text = L"Denn Freiheit ist nie wirklich die Freiheit bloß Einzelner. Jeder Einzelne ist fr" 
            L"ei in dem Maße, als die anderen frei sind.";
         // 
         // Form1
         // 
         this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
         this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
         this->ClientSize = System::Drawing::Size(524, 212);
         this->Controls->Add(this->label1);
         this->Controls->Add(this->label2);
         this->Controls->Add(this->menuStrip1);
         this->MainMenuStrip = this->menuStrip1;
         this->Name = L"Form1";
         this->Text = L"Dialoge";
         this->menuStrip1->ResumeLayout(false);
         this->menuStrip1->PerformLayout();
         this->ResumeLayout(false);
         this->PerformLayout();

      }
#pragma endregion
   private: 
      void optionenToolStripMenuItem_Click(Object^  sender, EventArgs^  e) 
      {
         // Dialogformular anzeigen und auswerten
         if (dlgOptionen->ShowDialog() == System::Windows::Forms::DialogResult::OK)
         {
            // Vordergrundfarbe
            if (dlgOptionen->radioButton1->Checked)
                ForeColor = Color::Black;
            if (dlgOptionen->radioButton2->Checked)
                ForeColor = Color::White;
            if (dlgOptionen->radioButton3->Checked)
                ForeColor = Color::Red;
                
            // Hintergrundfarbe
            if (dlgOptionen->radioButton4->Checked)
                BackColor = SystemColors::Control;
            if (dlgOptionen->radioButton5->Checked)
                BackColor = Color::White;
            if (dlgOptionen->radioButton6->Checked)
                BackColor = Color::Black;
         }
      }

      void optionenNMToolStripMenuItem_Click(Object^  sender, EventArgs^  e) 
      {
         // Dialogformular anzeigen 
         if (dlgNMOptionen == nullptr)
            dlgNMOptionen = gcnew OptionenNMDialog(this);
         else
            dlgNMOptionen->Focus();

         dlgNMOptionen->Show();
      }


      void beendenToolStripMenuItem_Click(Object^  sender, EventArgs^  e) 
      {
         Close();
      }
};
}

