Skip to content

Commit cf8281e

Browse files
lindexiBillWagner
authored andcommitted
Format code (#542)
* Format code In [coding-style.md](https://github.com/dotnet/corefx/blob/master/Documentation/coding-guidelines/coding-style.md ) NO.1, we use Allman style braces, where each brace begins on a new line. * Fix method name * Remove unnecessary brackets
1 parent bdb2194 commit cf8281e

File tree

14 files changed

+172
-146
lines changed

14 files changed

+172
-146
lines changed
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<Window
22
x:Class="CSharp.MainWindow"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5-
>
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
65
<StackPanel>
76
<Button Click="Show1">Show1</Button>
87
<Button Click="Show2">Show2</Button>
@@ -11,4 +10,4 @@
1110
<Button Click="Show5">Show5</Button>
1211
<Button Click="Show6">Show6</Button>
1312
</StackPanel>
14-
</Window>
13+
</Window>

snippets/csharp/VS_Snippets_Wpf/MessageBoxSnippets/CSharp/MainWindow.xaml.cs

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,39 @@
33
using System.Windows;
44
using System.Windows.Controls;
55

6-
namespace CSharp {
7-
public partial class MainWindow : Window {
8-
9-
public MainWindow() {
10-
InitializeComponent();
11-
}
6+
namespace CSharp
7+
{
8+
public partial class MainWindow : Window
9+
{
1210

13-
void Show1(object sender, RoutedEventArgs e) {
14-
(new Show1Window()).ShowDialog();
15-
}
16-
void Show2(object sender, RoutedEventArgs e) {
17-
(new Show2Window()).ShowDialog();
18-
}
19-
void Show3(object sender, RoutedEventArgs e) {
20-
(new Show3Window()).ShowDialog();
21-
}
22-
void Show4(object sender, RoutedEventArgs e) {
23-
(new Show4Window()).ShowDialog();
24-
}
25-
void Show5(object sender, RoutedEventArgs e) {
26-
(new Show5Window()).ShowDialog();
27-
}
28-
void Show6(object sender, RoutedEventArgs e) {
29-
(new Show6Window()).ShowDialog();
11+
public MainWindow()
12+
{
13+
InitializeComponent();
14+
}
15+
16+
private void Show1(object sender, RoutedEventArgs e)
17+
{
18+
new Show1Window().ShowDialog();
19+
}
20+
private void Show2(object sender, RoutedEventArgs e)
21+
{
22+
new Show2Window().ShowDialog();
23+
}
24+
private void Show3(object sender, RoutedEventArgs e)
25+
{
26+
new Show3Window().ShowDialog();
27+
}
28+
private void Show4(object sender, RoutedEventArgs e)
29+
{
30+
new Show4Window().ShowDialog();
31+
}
32+
private void Show5(object sender, RoutedEventArgs e)
33+
{
34+
new Show5Window().ShowDialog();
35+
}
36+
private void Show6(object sender, RoutedEventArgs e)
37+
{
38+
new Show6Window().ShowDialog();
39+
}
3040
}
31-
}
32-
}
41+
}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
<Window x:Class="CSharp.Show1Window"
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
Title="CSharp" Height="300" Width="300"
5-
>
6-
<Button Click="showMessageBoxButton_Click">
4+
Title="CSharp" Height="300" Width="300">
5+
<Button Click="ShowMessageBoxButton_Click">
76
Show MessageBox
87
</Button>
98
</Window>
Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
using System;
22
using System.Windows;
33

4-
namespace CSharp {
4+
namespace CSharp
5+
{
56

6-
public partial class Show1Window : Window {
7+
public partial class Show1Window : Window
8+
{
79

8-
public Show1Window() {
9-
InitializeComponent();
10-
}
11-
12-
//<SnippetMessageBoxShow1CODE>
13-
void showMessageBoxButton_Click(object sender, RoutedEventArgs e) {
14-
// Configure message box
15-
string message = "Hello, MessageBox!";
16-
// Show message box
17-
MessageBoxResult result = MessageBox.Show(message);
10+
public Show1Window()
11+
{
12+
InitializeComponent();
13+
}
14+
15+
//<SnippetMessageBoxShow1CODE>
16+
private void ShowMessageBoxButton_Click(object sender, RoutedEventArgs e)
17+
{
18+
// Configure message box
19+
string message = "Hello, MessageBox!";
20+
// Show message box
21+
MessageBoxResult result = MessageBox.Show(message);
22+
}
23+
//</SnippetMessageBoxShow1CODE>
1824
}
19-
//</SnippetMessageBoxShow1CODE>
20-
}
21-
}
25+
}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
<Window x:Class="CSharp.Show2Window"
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
Title="CSharp" Height="300" Width="300"
5-
>
6-
<Button Click="showMessageBoxButton_Click">
4+
Title="CSharp" Height="300" Width="300">
5+
<Button Click="ShowMessageBoxButton_Click">
76
Show MessageBox
87
</Button>
98
</Window>
Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
11
using System;
22
using System.Windows;
33

4-
namespace CSharp {
4+
namespace CSharp
5+
{
56

6-
public partial class Show2Window : Window {
7+
public partial class Show2Window : Window
8+
{
79

8-
public Show2Window() {
9-
InitializeComponent();
10-
}
10+
public Show2Window()
11+
{
12+
InitializeComponent();
13+
}
1114

12-
//<SnippetMessageBoxShow2CODE>
13-
void showMessageBoxButton_Click(object sender, RoutedEventArgs e) {
14-
// Configure message box
15-
string message = "Message text";
16-
string caption = "Caption text";
17-
// Show message box
18-
MessageBoxResult result = MessageBox.Show(message, caption);
15+
//<SnippetMessageBoxShow2CODE>
16+
private void ShowMessageBoxButton_Click(object sender, RoutedEventArgs e)
17+
{
18+
// Configure message box
19+
string message = "Message text";
20+
string caption = "Caption text";
21+
// Show message box
22+
MessageBoxResult result = MessageBox.Show(message, caption);
23+
}
24+
//</SnippetMessageBoxShow2CODE>
1925
}
20-
//</SnippetMessageBoxShow2CODE>
21-
}
22-
}
26+
}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
<Window x:Class="CSharp.Show3Window"
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
Title="CSharp" Height="300" Width="300"
5-
>
6-
<Button Click="showMessageBoxButton_Click">
4+
Title="CSharp" Height="300" Width="300">
5+
<Button Click="ShowMessageBoxButton_Click">
76
Show MessageBox
87
</Button>
98
</Window>
Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
using System;
22
using System.Windows;
33

4-
namespace CSharp {
4+
namespace CSharp
5+
{
56

6-
public partial class Show3Window : Window {
7+
public partial class Show3Window : Window
8+
{
79

8-
public Show3Window() {
9-
InitializeComponent();
10-
}
10+
public Show3Window()
11+
{
12+
InitializeComponent();
13+
}
1114

12-
//<SnippetMessageBoxShow3CODE>
13-
void showMessageBoxButton_Click(object sender, RoutedEventArgs e) {
14-
// Configure message box
15-
string message = "Hello, MessageBox!";
16-
string caption = "Caption text";
17-
MessageBoxButton buttons = MessageBoxButton.OKCancel;
18-
// Show message box
19-
MessageBoxResult result = MessageBox.Show(message, caption, buttons);
15+
//<SnippetMessageBoxShow3CODE>
16+
private void ShowMessageBoxButton_Click(object sender, RoutedEventArgs e)
17+
{
18+
// Configure message box
19+
string message = "Hello, MessageBox!";
20+
string caption = "Caption text";
21+
MessageBoxButton buttons = MessageBoxButton.OKCancel;
22+
// Show message box
23+
MessageBoxResult result = MessageBox.Show(message, caption, buttons);
24+
}
25+
//</SnippetMessageBoxShow3CODE>
2026
}
21-
//</SnippetMessageBoxShow3CODE>
22-
}
23-
}
27+
}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
<Window x:Class="CSharp.Show4Window"
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
Title="CSharp" Height="300" Width="300"
5-
>
6-
<Button Click="showMessageBoxButton_Click">
4+
Title="CSharp" Height="300" Width="300">
5+
<Button Click="ShowMessageBoxButton_Click">
76
Show MessageBox
87
</Button>
98
</Window>
Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
11
using System;
22
using System.Windows;
33

4-
namespace CSharp {
4+
namespace CSharp
5+
{
56

6-
public partial class Show4Window : Window {
7+
public partial class Show4Window : Window
8+
{
79

8-
public Show4Window() {
9-
InitializeComponent();
10-
}
10+
public Show4Window()
11+
{
12+
InitializeComponent();
13+
}
1114

12-
//<SnippetMessageBoxShow4CODE>
13-
void showMessageBoxButton_Click(object sender, RoutedEventArgs e) {
14-
// Configure message box
15-
string message = "Hello, MessageBox!";
16-
string caption = "Caption text";
17-
MessageBoxButton buttons = MessageBoxButton.OKCancel;
18-
MessageBoxImage icon = MessageBoxImage.Information;
19-
// Show message box
20-
MessageBoxResult result = MessageBox.Show(message, caption, buttons, icon);
15+
//<SnippetMessageBoxShow4CODE>
16+
private void ShowMessageBoxButton_Click(object sender, RoutedEventArgs e)
17+
{
18+
// Configure message box
19+
string message = "Hello, MessageBox!";
20+
string caption = "Caption text";
21+
MessageBoxButton buttons = MessageBoxButton.OKCancel;
22+
MessageBoxImage icon = MessageBoxImage.Information;
23+
// Show message box
24+
MessageBoxResult result = MessageBox.Show(message, caption, buttons, icon);
25+
}
26+
//</SnippetMessageBoxShow4CODE>
2127
}
22-
//</SnippetMessageBoxShow4CODE>
23-
}
24-
}
28+
}

0 commit comments

Comments
 (0)