Skip to content

Commit 5c011eb

Browse files
committed
Improve style
1 parent e417ad0 commit 5c011eb

File tree

4 files changed

+42
-35
lines changed

4 files changed

+42
-35
lines changed

solution/GraphicalDebugging/ExpressionLoader_Util.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ public bool Update()
3737
IntPtr mainWindowHandle = Util.GetWindowHandle(System.Windows.Application.Current.MainWindow);
3838
System.Threading.Thread thread = new System.Threading.Thread(() =>
3939
{
40-
LoadingWindow w = new LoadingWindow();
41-
w.Title = "Loading takes much time.";
40+
LoadingWindow w = new LoadingWindow
41+
{
42+
Title = "Loading takes much time."
43+
};
4244
w.Show();
4345
w.Closed += (sender2, e2) => w.Dispatcher.InvokeShutdown();
4446
IntPtr wHandle = Util.GetWindowHandle(w);

solution/GraphicalDebugging/GeometryWatchControl.xaml.cs

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@ namespace GraphicalDebugging
2727
/// </summary>
2828
public partial class GeometryWatchControl : UserControl
2929
{
30-
Util.IntsPool m_colorIds;
30+
readonly Util.IntsPool m_colorIds;
3131

32-
private bool m_isDataGridEdited;
32+
bool m_isDataGridEdited;
3333

34-
Bitmap m_emptyBitmap;
34+
readonly Bitmap m_emptyBitmap;
3535

36-
System.Windows.Shapes.Rectangle m_selectionRect = new System.Windows.Shapes.Rectangle();
37-
System.Windows.Shapes.Line m_mouseVLine = new System.Windows.Shapes.Line();
38-
System.Windows.Shapes.Line m_mouseHLine = new System.Windows.Shapes.Line();
39-
TextBlock m_mouseTxt = new TextBlock();
40-
Geometry.Point m_pointDown = new Geometry.Point(0, 0);
36+
readonly System.Windows.Shapes.Rectangle m_selectionRect = new System.Windows.Shapes.Rectangle();
37+
readonly System.Windows.Shapes.Line m_mouseVLine = new System.Windows.Shapes.Line();
38+
readonly System.Windows.Shapes.Line m_mouseHLine = new System.Windows.Shapes.Line();
39+
readonly TextBlock m_mouseTxt = new TextBlock();
40+
readonly Geometry.Point m_pointDown = new Geometry.Point(0, 0);
4141
bool m_mouseDown = false;
42-
ZoomBox m_zoomBox = new ZoomBox();
42+
readonly ZoomBox m_zoomBox = new ZoomBox();
4343
Geometry.Box m_currentBox = null;
4444
LocalCS m_currentLocalCS = null;
4545

@@ -306,11 +306,10 @@ private void UpdateItems(bool load, int modified_index = -1)
306306
// returned becasue traits are loaded from an element
307307
// (linestring) but there are no elements since the
308308
// multi-geometry is empty.
309-
ExpressionDrawer.IDrawable d = null;
310-
Geometry.Traits t = null;
311309
ExpressionLoader.Load(names[i],
312310
ExpressionLoader.OnlyGeometriesOrGeometryContainer,
313-
out t, out d);
311+
out Geometry.Traits t,
312+
out ExpressionDrawer.IDrawable d);
314313
if (t == null) // Traits has to be defined for Geometry
315314
d = null;
316315
Geometries[i].Drawable = d;
@@ -345,15 +344,19 @@ private void UpdateItems(bool load, int modified_index = -1)
345344
}
346345

347346
imageGrid.ContextMenu = new ContextMenu();
348-
MenuItem mi = new MenuItem();
349-
mi.Header = "Copy";
347+
MenuItem mi = new MenuItem
348+
{
349+
Header = "Copy"
350+
};
350351
mi.Click += MenuItem_Copy;
351352
if (imageEmpty)
352353
mi.IsEnabled = false;
353354
imageGrid.ContextMenu.Items.Add(mi);
354355
imageGrid.ContextMenu.Items.Add(new Separator());
355-
MenuItem mi2 = new MenuItem();
356-
mi2.Header = "Reset View";
356+
MenuItem mi2 = new MenuItem
357+
{
358+
Header = "Reset View"
359+
};
357360
mi2.Click += MenuItem_ResetZoom;
358361
if (imageEmpty)
359362
mi2.IsEnabled = false;

solution/GraphicalDebugging/GraphicalDebuggingPackage.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ namespace GraphicalDebugging
3434
[InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] // Info on this package for Help/About
3535
[ProvideMenuResource("Menus.ctmenu", 1)]
3636
[Guid(GraphicalDebuggingPackage.PackageGuidString)]
37-
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "pkgdef, VS and vsixmanifest are valid VS terms")]
3837
[ProvideToolWindow(typeof(GeometryWatch), MultiInstances = true)]
3938
[ProvideToolWindow(typeof(GraphicalWatch), MultiInstances = true)]
4039
[ProvideToolWindow(typeof(PlotWatch), MultiInstances = true)]

solution/GraphicalDebugging/PlotWatchControl.xaml.cs

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@ namespace GraphicalDebugging
2727
/// </summary>
2828
public partial class PlotWatchControl : UserControl
2929
{
30-
Util.IntsPool m_colorIds;
30+
readonly Util.IntsPool m_colorIds;
3131

32-
private bool m_isDataGridEdited;
32+
bool m_isDataGridEdited;
3333

34-
Bitmap m_emptyBitmap;
34+
readonly Bitmap m_emptyBitmap;
3535

36-
System.Windows.Shapes.Rectangle m_selectionRect = new System.Windows.Shapes.Rectangle();
37-
System.Windows.Shapes.Line m_mouseVLine = new System.Windows.Shapes.Line();
38-
System.Windows.Shapes.Line m_mouseHLine = new System.Windows.Shapes.Line();
39-
TextBlock m_mouseTxt = new TextBlock();
40-
Geometry.Point m_pointDown = new Geometry.Point(0, 0);
36+
readonly System.Windows.Shapes.Rectangle m_selectionRect = new System.Windows.Shapes.Rectangle();
37+
readonly System.Windows.Shapes.Line m_mouseVLine = new System.Windows.Shapes.Line();
38+
readonly System.Windows.Shapes.Line m_mouseHLine = new System.Windows.Shapes.Line();
39+
readonly TextBlock m_mouseTxt = new TextBlock();
40+
readonly Geometry.Point m_pointDown = new Geometry.Point(0, 0);
4141
bool m_mouseDown = false;
42-
ZoomBox m_zoomBox = new ZoomBox();
42+
readonly ZoomBox m_zoomBox = new ZoomBox();
4343
Geometry.Box m_currentBox = null;
4444
LocalCS m_currentLocalCS = null;
4545

@@ -307,9 +307,8 @@ private void UpdateItems(bool load, int modified_index = -1)
307307
{
308308
try
309309
{
310-
ExpressionDrawer.IDrawable d = null;
311-
Geometry.Traits t = null;
312-
ExpressionLoader.Load(names[i], ExpressionLoader.OnlyMultiPoints, out t, out d);
310+
ExpressionLoader.Load(names[i], ExpressionLoader.OnlyMultiPoints,
311+
out Geometry.Traits t, out ExpressionDrawer.IDrawable d);
313312
if (d != null)
314313
{
315314
if (t != null)
@@ -350,15 +349,19 @@ private void UpdateItems(bool load, int modified_index = -1)
350349
}
351350

352351
imageGrid.ContextMenu = new ContextMenu();
353-
MenuItem mi = new MenuItem();
354-
mi.Header = "Copy";
352+
MenuItem mi = new MenuItem
353+
{
354+
Header = "Copy"
355+
};
355356
mi.Click += MenuItem_Copy;
356357
if (imageEmpty)
357358
mi.IsEnabled = false;
358359
imageGrid.ContextMenu.Items.Add(mi);
359360
imageGrid.ContextMenu.Items.Add(new Separator());
360-
MenuItem mi2 = new MenuItem();
361-
mi2.Header = "Reset View";
361+
MenuItem mi2 = new MenuItem
362+
{
363+
Header = "Reset View"
364+
};
362365
mi2.Click += MenuItem_ResetZoom;
363366
if (imageEmpty)
364367
mi2.IsEnabled = false;

0 commit comments

Comments
 (0)