public MainWindow() { instance = this; InitializeComponent(); TileStore.Initialize(); try { this.InitializeTileCategoryPickerChoices(); } catch (Exception e) { MessageBox.Show(e.Message); } this.InitializeLayerPicker(0); this.tile_category_picker.SelectedIndex = 0; this.KeyDown += new KeyEventHandler(MainWindow_KeyDown); this.layer_picker.SelectionChanged += new SelectionChangedEventHandler(layer_picker_SelectionChanged); this.AddMenuHandlers(); }
public static void Main(string[] args) { //The model that is shared between the engine part and GUI part of the map editor EditorModel model = new EditorModel(); //Start up the engine interaction thread (rendering and such) InteractThread thread = new InteractThread(model); Thread engineThread = new Thread(new ThreadStart(thread.MainLoop)); engineThread.Start(); //Make sure the resource manager has been set before continuing, and ensure that the opengl context has been set up. while ((model.ResourceManager == null || !Renderer.Ready) && model.Running); if (model.Running) { //Initialize and run the GUI Application.Init (); MainWindow win = new MainWindow (model); win.Show (); Application.Run (); } }
public MainWindow() { try { this.ActiveTool = Tool.None; me = this; InitializeComponent(); this.file_new.Click += new RoutedEventHandler(file_new_Click); this.file_open.Click += new RoutedEventHandler(file_open_Click); this.file_save.Click += new RoutedEventHandler(file_save_Click); this.file_exit.Click += new RoutedEventHandler(file_exit_Click); this.map_scripts.Click += new RoutedEventHandler(map_scripts_Click); this.map_music.Click += new RoutedEventHandler(map_music_Click); this.map_values.Click += new RoutedEventHandler(map_values_Click); this.mouse_catcher.MouseDown += new MouseButtonEventHandler(mouse_catcher_MouseDown); this.mouse_catcher.MouseUp += new MouseButtonEventHandler(mouse_catcher_MouseUp); this.mouse_catcher.MouseMove += new MouseEventHandler(mouse_catcher_MouseMove); this.tool_selector.SelectionChanged += new SelectionChangedEventHandler(tool_selector_SelectionChanged); this.active_primary_layer.Items.Add("A"); this.active_primary_layer.Items.Add("B"); this.active_primary_layer.Items.Add("C"); this.active_primary_layer.Items.Add("D"); this.active_primary_layer.Items.Add("E"); this.active_primary_layer.Items.Add("F"); this.active_primary_layer.Items.Add("Stairs"); this.active_primary_layer.SelectionChanged += new SelectionChangedEventHandler(active_primary_layer_SelectionChanged); this.active_primary_layer.SelectedIndex = 0; this.active_detail_layer.Items.Add("Base"); this.active_detail_layer.Items.Add("BaseAdorn"); this.active_detail_layer.Items.Add("BaseDetail"); this.active_detail_layer.Items.Add("Doodad"); this.active_detail_layer.Items.Add("DoodadAdorn"); this.active_detail_layer.Items.Add("Excessive"); this.active_detail_layer.SelectionChanged += new SelectionChangedEventHandler(active_detail_layer_SelectionChanged); this.active_detail_layer.SelectedIndex = 0; // layer visibility this.layer_a.Checked += new RoutedEventHandler(layer_a_Checked); this.layer_b.Checked += new RoutedEventHandler(layer_b_Checked); this.layer_c.Checked += new RoutedEventHandler(layer_c_Checked); this.layer_d.Checked += new RoutedEventHandler(layer_d_Checked); this.layer_e.Checked += new RoutedEventHandler(layer_e_Checked); this.layer_f.Checked += new RoutedEventHandler(layer_f_Checked); this.layer_stairs.Checked += new RoutedEventHandler(layer_stairs_Checked); this.layer_a.Unchecked += new RoutedEventHandler(layer_a_Checked); this.layer_b.Unchecked += new RoutedEventHandler(layer_b_Checked); this.layer_c.Unchecked += new RoutedEventHandler(layer_c_Checked); this.layer_d.Unchecked += new RoutedEventHandler(layer_d_Checked); this.layer_e.Unchecked += new RoutedEventHandler(layer_e_Checked); this.layer_f.Unchecked += new RoutedEventHandler(layer_f_Checked); this.layer_stairs.Unchecked += new RoutedEventHandler(layer_stairs_Checked); // detail visibility this.detail_base.Checked += new RoutedEventHandler(detail_base_Checked); this.detail_baseadorn.Checked += new RoutedEventHandler(detail_baseadorn_Checked); this.detail_baseextra.Checked += new RoutedEventHandler(detail_baseextra_Checked); this.doodad.Checked += new RoutedEventHandler(doodad_Checked); this.doodadadorn.Checked += new RoutedEventHandler(doodadadorn_Checked); this.excessive.Checked += new RoutedEventHandler(excessive_Checked); this.detail_base.Unchecked += new RoutedEventHandler(detail_base_Checked); this.detail_baseadorn.Unchecked += new RoutedEventHandler(detail_baseadorn_Checked); this.detail_baseextra.Unchecked += new RoutedEventHandler(detail_baseextra_Checked); this.doodad.Unchecked += new RoutedEventHandler(doodad_Checked); this.doodadadorn.Unchecked += new RoutedEventHandler(doodadadorn_Checked); this.excessive.Unchecked += new RoutedEventHandler(excessive_Checked); this.layer_all_off.Click += new RoutedEventHandler(layer_all_off_Click); this.layer_all_on.Click += new RoutedEventHandler(layer_all_on_Click); this.detail_all_off.Click += new RoutedEventHandler(detail_all_off_Click); this.detail_all_on.Click += new RoutedEventHandler(detail_all_on_Click); this.tool_selector.SelectedIndex = 0; } catch (Exception e) { System.Windows.MessageBox.Show("The following error was encounter so talk to Blake:\n" + e.Message); throw; } }