private void Test_Click(object sender, RoutedEventArgs e) { if (ModManagement.IsActive(Configuration.ID)) { if (Locations.MessageBoxShow("This Mod is currently active. In order to apply your changes, the Mod must first be deactivated, the re-activated.\r\n\r\nDo you wish to deactivate then re-activate this Mod for testing?", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { do { ModManagement.DeactivateLastMod(); } while (ModManagement.IsActive(Configuration.ID)); ModManagement.NotifyMissionInstall(); } else { Locations.MessageBoxShow("Test canceled.", MessageBoxButton.OK, MessageBoxImage.Stop); return; } } if (!DependentModsActive()) { if (Locations.MessageBoxShow("Active Mods differ from what this Mod depends on.\r\n\r\nDo you want to deactivate these Mods and activate the dependent Mods?", MessageBoxButton.OK, MessageBoxImage.Question) == MessageBoxResult.Yes) { while (ModManagement.DeactivateLastMod()) { } foreach (StringItem item in Configuration.DependsOn) { foreach (ModConfiguration config in InstalledModConfigurations.Current.Configurations.Configurations) { if (config.ID == item.Text) { ModManagement.Activate(config); } } } ModManagement.NotifyMissionInstall(); } else { Locations.MessageBoxShow("Test canceled. Please change Mod dependencies to match the list of Activated Mods.", MessageBoxButton.OK, MessageBoxImage.Stop); return; } } ModManagement.Activate(Configuration); System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(WaitForActivation), Configuration.ID); }