示例#1
0
        private void DeviceListView_EncryptionButton_Click(object sender, RoutedEventArgs e)
        {
            PhysicalAddressSerializable clickMac = PhysicalAddressSerializable.Parse(((Button)sender).Tag.ToString());
            Device device = Settings.SettingsData.GetDevice(clickMac);

            if (device.EncryptionEnabled)
            {
                Settings.ConfirmationDialog dialog = new Settings.ConfirmationDialog("Remove encryption?", $"Do you want to remove encryption for communication with '{device.Name}'?", "Yes", "Cancel");
                dialog.Owner = Application.Current.MainWindow;
                if (dialog.ShowDialog() ?? false)
                {
                    Settings.SettingsData.SetDeviceEncryptionPassword(clickMac, null);
                }
            }
            else
            {
                EncryptionPasswordDialog dialog = new EncryptionPasswordDialog(device.Name);
                dialog.Owner = Application.Current.MainWindow;

                if (dialog.ShowDialog() ?? false)
                {
                    Settings.SettingsData.SetDeviceEncryptionPassword(clickMac, dialog.Password);
                }
            }
        }
示例#2
0
        private void DeviceListView_Remove_Click(object sender, RoutedEventArgs e)
        {
            PhysicalAddressSerializable clickMac = PhysicalAddressSerializable.Parse(((Button)sender).Tag.ToString());

            Settings.SettingsData.RemoveDevice(clickMac);
        }