예제 #1
0
        /// <summary>
        ///     Raises the <see cref="E:OnEnableEvent" /> event.
        /// </summary>
        /// <param name="e">The <see cref="Base.FeatureBaseEventArgs" /> instance containing the event data.</param>
        public virtual void Enable(Base.FeatureBaseEventArgs e)
        {
            if (this.Enabled)
            {
                return;
            }

            this.Enabled = true;

            this.OnEnableEvent?.Invoke(this, e);
        }
예제 #2
0
        /// <summary>
        ///     Raises the <see cref="E:OnDisableEvent" /> event.
        /// </summary>
        /// <param name="e">The <see cref="Base.FeatureBaseEventArgs" /> instance containing the event data.</param>
        public virtual void Disable(Base.FeatureBaseEventArgs e)
        {
            if (!this.Enabled)
            {
                return;
            }

            this.Enabled = false;

            this.OnDisableEvent?.Invoke(this, e);
        }
예제 #3
0
        /// <summary>
        ///     Raises the <see cref="E:OnDisableEvent" /> event.
        /// </summary>
        /// <param name="e">The <see cref="Base.FeatureBaseEventArgs" /> instance containing the event data.</param>
        public override void Disable(Base.FeatureBaseEventArgs e)
        {
            if (e.Sender == this.owner)
            {
                if (this.Cache != null)
                {
                    e = this.Cache;

                    this.Cache = null;
                }

                base.Disable(e);
                return;
            }

            this.Cache = e;

            this.Menu.Item(this.owner.Path + "." + this.BoolName).SetValue(false);
        }
예제 #4
0
        /// <summary>
        ///     Raises the <see cref="E:OnDisableEvent" /> event.
        /// </summary>
        /// <param name="e">The <see cref="Base.FeatureBaseEventArgs" /> instance containing the event data.</param>
        public override void Disable(Base.FeatureBaseEventArgs e)
        {
            if (e.Sender == this.owner)
            {
                if (this.Cache != null)
                {
                    e          = this.Cache;
                    this.Cache = null;
                }

                base.Disable(e);
                return;
            }

            this.Cache = e;

            var keybind = new KeyBind(this.Key, KeyBindType.Toggle)
            {
                Active = false
            };

            this.Menu.Item(this.owner.Path + "." + this.BoolName).SetValue(keybind);
        }