private void chbxCharger_CheckedChanged(object sender, EventArgs e) { if (chbxCharger.Checked) { phone1.PluginDevice(powerbank) .ExecuteDevice <PowerBank>((i) => { progressBar1.Value = i; }); } else { phone1.DisconnectDevice(powerbank); } }