/// <summary> /// Gets a temporary context. /// </summary> /// <param name="key">Key for the context.</param> /// <param name="defaultValue">Default value of the context.</param> public static GUIContext <TValue> GetTemporaryContext <TValue>(object key, TValue defaultValue) where TValue : struct { var config = GUIContextCache <object, object, TValue> .GetConfig(defaultValue, key); if (config.HasValue == false) { config.HasValue = true; config.Value = defaultValue; } return(config); }
/// <summary> /// Gets a temporary value context. /// </summary> /// <typeparam name="TValue">The type of the value.</typeparam> /// <param name="key">The key for the context.</param> /// <returns>GUIConfig for the specified key.</returns> public static GUIContext <TValue> GetTemporaryContext <TValue>(object key) where TValue : class, new() { var config = GUIContextCache <object, object, TValue> .GetConfig(defaultConfigKey, key); if (config.HasValue == false) { config.HasValue = true; config.Value = new TValue(); } return(config); }
/// <summary> /// Gets a temporary value context. /// </summary> /// <typeparam name="TValue">The type of the config value.</typeparam> /// <param name="key">The key for the config.</param> /// <param name="name">The name of the config.</param> /// <returns>GUIConfig for the specified key and name.</returns> public static GUIContext <TValue> GetTemporaryContext <TValue>(object key, string name) where TValue : class, new() { var config = GUIContextCache <object, string, TValue> .GetConfig(key, name); if (config.HasValue == false) { config.HasValue = true; config.Value = new TValue(); } return(config); }
/// <summary> /// Gets a temporary nullable value context. /// </summary> /// <param name="key">Key for the context.</param> public static GUIContext <TValue> GetTemporaryNullableContext <TValue>(object key) where TValue : class { return(GUIContextCache <object, object, TValue> .GetConfig(defaultConfigKey, key)); }
/// <summary> /// Gets a temporary nullable value context. /// </summary> /// <param name="primaryKey">Primary key for the context.</param> /// <param name="secondaryKey">Secondary key for the context.</param> public static GUIContext <TValue> GetTemporaryNullableContext <TValue>(object primaryKey, object secondaryKey) where TValue : class { return(GUIContextCache <object, object, TValue> .GetConfig(primaryKey, secondaryKey)); }
/// <summary> /// Gets a temporary nullable value context. /// </summary> /// <param name="key">Key for context.</param> /// <param name="id">Id of the context.</param> public static GUIContext <TValue> GetTemporaryNullableContext <TValue>(object key, int id) where TValue : class { return(GUIContextCache <object, int, TValue> .GetConfig(key, id)); }
/// <summary> /// Gets a temporary nullable value context. /// </summary> /// <param name="key">Key for context.</param> /// <param name="name">Name for the context.</param> public static GUIContext <TValue> GetTemporaryNullableContext <TValue>(object key, string name) where TValue : class { return(GUIContextCache <object, string, TValue> .GetConfig(key, name)); }