public UserControl GetUserControl(myUserControls uc)
 {
     if (myUserControlDictionary.ContainsKey(uc))
         return myUserControlDictionary[uc];
     else
         return null;
 }
 public void ShowUserControl(myUserControls uc, Form OnForm, bool OnControlSize)
 {
     form = OnForm;
     Control c;
     if (!myUserControlDictionary.ContainsKey(uc))
     {
         CreateUserControl(uc);
         c =myUserControlDictionary[uc];
         OnForm.Controls.Add(c);
     }
     else
     {
         c = myUserControlDictionary[uc];
         if(c.IsDisposed)
         {
             myUserControlDictionary.Remove(uc);
             CreateUserControl(uc);
             c = myUserControlDictionary[uc];
             OnForm.Controls.Add(c);
         }
     }           
     if (OnControlSize) form.ClientSize = new Size(c.Width, c.Height);
     c.Dock = DockStyle.Fill;
     c.Refresh();
     c.BringToFront();
     c.Visible = true;
 }
 public void HideUserControl(myUserControls muc)
 {
     if (myUserControlDictionary.ContainsKey(muc))
     {
         UserControl uc = myUserControlDictionary[muc];
         uc.Visible = false;
     }
 }
 public void CreateUserControl(myUserControls uc)
 {
     switch (uc)
     {
         case myUserControls.QuizEndScreen:
             qf = (QuizForm)form;
             EndScreenControl esc = new EndScreenControl(qf.qc, qf.myGame);
             esc.WeiterLabel.Click += qf.WeiterLabel_Click;
             myUserControlDictionary.Add(myUserControls.QuizEndScreen, esc);
             break;
         case myUserControls.QuizStartScreen:
             qf = (QuizForm)form;
             StartScreenControl ssc = new StartScreenControl();
             ssc.StartLabel.Click += qf.StartLabel_Click;
             myUserControlDictionary.Add(uc, ssc);
             break;
         case myUserControls.Apotheke:
             sf = (ShopForm)form;
             ApothekenControl ac = new ApothekenControl(sf.myGame);
             ac.zurückApotheke.Click += sf.zurückApotheke_Click;
             myUserControlDictionary.Add(uc, ac);
             break;
         case myUserControls.Discounter:
             sf = (ShopForm)form;
             DiscounterControl dc = new DiscounterControl(sf.myGame);
             dc.buttonZurück.Click += sf.zurückApotheke_Click;
             myUserControlDictionary.Add(uc, dc);
             break;
         case myUserControls.Casino:
             fa = (FormAusgehen)form;
             CasinoControl cc = new CasinoControl(fa.game);
             cc.button1.Click += fa.buttonCasino_Click;
             myUserControlDictionary.Add(uc, cc);
             break;
         case myUserControls.Hauptmenue:
             f1 = (Form1)form;
             HauptmenueControl hc = new HauptmenueControl(f1);
             myUserControlDictionary.Add(uc, hc);
             break;
         case myUserControls.Party:
             fa = (FormAusgehen)form;
             PartyControl pc = new PartyControl(fa.game);
             pc.VisibleChanged += fa.pc_VisibleChanged;
             myUserControlDictionary.Add(uc, pc);
             break;
         case myUserControls.Schwarzmarkt:
             sf = (ShopForm)form;
             Shop.SchwarzmarktControl sc = new Shop.SchwarzmarktControl(sf.myGame);
             sc.buttonZurückSchwarzmarkt.Click += sf.zurückApotheke_Click;
             myUserControlDictionary.Add(uc, sc);
             break;
         case myUserControls.Spielstaende:
             f1 = (Form1)form;
             SpielstaendeControl spc = new SpielstaendeControl(f1);
             myUserControlDictionary.Add(uc, spc);
             break;
         case myUserControls.Endbildschirm:
             f1 = (Form1)form;
             Endbildschirm end = new Endbildschirm(f1);
             myUserControlDictionary.Add(uc, end);
             f1.endHeight = end.Height;
             f1.endWidth = end.Width;
             break;
         case myUserControls.SpeicherControl:
             fs = (SpielmenueForm)form;
             SpeicherControl spcc = new SpeicherControl(fs.myGame, fs);
             myUserControlDictionary.Add(uc, spcc);
             break;
         case myUserControls.Errungenschaften:
             f1 = (Form1)form;
             ErrungenschaftsControl ec = new ErrungenschaftsControl(f1);
             myUserControlDictionary.Add(uc, ec);
             break;
     }
 }