void ToggleSwitch_Click(object sender, EventArgs e) { ToggleSwitch toggleSwitch = (ToggleSwitch)sender; if (toggleSwitch.getValue()) { PrinterConnectionAndCommunication.Instance.FanSpeed0To255 = 255; } else { PrinterConnectionAndCommunication.Instance.FanSpeed0To255 = 0; } }