Articles → LIGHT SWITCH 2011 → Close Browser Window In Lightswitch 2011
Close Browser Window In Lightswitch 2011
Software Requirement
- Visual studio 2010 is installed on your machine.
- Visual Studio 2010 service pack 1 is installed on your machine.
- Microsoft Visual Studio Light switch 2011 is installed on your machine.
- Silverlight runtime version 4 or 5 is installed on your machine
Prerequisite Knowledge
- How to create project using visual studio?
- How to create screens in lightswitch?
- What is the role of dispatcher in lightswitch?
Steps Of Execution
- Create a new project
- Add a new screen
- Add assembly and namespace
- Add a button
- Write code to close browser window
Create A New Project
Click to Enlarge
Add A New Screen
Click to Enlarge
Add Assembly And Namespace
Click to Enlarge
Add A Button
Click to Enlarge
Write Code To Close Browser Window
partial void CloseButton_Execute() {
Dispatchers.Main.BeginInvoke(() = >{
// Write your code here.
System.Windows.Browser.HtmlPage.Window.Invoke("close");
});
}
Output
Click to Enlarge