Skip to content

Commit d148167

Browse files
committed
fix snippets warning
1 parent e032cf7 commit d148167

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

snippets/csharp/System.Windows.Threading/Dispatcher/CheckAccess/Window1.xaml.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace SDKSamples
88
{
99
public partial class Window1 : Window
1010
{
11-
// Delegate used to push a worker itme onto the Dispatcher.
11+
// Delegate used to push a worker item onto the Dispatcher.
1212
private delegate void UpdateUIDelegate(Button button);
1313

1414
public Window1()
@@ -21,7 +21,7 @@ public Window1()
2121
}
2222

2323
//<SnippetDispatcherAccessCheckAccess>
24-
// Uses the Dispatcher.CheckAccess method to determine if
24+
// Uses the Dispatcher.CheckAccess method to determine if
2525
// the calling thread has access to the thread the UI object is on.
2626
private void TryToUpdateButtonCheckAccess(object uiObject)
2727
{
@@ -47,7 +47,7 @@ private void TryToUpdateButtonCheckAccess(object uiObject)
4747
//</SnippetDispatcherAccessCheckAccess>
4848

4949
//<SnippetDispatcherAccessVerifyAccess>
50-
// Uses the Dispatcher.VerifyAccess method to determine if
50+
// Uses the Dispatcher.VerifyAccess method to determine if
5151
// the calling thread has access to the thread the UI object is on.
5252
private void TryToUpdateButtonVerifyAccess(object uiObject)
5353
{
@@ -69,7 +69,7 @@ private void TryToUpdateButtonVerifyAccess(object uiObject)
6969
{
7070
// Exception Error Message.
7171
MessageBox.Show("Exception ToString: \n\n" + e.ToString(),
72-
"Execption Caught! Thrown During AccessVerify().");
72+
"Exception Caught! Thrown During AccessVerify().");
7373

7474
MessageBox.Show("Pushing job onto UI Thread Dispatcher");
7575

snippets/csharp/System.Windows.Threading/DispatcherObject/CheckAccess/Window1.xaml.cs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
using System;
2+
using System.Threading;
23
using System.Windows;
34
using System.Windows.Controls;
4-
using System.Windows.Data;
5-
using System.Windows.Documents;
6-
using System.Windows.Input;
7-
using System.Windows.Media;
8-
using System.Threading;
95
using System.Windows.Threading;
106

117
namespace SDKSamples
128
{
139
public partial class Window1 : Window
14-
{
10+
{
1511
// Delegate used to place a work item onto the Dispatcher.
1612
private delegate void UpdateUIDelegate(Button button);
1713

@@ -20,7 +16,7 @@ public Window1()
2016
InitializeComponent();
2117

2218
// Get the id of the UI thread for display purposes.
23-
_uiThreadID = this.Dispatcher.Thread.ManagedThreadId;
19+
_uiThreadID = Dispatcher.Thread.ManagedThreadId;
2420
lblUIThreadID.Content = _uiThreadID;
2521
}
2622

@@ -34,7 +30,7 @@ private void TryToUpdateButtonCheckAccess(object uiObject)
3430
if (theButton != null)
3531
{
3632
// Checking if this thread has access to the object
37-
if(theButton.CheckAccess())
33+
if (theButton.CheckAccess())
3834
{
3935
// This thread has access so it can update the UI thread
4036
UpdateButtonUI(theButton);
@@ -73,7 +69,7 @@ private void TryToUpdateButtonVerifyAccess(object uiObject)
7369
catch (InvalidOperationException e)
7470
{
7571
// Exception error meessage.
76-
MessageBox.Show("Exception ToString: \n\n" + e.ToString(),
72+
MessageBox.Show("Exception ToString: \n\n" + e.ToString(),
7773
"Execption Caught! Thrown During AccessVerify().");
7874

7975
MessageBox.Show("Pushing job onto UI Thread Dispatcher");
@@ -88,7 +84,7 @@ private void TryToUpdateButtonVerifyAccess(object uiObject)
8884
private void threadStartingCheckAccess()
8985
{
9086
// Try to update a Button created on the UI thread.
91-
TryToUpdateButtonCheckAccess(ButtonOnUIThread);
87+
TryToUpdateButtonCheckAccess(ButtonOnUIThread);
9288
}
9389

9490
private void threadStartingVerifyAccess()
@@ -102,7 +98,7 @@ private void CreateThread(object sender, RoutedEventArgs e)
10298
ThreadStart threadStartingPoint;
10399

104100
// Determine which ThreadStart to use.
105-
if (rbCheckAccess.IsChecked)
101+
if (rbCheckAccess.IsChecked.Value)
106102
{
107103
threadStartingPoint = new ThreadStart(threadStartingCheckAccess);
108104
}
@@ -130,4 +126,4 @@ private void UpdateButtonUI(Button theButton)
130126
private int _uiThreadID;
131127
private int _backgroundThreadID;
132128
}
133-
}
129+
}

0 commit comments

Comments
 (0)