コード例 #1
0
 private void rootPanel_eventVisibilityChanged(UIComponent component, bool value)
 {
     // Only save and apply the configuration if the rootpanel was visible but isn't anymore (meaning the user closed the window)
     if (_wasVisible && !value)
     {
         _configuration.SaveConfiguration();
         _configuration.ApplyConfiguration();
     }
     this._wasVisible = value;
 }
コード例 #2
0
ファイル: Mod.cs プロジェクト: gertjanstulp/CSWorkshopMonitor
        private void Load()
        {
            try
            {
                _configuration = ConfigurationContainer.LoadConfiguration(_settingsFilePath);
            }
            catch (Exception ex)
            {
                ModLogger.Warning("An error occured while loading mod configuration from file '{0}', the default configuration will be applied", _settingsFilePath);
                ModLogger.Exception(ex);

                // Always create a configuration object, even when the file could not be loaded. This way the mod will not crash on configuration issues
                _configuration = new ConfigurationContainer();
            }

            // Apply the configuration to the running mod.
            _configuration.ApplyConfiguration();
        }