Esempio n. 1
0
        private void connectButton1_DisconnectRequested(object sender, EventArgs e)
        {
            ConnectionSettingCollection.ConnectionSetting setting = Properties.Settings.Default.ConnectionSettings[_hidWriter.BluetoothAddress];

            if (null != setting)
            {
                // Execute the disconnect macro here
                if (!string.IsNullOrEmpty(setting.DisconnectMacro))
                {
                    ExecuteMacro(setting.DisconnectMacro);
                }
            }
            _hidWriter.Disconnect();
        }
Esempio n. 2
0
 private void SaveAddressSettings()
 {
     ConnectionSettingCollection.ConnectionSetting setting = null;
     AddressSelector.BluetoothDevice device = (AddressSelector.BluetoothDevice)_addressComboBox.Items[_oldIndex];
     foreach (ConnectionSettingCollection.ConnectionSetting macroPair in Properties.Settings.Default.ConnectionSettings)
     {
         if (macroPair.Address == device.Address)
         {
             setting = macroPair;
             break;
         }
     }
     if (null == setting)
     {
         setting = new ConnectionSettingCollection.ConnectionSetting();
         Properties.Settings.Default.ConnectionSettings.Add(setting);
         setting.Address    = device.Address;
         setting.LegacyMode = device.LegacyMode;
     }
     setting.ConnectMacro    = ((KeyValuePair <string, string>)_connectMacroComboBox.SelectedItem).Value;
     setting.DisconnectMacro = ((KeyValuePair <string, string>)_disconnectMacroComboBox.SelectedItem).Value;
 }
Esempio n. 3
0
        void _hidWriter_Connected_Invoke()
        {
            AddressSelector.AddNewAddress(_hidWriter.BluetoothAddress, false);

            CheckConnection();

            ConnectionSettingCollection.ConnectionSetting setting = Properties.Settings.Default.ConnectionSettings[_hidWriter.BluetoothAddress];
            if (null == setting)
            {
                ShowNewConnectionSettings();
            }
            setting = Properties.Settings.Default.ConnectionSettings[_hidWriter.BluetoothAddress];

            if (null != setting)
            {
                // Execute the connect macro here
                if (!string.IsNullOrEmpty(setting.ConnectMacro))
                {
                    ExecuteMacro(setting.ConnectMacro);
                }
            }
        }