Other 70-502 Exams :
70-502 Exam
TS: Microsoft .NET Framework 3.5 - Windows Presentation Foundation
- Exam Number/Code : 70-502
- Exam Name : TS: Microsoft .NET Framework 3.5 - Windows Presentation Foundation
- Questions and Answers : 177 Q&As
- Update Time: 2011-03-30
- Price:
$ 123.00$ 99.00
Free 70-502 Demo Download
pass999.info offers free demo for TS 70-502 exam (TS: Microsoft .NET Framework 3.5 - Windows Presentation Foundation). You can check out the interface, question quality and usability of our practice exams before you decide to buy it. We are the only one site can offer demo for almost all products.
Download 70-502 Exam Testing Engine
70-502 Exam Description
It is well known that latest 70-502 exam test is the hot exam of Microsoft certification. pass999.info offer you all the Q&A of the 70-502 real test . It is the examination of the perfect combination and it will help you pass 70-502 exam at the first time!
Exam : Microsoft 70-502
Title : TS: Microsoft .NET Framework 3.5 - Windows Presentation Foundation
1. You are creating a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.
You add a CommandBinding element to the Window element. The command has a keyboard gesture CTRL+H. The Window contains the following MenuItem control.
<MenuItem Header="Highlight Content"
Command="local:CustomCommands.Highlight" />
You need to ensure that the MenuItem control is disabled and the command is not executable when the focus shifts to a TextBox control that does not contain any text.
What should you do?
A. Set the IsEnabled property for the MenuItem control in the GotFocus event handler for the TextBox controls.
B. Set the CanExecute property of the command to Highlight_CanExecute.
Add the following method to the code-behind file for the window.
Private Sub Highlight_CanExecute(ByVal sender As Object, _
ByVal e As CanExecuteRoutedEventArgs)
Dim txtBox As TextBox = CType(sender, TextBox)
e.CanExecute = (txtBox.Text.Length > 0)
End Sub
C. Set the CanExecute property of the command to Highlight_CanExecute.
Add the following method to the code-behind file for the window.
Private Sub Highlight_CanExecute(ByVal sender As Object, _
ByVal e As CanExecuteRoutedEventArgs)
Dim txtBox As TextBox
txtBox = CType(e.Source, TextBox)
e.CanExecute = (txtBox.Text.Length > 0)
End Sub
D. Set the CanExecute property of the command to Highlight_CanExecute.
Add the following method to the code-behind file for the window.
Private Sub Highlight_CanExecute(ByVal sender As Object, _
?ByVal e As CanExecuteRoutedEventArgs)
Dim Menu As MenuItem = CType(e.Source, MenuItem)
Dim txtBox As TextBox = CType(Menu.CommandTarget, TextBox)
Menu.IsEnabled = (txtBox.Text.Length > 0)
End Sub
Answer: C
2. You are creating a Windows Presentation Foundation application by using Microsoft .NET Framework 3.
The application defines a BrowserWindow class. Each instance of the BrowserWindow class allows the user to browse a Web site in a separate window. When a new browser window is opened, the user is redirected to a predefined URL.
You write the following code segment.
01 private void OpenNewWindow(object sender, RoutedEventArgs e)
02 {
03 Thread newWindowThread = new Thread(new
ThreadStart(NewThreadProc));
04
05 newWindowThread.Start();
06 }
07 private void NewThreadProc()
08 {
09 10 ?}
You need to ensure that the following requirements are met:
?The main window of the application is not blocked when an additional browser window is created.
?The application completes execution when the main window of the application is closed.
What should you do?
A. Insert the following code segment at line 04.
newWindowThread.SetApartmentState(ApartmentState.STA);
newWindowThread.IsBackground = true;
Insert the following code segment at line 09.
BrowserWindow newWindow = new BrowserWindow();
newWindow.Show();
Application app = new Application();
app.Run(newWindow);
B. Insert the following code segment at line 04.
newWindowThread.IsBackground = true;
Insert the following code segment at line 09.
newWindowThread.SetApartmentState(ApartmentState.STA);
BrowserWindow newWindow = new BrowserWindow();
newWindow.Show();
Application app = new Application();
app.Run(newWindow);
C. Insert the following code segment at line 04.
newWindowThread.SetApartmentState(ApartmentState.STA);
newWindowThread.IsBackground = false;
Insert the following code segment at line 09.
BrowserWindow newWindow = new BrowserWindow();
System.Windows.Threading.Dispatcher.Run();
newWindow.Show();
D. Insert the following code segment at line 04.
newWindowThread.SetApartmentState(ApartmentState.STA);
newWindowThread.IsBackground = true;
Insert the following code segment at line 09.
BrowserWindow newWindow = new BrowserWindow();
newWindow.Show();
System.Windows.Threading.Dispatcher.Run();
Answer: D
3. You have created a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5. The application, named EnterpriseApplication.exe, runs over the network.
You add the WindowSize parameter and the WindowPosition parameter to the Settings.settings file by using the designer at the User Scope Level. The dimensions and position of the window are read from the user configuration file.
The application must retain the original window size and position for users executing the application.
You need to ensure that the following requirements are met:
?The window dimensions for each user are saved in the user configuration file.
?User settings persist when a user exits the application.
Which configuration setting should you use?
A. Private Sub OnClosing(ByVal sender As Object, ByVal e _
As System.ComponentModel.CancelEventArgs)
My.Settings.Default.WindowPosition = New Point(Me.Left, Me.Top)
My.Settings.Default.WindowSize = New Size(Me.Width, Me.Height)
My.Settings.Default.Save()
End Sub
B. Private Sub OnClosing(ByVal sender As Object, ByVal e As _
System.ComponentModel.CancelEventArgs)
Dim appKey As RegistryKey = _
Registry.CurrentUser.CreateSubKey("SoftwareEnterpriseApplication")
Dim settingsKey As RegistryKey = _
appKey.CreateSubKey("WindowSettings")
Dim windowPositionKey As RegistryKey = _
settingsKey.CreateSubKey("WindowPosition")
Dim windowSizeKey As RegistryKey = _
settingsKey.CreateSubKey("WindowSize")
windowPositionKey.SetValue("X", Me.Left)
windowPositionKey.SetValue("Y", Me.Top)
windowSizeKey.SetValue("Width", Me.Width)
windowSizeKey.SetValue("Height", Me.Height)
End Sub
C. Private Sub OnClosing(ByVal sender As Object, ByVal e As _
System.ComponentModel.CancelEventArgs)
Dim doc As New System.Xml.XmlDocument()
doc.Load("EnterpriseApplication.exe.config")
Dim nodePosition As System.Xml.XmlNode = _
doc.SelectSingleNode("//setting[@name='WindowPosition']")
nodePosition.ChildNodes(0).InnerText = String.Format("{0},{1}", _
Me.Left, Me.Top)
Dim nodeSize As System.Xml.XmlNode = _
doc.SelectSingleNode("//setting[@name='WindowSize']")
nodeSize.ChildNodes(0).InnerText = String.Format("{0},{1}", _
Me.Width, Me.Height)
doc.Save("UserConfigDistractor2.exe.config")
End Sub
D. Private Sub Window_Closing(ByVal sender As Object, ByVal e As _
System.ComponentModel.CancelEventArgs)
Dim sw As New StreamWriter("EnterpriseApplication.exe.config", True)
sw.WriteLine("<EnterpriseApplication.Properties.Settings>")
sw.WriteLine("<setting name=""WindowSize"" serializeAs=""String"">")
sw.WriteLine(String.Format("<value>{0},{1}</value>", Me.Width, _
Me.Height))
sw.WriteLine("</setting>")
sw.WriteLine("<setting name=""WindowPosition"" _
serializeAs=""String"">")
sw.WriteLine(String.Format("<value>{0},{1}</value>", Me.Left, _
Me.Top))
sw.WriteLine("</setting>")
sw.WriteLine("</UserConfigProblem.Properties.Settings>")
sw.Close()
End Sub
Answer: A
4. You create a Windows Presentation Foundation application by using Microsoft .NET Framework 5.
The application is named EnterpriseApplication.exe.
You add the WindowSize parameter and the WindowPosition parameter to the Settings.settings file by using the designer at the User Scope Level. The dimensions and position of the window are read from the user configuration file.
The application must retain the original window size and position for each user who executes the application.
You need to ensure that the following requirements are met:
?The window dimensions for each user are saved in the user configuration file.
?The user settings persist when a user exits the application.
Which configuration setting should you use?
A. private void OnClosing(object sender,
System.ComponentModel.CancelEventArgs e){
Settings.Default.WindowPosition = new Point (this.Left,
this.Top);
Settings.Default.WindowSize = new Size (this.Width,
this.Height);
Settings.Default.Save();
B. private void OnClosing(object sender,
System.ComponentModel.CancelEventArgs e){
RegistryKey appKey =
Registry.CurrentUser.CreateSubKey("Software\EnterpriseApplication");
RegistryKey settingsKey = appKey.CreateSubKey("WindowSettings");
RegistryKey windowPositionKey =
settingsKey.CreateSubKey("WindowPosition");
RegistryKey windowSizeKey = settingsKey.CreateSubKey("WindowSize");
windowPositionKey.SetValue("X", this.Left);
windowPositionKey.SetValue("Y", this.Top);
windowSizeKey.SetValue("Width", this.Width);
windowSizeKey.SetValue("Height", this.Height);
C. private void OnClosing(object sender,
System.ComponentModel.CancelEventArgs e){
XmlDocument doc = new XmlDocument();
doc.Load("EnterpriseApplication.exe.config");
XmlNode nodePosition =
doc.SelectSingleNode("//setting[@name='WindowPosition']");
nodePosition.ChildNodes[0].InnerText = String.Format("{0},{1}",
this.Left, this.Top);
XmlNode nodeSize =
doc.SelectSingleNode("//setting[@name='WindowSize']");
nodeSize.ChildNodes[0].InnerText = String.Format("{0},{1}",
this.Width, this.Height);
doc.Save("UserConfigDistractor2.exe.config");
D. private void Window_Closing(object sender,
System.ComponentModel.CancelEventArgs e){
StreamWriter sw =
new StreamWriter("EnterpriseApplication.exe.config", true);
sw.WriteLine("<EnterpriseApplication.Properties.Settings>");
sw.WriteLine("<setting name=
"WindowSize" serializeAs="String">");
sw.WriteLine(String.Format("<value>{0},{1}</value>",
this.Width, this.Height));
sw.WriteLine("</setting>");
sw.WriteLine("<setting name=
"WindowPosition" serializeAs="String">");
sw.WriteLine(String.Format("<value>{0},{1}</value>", this.Left,
this.Top));
sw.WriteLine("</setting>");
sw.WriteLine("</UserConfigProblem.Properties.Settings>");
sw.Close();
Answer: A
5. You are creating a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.
You add a CommandBinding element to the Window element. The command has a keyboard gesture CTRL+H. The Window contains the following MenuItem control.
<MenuItem Header="Highlight Content"
Command="local:CustomCommands.Highlight" />
You need to ensure that the MenuItem control is disabled and the command is not executable when the focus shifts to a TextBox control that does not contain any text.
What should you do?
A. Set the IsEnabled property for the MenuItem control in the GotFocus event handler for the TextBox controls.
B. Set the CanExecute property of the command to Highlight_CanExecute.
Add the following method to the code-behind file for the window.
private void Highlight_CanExecute(object sender, CanExecuteEventArgs e) {
TextBox txtBox = sender as TextBox;
e.CanExecute = (txtBox.Text.Length > 0);
}
C. Set the CanExecute property of the command to Highlight_CanExecute.
Add the following method to the code behind file for the window.
private void Highlight_CanExecute(object sender, CanExecuteEventArgs e) {
TextBox txtBox = e.Source as TextBox;
e.CanExecute = (txtBox.Text.Length > 0);
}
D. Set the CanExecute property of the command to Highlight_CanExecute.
Add the following method to the code behind file for the window.
private void Highlight_CanExecute(object sender, CanExecuteEventArgs e) {
MenuItem menu = e.Source as MenuItem;
TextBox txtBox = menu.CommandTarget as TextBox;
Menu.IsEnabled = (txtBox.Text.Length > 0);
}
Answer: C
What's pass999.info and what pass999.info can do?
pass999.info provides high quality IT exam practice questions and answers. Especially, Cisco CCNA CCDA CCNP CCIE, Checkpoint CCSE, CompTIA A+ Network+ certification practice exams and so on. We promise that you can pass any IT exam at the first try using pass999.info Testing Engine, or else give you a FULL REFUND. In pass999.info, you also can find latest exam releases about real certification exam resources from most famous IT companies, and we recommend some hot exams for you.
About Microsoft 70-502 exam
There are many ways to prepare for your 70-502 Certification Exam. pass999.info provides the most reliable training tools to prepare for your next 70-502 Certification Exam. Our 70-502 Certification Study Material includes 70-502 test questions, 70-502 practice exam, 70-502 Practice Testing Software, 70-502 Audio Learning and Preparation Labs. We will meet the needs of all about IT certification in pass999.info.
The 70-502 test questions give you possibility to work in any country of the world because they are acknowledged in all countries equally. This pass999.info 70-502 torrent certificate helps not only to improve your knowledge and skills, but it also helps your career, gives a possibility for qualified usage of pass999.info 70-502 exam products under different conditions.
Once you purchase our 70-502 PDF,we will offer you the best service.After you purchase we will offer free update in time for 90 days.No matter any questions you have we will help you solve it. And in 3 weeks we will offer you free updates,so please pay attention our site at all times.
