private void autoRun_Click(object sender, RoutedEventArgs e) { //set windows location to right corner double width = System.Windows.SystemParameters.WorkArea.Width; double height = System.Windows.SystemParameters.WorkArea.Height; Window main = Application.Current.MainWindow; //this.Width = main.Width; // this.Height = main.Height; browser.autoRunImage(); }