private void SystemBatteryState_Click(object sender, EventArgs e) { try { var state = _manager.GetSystemBatteryState(); Output.Text = $"Works from socket - {state.AcOnLine}"; } catch (Win32Exception exception) { Output.Text = exception.Message; } }