private void Activate_Click(object sender, RoutedEventArgs e) { if (_log.IsDebugEnabled) { _log.DebugFormat("Starting {0}", MethodBase.GetCurrentMethod().ToString()); } bool WasPlaying = RussLibraryAudio.AudioServer.Current.IsPlaying; if (WasPlaying) { RussLibraryAudio.AudioServer.Current.Stop(); } Button btn = sender as Button; if (btn != null) { ModConfiguration mod = btn.CommandParameter as ModConfiguration; if (mod != null) { ModManagement.Activate(mod); } } if (WasPlaying) { RussLibraryAudio.AudioServer.Current.PlayNextInQueue(); } if (_log.IsDebugEnabled) { _log.DebugFormat("Ending {0}", MethodBase.GetCurrentMethod().ToString()); } }
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); }
private void Activate_Click(object sender, RoutedEventArgs e) { if (_log.IsDebugEnabled) { _log.DebugFormat("Starting {0}", MethodBase.GetCurrentMethod().ToString()); } Button btn = sender as Button; if (btn != null) { ModConfiguration mod = btn.CommandParameter as ModConfiguration; if (mod != null) { ModManagement.Activate(mod); } } if (_log.IsDebugEnabled) { _log.DebugFormat("Ending {0}", MethodBase.GetCurrentMethod().ToString()); } }
private void ActivateStock_Click(object sender, RoutedEventArgs e) { bool WasPlaying = RussLibraryAudio.AudioServer.Current.IsPlaying; if (WasPlaying) { RussLibraryAudio.AudioServer.Current.Stop(); } if (!ModManagement.IsInstalled(DataStrings.StockID)) { if (!Directory.Exists(System.IO.Path.Combine(Locations.InstalledModsPath, DataStrings.StockID))) { Locations.MessageBoxShow("Stock Mod is not installed and Stock Mod install folder does not exist--cannot continue.", MessageBoxButton.OK, MessageBoxImage.Error); } else { ModConfiguration configuration = new ModConfiguration(DataStrings.ModStockFile); configuration.InstalledPath = System.IO.Path.Combine(Locations.InstalledModsPath, DataStrings.StockID); InstalledModConfigurations.Current.Configurations.Configurations.Insert(0, configuration); InstalledModConfigurations.Current.Save(); } } foreach (ModConfiguration configuration in InstalledModConfigurations.Current.Configurations.Configurations) { if (configuration.ID == DataStrings.StockID) { ModManagement.Activate(configuration); Locations.MessageBoxShow("Activated stock.", MessageBoxButton.OK, MessageBoxImage.Information); } } if (WasPlaying) { RussLibraryAudio.AudioServer.Current.PlayNextInQueue(); } Locations.MessageBoxShow("done.", MessageBoxButton.OK, MessageBoxImage.Information); }