Esempio n. 1
0
        private void Remote_CommandReceived(object sender, CommandReceivedEventArgs e)
        {
            if (Settings.Default.IgnoredDevices != null && Settings.Default.IgnoredDevices.Contains(e.Fingerprint))
            {
                return;
            }
            else if (Settings.Default.AuthorizedDevices == null || !Settings.Default.AuthorizedDevices.Contains(e.Fingerprint))
            {
                var confirmResult = MessageBox.Show("Authorize this device?", "Confirm", MessageBoxButtons.YesNo);
                if (confirmResult == DialogResult.No)
                {
                    if (Settings.Default.IgnoredDevices == null)
                    {
                        Settings.Default.IgnoredDevices = new System.Collections.Specialized.StringCollection();
                    }

                    Settings.Default.IgnoredDevices.Add(e.Fingerprint);
                    Settings.Default.Save();
                    return;
                }
                else
                {
                    Settings.Default.AuthorizedDevices = new System.Collections.Specialized.StringCollection();
                    Settings.Default.AuthorizedDevices.Add(e.Fingerprint);
                    Settings.Default.Save();
                }
            }

            if (e.Enabled)
            {
                _lockHandler.ToggleLock(true);
            }
            else
            {
                _lockHandler.ToggleLock(false);
            }
        }