public MainWindow() { InitializeComponent(); this.Closing += MainWindow_Closing; DataContext = this; MonitorPower = new MonitorPower(); PowershellFunctions = new Webcam(); PowershellFunctions.CreateFiles(); bool isEmpty = PowershellFunctions.isEmpty(); btnWebcam.IsChecked = (isEmpty == true ? false : true); brightness = new Brightness(); Task task1 = setRadios(); MySlider.Value = brightness.getBrightness(); txtBrightness.Text = MySlider.Value.ToString(); }