public static Type ChooseTutorial(out bool useWinForms, out bool useXnaGame) { useWinForms = false; useXnaGame = false; SortedList <string, Type> tutorials = new SortedList <string, Type>(); FindTutorials(tutorials); TutorialChooser chooser = new TutorialChooser(tutorials.Keys, chosenTutorial); chooser.ShowDialog(); if (chooser.Canceled) { return(null); } Type type; tutorials.TryGetValue(chooser.SelectedTutorial, out type); chosenTutorial = chooser.SelectedTutorial; useWinForms = chooser.winformsHost.Checked; useXnaGame = chooser.xnaGameHost.Checked; return(type); }
public static Type ChooseTutorial(out bool useWinForms, out bool useXnaGame) { useWinForms = false; useXnaGame = false; Dictionary<string, Type> tutorials = new Dictionary<string, Type>(); Program.FindTutorials(tutorials); TutorialChooser chooser = new TutorialChooser(tutorials.Keys, chosenTutorial); chooser.ShowDialog(); if (chooser.Canceled) return null; Type type; tutorials.TryGetValue(chooser.SelectedTutorial, out type); chosenTutorial = chooser.SelectedTutorial; useWinForms = chooser.winformsHost.Checked; useXnaGame = chooser.xnaGameHost.Checked; return type; }
static void Main(string[] args) { #if XBOX360 using (Tutorial game = new Tutorial()) game.Run(); #else while (true) { bool runInWinForms; bool runInXnaGame; Type type = TutorialChooser.ChooseTutorial(out runInWinForms, out runInXnaGame); if (type == null) { break; } using (Application tutorial = Activator.CreateInstance(type) as Application) { if (runInWinForms) { WinFormsExample form = new WinFormsExample(); tutorial.Run(form.XenWinFormsHostControl); System.Windows.Forms.Application.Run(form); } else if (runInXnaGame) { XnaGame game = new XnaGame(tutorial); game.Run(); } else { tutorial.Run(); } } } #endif }