示例#1
0
 public void RemoveLayerEffect(LayerEffectRegistration registration)
 {
     if (registration == null)
     {
         throw new ArgumentNullException(nameof(registration));
     }
     LayerEffectStore.Remove(registration);
 }
示例#2
0
        public LayerEffectRegistration RegisterLayerEffect(LayerEffectDescriptor descriptor)
        {
            if (descriptor == null)
            {
                throw new ArgumentNullException(nameof(descriptor));
            }

            return(LayerEffectStore.Add(descriptor));
        }
示例#3
0
        /// <summary>
        ///     Adds a layer effect descriptor for a given layer effect, so that it appears in the UI.
        ///     <para>Note: You do not need to manually remove these on disable</para>
        /// </summary>
        /// <typeparam name="T">The type of the layer effect you wish to register</typeparam>
        /// <param name="displayName">The name to display in the UI</param>
        /// <param name="description">The description to display in the UI</param>
        /// <param name="icon">
        ///     The Material icon to display in the UI, a full reference can be found
        ///     <see href="https://materialdesignicons.com">here</see>
        /// </param>
        protected void RegisterLayerEffectDescriptor <T>(string displayName, string description, string icon) where T : BaseLayerEffect
        {
            if (!IsEnabled)
            {
                throw new ArtemisPluginFeatureException(this, "Can only add a layer effect descriptor when the plugin is enabled");
            }

            LayerEffectDescriptor descriptor = new(displayName, description, icon, typeof(T), this);

            _layerEffectDescriptors.Add(descriptor);
            LayerEffectStore.Add(descriptor);
        }
示例#4
0
        /// <summary>
        ///     Adds a layer effect descriptor for a given layer effect, so that it appears in the UI.
        ///     <para>Note: You do not need to manually remove these on disable</para>
        /// </summary>
        /// <typeparam name="T">The type of the layer effect you wish to register</typeparam>
        /// <param name="displayName">The name to display in the UI</param>
        /// <param name="description">The description to display in the UI</param>
        /// <param name="icon">
        ///     The Material icon to display in the UI, a full reference can be found <see href="https://materialdesignicons.com">here</see>.
        ///     <para>May also be a path to an SVG file relative to the directory of the plugin.</para>
        /// </param>
        protected void RegisterLayerEffectDescriptor <T>(string displayName, string description, string icon) where T : BaseLayerEffect
        {
            if (!IsEnabled)
            {
                throw new ArtemisPluginFeatureException(this, "Can only add a layer effect descriptor when the plugin is enabled");
            }

            if (icon.ToLower().EndsWith(".svg"))
            {
                icon = Plugin.ResolveRelativePath(icon);
            }
            LayerEffectDescriptor descriptor = new(displayName, description, icon, typeof(T), this);

            _layerEffectDescriptors.Add(descriptor);
            LayerEffectStore.Add(descriptor);
        }
示例#5
0
 public List <LayerEffectDescriptor> GetLayerEffects()
 {
     return(LayerEffectStore.GetAll().Select(r => r.LayerEffectDescriptor).ToList());
 }