Esempio n. 1
0
 public override void OnDisabled()
 {
     if (Plugin == null)
     {
         UpdatePlugin();
     }
     if (Plugin != null)
     {
         Disable.Invoke(Plugin, null);
     }
 }
        private void DisableHandler(string name)
        {
            Logger.Trace("DisableHandler called");
            var currentAutoStarts = GetCurrentAutoStarts();

            foreach (var currentAutoStart in currentAutoStarts)
            {
                if (currentAutoStart.Value == name)
                {
                    Disable?.Invoke(currentAutoStart);
                }
            }
        }
        private void DisableHandler(string name)
        {
            Logger.Trace("DisableHandler called");
            var currentAutoStarts = GetCurrentAutoStarts();

            foreach (var currentAutoStart in currentAutoStarts)
            {
                var currentDisableName = currentAutoStart.Path.Substring(currentAutoStart.Path.LastIndexOf('\\') + 1);
                if (currentDisableName == name)
                {
                    Disable?.Invoke(currentAutoStart);
                }
            }
        }
Esempio n. 4
0
        public ISoundOut GetSoundOut()
        {
            if (!IsAvailable)
            {
                return(null);
            }

            if (CurrentSoundOutDevice == null)
            {
                foreach (var soundOutMode in SoundOutModes)
                {
                    if (soundOutMode.Devices.Count == 0)
                    {
                        break;
                    }
                    _currentSoundOutDevice = soundOutMode.Devices[0];
                    break;
                }

                if (_currentSoundOutDevice == null)
                {
                    IsAvailable = false;
                    Disable?.Invoke(this, EventArgs.Empty);
                    return(null);
                }
            }

            foreach (var mode in SoundOutModes)
            {
                var soundOutMode = (SoundOutMode)mode;
                // ReSharper disable once PossibleNullReferenceException
                if (soundOutMode.SoundOutType == ((SoundOutDevice)CurrentSoundOutDevice).Type)
                {
                    try
                    {
                        return(soundOutMode.GetSoundOut(CurrentSoundOutDevice));
                    }
                    catch (NoDeviceFoundException)
                    {
                    }
                }
            }

            IsAvailable = false;
            Disable?.Invoke(this, EventArgs.Empty);
            return(null);
        }
Esempio n. 5
0
 private void panel1_Click(object sender, EventArgs e)
 {
     try
     {
         System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
         //
         if (line.enable == "0")
         {
             throw new Exception("该行已经失效");
         }
         //
         if (Program.frmMsgYesNo("确认失效该行?") == DialogResult.No)
         {
             System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
             return;
         }
         //
         bll.DisableRow(line.ord_id, line.row_index);
         //
         line.enable = "0";
         this.panel1.BackgroundImage = pictureBox1.Image;
         this.panel1.Enabled         = false;
         this.panel2.BackgroundImage = pictureBox2.Image;
         this.lblindex.ForeColor     = Color.Gray;
         this.lblgoodsname.ForeColor = Color.Gray;
         this.lblremark.ForeColor    = Color.Gray;
         this.lblqty.ForeColor       = Color.Gray;
         this.lblamount.ForeColor    = Color.Gray;
         //
         if (Disable != null)
         {
             Disable.Invoke(this);
         }
     }
     catch (Exception ex)
     {
         Program.frmMsg(ex.Message);
     }
     finally
     {
         System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
     }
 }
        private void ChangeHandler(object sender, RegistryChangeEventArgs e)
        {
            Logger.Trace("ChangeHandler called for {DisableBasePath}", DisableBasePath);
            var newEnableStatus = GetCurrentEnableStatus();

            foreach (var newStatus in newEnableStatus)
            {
                var name       = newStatus.Key;
                var nowEnabled = newStatus.Value;
                var wasEnabled = true;
                if (lastEnableStatus.ContainsKey(name))
                {
                    wasEnabled = lastEnableStatus[name];
                }
                if (wasEnabled != nowEnabled)
                {
                    if (nowEnabled)
                    {
                        Enable?.Invoke(name);
                    }
                    else
                    {
                        Disable?.Invoke(name);
                    }
                }
            }
            foreach (var lastStatus in lastEnableStatus)
            {
                var name       = lastStatus.Key;
                var wasEnabled = lastStatus.Value;
                if (newEnableStatus.ContainsKey(name))
                {
                    continue;
                }
                if (!wasEnabled)
                {
                    Enable?.Invoke(name);
                }
            }
            lastEnableStatus = newEnableStatus;
        }
Esempio n. 7
0
        private void CheckCurrentState()
        {
            if (SoundOutModes.Any(x => x.Devices.Count > 0))
            {
                if (IsAvailable)
                {
                    return;
                }

                IsAvailable = true;
                Enable?.Invoke(this, EventArgs.Empty);
                return;
            }

            if (!IsAvailable)
            {
                return;
            }
            IsAvailable = false;
            Disable?.Invoke(this, EventArgs.Empty);
        }
Esempio n. 8
0
        private void CheckCurrentState()
        {
            if (
                SoundOutList.Any(
                    soundOutRepresenter => soundOutRepresenter.AudioDevices.Any(x => x.ID != DefaultDevicePlaceholder)))
            {
                if (_enabled == true)
                {
                    return;
                }
                _enabled = true;
                Enable?.Invoke(this, EventArgs.Empty);
                return;
            }

            if (_enabled == true)
            {
                _enabled = false;
                Disable?.Invoke(this, EventArgs.Empty);
            }
        }
 private void DisableHandler(AutoStartEntry e)
 {
     Logger.Trace("DisableHandler called");
     Disable?.Invoke(e);
 }
Esempio n. 10
0
 private void OnDisable() => Disable?.Invoke();