private void region_Loaded(object sender, RoutedEventArgs e)
		{
			var border = (Border)e.Source;
			var region = (Region)border.DataContext;
			var menu = new ContextMenu();
			menu.AddAction("New Region", CreateNewRegion);
			menu.AddAction("Rename", () => RenameRegion(region));
			menu.AddAction("Delete", () => DeleteRegion(region));
			border.ContextMenu = menu;
		}
		void trigger_Loaded(object sender, RoutedEventArgs e)
		{
			var border = (Border)e.Source;
			var trigger = (Trigger)border.DataContext;
			var menu = new ContextMenu();
			menu.AddAction("New Trigger", CreateNewTrigger);
			menu.AddAction("New Trigger (Repeating)", CreateNewRepeatingTrigger);
            menu.AddAction("Copy Trigger", () => Mission.CopyTrigger(trigger));
			menu.Items.Add(GetNewActionMenu(trigger));
			menu.Items.Add(GetNewConditionMenu(trigger));
			menu.Items.Add(new Separator());
			menu.AddAction("Move Up", () => MoveTrigger(MoveDirection.Up, trigger));
            menu.AddAction("Move Up 5 Spaces", () => MoveTrigger(MoveDirection.Up, trigger, 5));
            menu.AddAction("Move to Top", () => MoveTrigger(MoveDirection.Up, trigger, true));
			menu.AddAction("Move Down", () => MoveTrigger(MoveDirection.Down, trigger));
            menu.AddAction("Move Down 5 Spaces", () => MoveTrigger(MoveDirection.Down, trigger, 5));
            menu.AddAction("Move to Bottom", () => MoveTrigger(MoveDirection.Down, trigger, true));
			menu.AddAction("Rename", () => RenameTrigger(trigger));
			menu.AddAction("Delete", () => DeleteTrigger(trigger));
			menu.Items.Add(new Separator());
			menu.AddAction("Expand All Triggers", ExpandAllTriggers);
			menu.AddAction("Collapse All Triggers", CollapseAllTriggers);
			menu.AddAction("Collapse All But This", () => CollapseAllButThisTrigger(trigger));
			border.ContextMenu = menu;
		}
		void window_Loaded(object sender, RoutedEventArgs e)
		{
			var project = MainMenu.AddContainer("Project");
			project.AddAction("New", NewMission);
			project.AddAction("Open", LoadMission);
			project.AddAction("Save", QuickSave);
			project.AddAction("Save As", SaveMission);

            var welcomeScreen = new WelcomeDialog { ShowInTaskbar = true, Owner = this };
            welcomeScreen.ShowDialog();
            if (Mission == null)
            {
                MessageBox.Show("A mission needs to be selected");
                Environment.Exit(0);
            }

            var mission = MainMenu.AddContainer("Mission");
            mission.AddAction("Create Mutator", () => BuildMission());
            mission.AddAction("Create Invisible Mutator", () => BuildMission(true));
            mission.AddAction("Test Mission", TestMission);
            mission.AddAction("Export Localization File", ExportLocalizationFile);
            mission.AddAction("Publish", ShowMissionManagement);
            mission.AddAction("Settings", ShowMissionSettings);

            var newMenu = MainMenu.AddContainer("New");
            newMenu.AddAction("New Trigger", CreateNewTrigger);
            newMenu.AddAction("New Trigger (Repeating)", CreateNewRepeatingTrigger);
            newMenu.AddAction("New Region", CreateNewRegion);
            newMenu.AddAction("Copy Trigger", () => Mission.CopyTrigger(CurrentTrigger));
            newMenu.Items.Add(GetNewConditionMenu(delegate
            {
                if (logicGrid.SelectedItem is Trigger) return CurrentTrigger;
                if (logicGrid.SelectedItem is ActionsFolder) return CurrentActionsFolder.Trigger;
                if (logicGrid.SelectedItem is ConditionsFolder) return CurrentConditionsFolder.Trigger;
                if (logicGrid.SelectedItem is TriggerLogic) return Mission.FindLogicOwner(CurrentLogic);
                return null;
            }));
            newMenu.Items.Add(GetNewActionMenu(() => CurrentTrigger));

            var editMenu = MainMenu.AddContainer("Edit");
            editMenu.AddAction("Rename", RenameCurrentItem);
            editMenu.AddAction("Delete", DeleteCurrentItem);
            editMenu.AddAction("Move Up", () => MoveCurrentItem(MoveDirection.Up));
            editMenu.AddAction("Move Up 5 Spaces", () => MoveCurrentItem(MoveDirection.Up, 5));
            editMenu.AddAction("Move To Top", () => MoveCurrentItem(MoveDirection.Up, true));
            editMenu.AddAction("Move Down", () => MoveCurrentItem(MoveDirection.Down));
            editMenu.AddAction("Move Down 5 Spaces", () => MoveCurrentItem(MoveDirection.Down, 5));
            editMenu.AddAction("Move To Bottom", () => MoveCurrentItem(MoveDirection.Down, true));
            editMenu.AddAction("Expand All Triggers", ExpandAllTriggers);
            editMenu.AddAction("Collapse All Triggers", CollapseAllTriggers);

			var menu = new ContextMenu();
			menu.AddAction("New Trigger", CreateNewTrigger);
			menu.AddAction("New Trigger (Repeating)", CreateNewRepeatingTrigger);
			menu.AddAction("New Region", CreateNewRegion);
			logicGrid.ContextMenu = menu;

            Assembly assembly = Assembly.GetExecutingAssembly();
            FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location);
            string version = fileVersionInfo.FileVersion;
            var aboutString = String.Format("Mission Editor {0}\n\nby Quantum and KingRaptor\n\nFor help with the program, visit {1}", version, GlobalConst.BaseSiteUrl + "/Wiki/MissionEditorStartPage");
            var help = MainMenu.AddContainer("Help");
            help.AddAction("About", () => MessageBox.Show(aboutString, "About Mission Editor", MessageBoxButton.OK, MessageBoxImage.Information));

            autosaveTimer.Start();
		}
		void logic_Loaded(object sender, RoutedEventArgs e)
		{
			var border = (Border)e.Source;
			var item = (TriggerLogic)border.DataContext;
			var menu = new ContextMenu();
			border.ContextMenu = menu;
			menu.AddAction("Rename", () => RenameLogicItem(item));
			menu.AddAction("Move Up", () => MoveItem(MoveDirection.Up, item));
            menu.AddAction("Move Up 5 Spaces", () => MoveItem(MoveDirection.Up, item, 5));
            menu.AddAction("Move to Top", () => MoveItem(MoveDirection.Up, item, true));
			menu.AddAction("Move Down", () => MoveItem(MoveDirection.Down, item));
            menu.AddAction("Move Down 5 Spaces", () => MoveItem(MoveDirection.Down, item, 5));
            menu.AddAction("Move to Bottom", () => MoveItem(MoveDirection.Down, item, true));
			menu.AddAction("Delete", () => DeleteTriggerLogic(item));
			border.ContextMenu = menu;
		}