Skip to content

Commit

Permalink
Fix command line build
Browse files Browse the repository at this point in the history
Also simplify constructors for Window

Need to figure out how to make SA1518 an error in VS
  • Loading branch information
JeremyKuhne committed Feb 5, 2024
1 parent 9d691ec commit 0690a5d
Show file tree
Hide file tree
Showing 20 changed files with 21 additions and 39 deletions.
2 changes: 1 addition & 1 deletion src/samples/ClipboardViewer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ private class ClipboardViewer : MainWindow
private readonly EditControl _editControl;
private readonly TextLabelControl _textLabel;

public ClipboardViewer(string title) : base(text: title)
public ClipboardViewer(string title) : base(title: title)
{
_editControl = new EditControl(
editStyle: EditControl.Styles.Multiline | EditControl.Styles.Left
Expand Down
2 changes: 1 addition & 1 deletion src/samples/Layout/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ private class LayoutWindow : MainWindow
private readonly StaticControl _staticControl;
private readonly TextLabelControl _textLabel;

public LayoutWindow(string title) : base(title)
public LayoutWindow(string title) : base(title: title)
{
_editControl = new EditControl(
text: "Type text here...",
Expand Down
2 changes: 1 addition & 1 deletion src/samples/Petzold/5th/Beeper/Beeper1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ internal class Beeper1 : MainWindow
private bool _flipFlop = false;
private nuint _timerId;

public Beeper1(string title) : base(title) { }
public Beeper1(string title) : base(title: title) { }

protected override LRESULT WindowProcedure(HWND window, MessageType message, WPARAM wParam, LPARAM lParam)
{
Expand Down
2 changes: 1 addition & 1 deletion src/samples/Petzold/5th/Beeper/Beeper2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal class Beeper2 : MainWindow
private nuint _timerId;
private TimerProcedure? _timerCallback;

public Beeper2(string title) : base(title) { }
public Beeper2(string title) : base(title: title) { }

protected override LRESULT WindowProcedure(HWND window, MessageType message, WPARAM wParam, LPARAM lParam)
{
Expand Down
2 changes: 1 addition & 1 deletion src/samples/Petzold/5th/Bezier/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ internal class Bezier : MainWindow
{
private readonly Point[] _apt = new Point[4];

public Bezier(string title) : base(title)
public Bezier(string title) : base(title: title)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/samples/Petzold/5th/Blokout2/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ internal class Blockout2 : MainWindow
private bool _fBlocking, _fValidBox;
private Point _ptBeg, _ptEnd, _ptBoxBeg, _ptBoxEnd;

public Blockout2(string title) : base(title)
public Blockout2(string title) : base(title: title)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/samples/Petzold/5th/BtnLook/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ private class OwnerDraw : MainWindow
private const int ID_SMALLER = 1;
private const int ID_LARGER = 2;

public OwnerDraw(string title) : base(title)
public OwnerDraw(string title) : base(title: title)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/samples/Petzold/5th/Checker1/Checker1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class Checker1 : MainWindow
private readonly bool[,] _fState = new bool[DIVISIONS, DIVISIONS];
private int _cxBlock, _cyBlock;

public Checker1(string title) : base(title)
public Checker1(string title) : base(title: title)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/samples/Petzold/5th/Checker1/Checker2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal class Checker2 : MainWindow
private readonly bool[,] _state = new bool[DIVISIONS, DIVISIONS];
private int _cxBlock, _cyBlock;

public Checker2(string title) : base(title)
public Checker2(string title) : base(title: title)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/samples/Petzold/5th/Checker1/Checker3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal class Checker3 : MainWindow
private int _cxBlock, _cyBlock;
private readonly Checker3Child _childClass = (Checker3Child)(new Checker3Child().Register());

public Checker3(string title) : base(title)
public Checker3(string title) : base(title: title)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/samples/Petzold/5th/Clock/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ internal class Clock : MainWindow
private readonly GdiPlusBrush _whiteBrush = new SolidBrush(Color.White);
#endif

public Clock(string title) : base(title) { }
public Clock(string title) : base(title: title) { }

private void SetIsotropic(DeviceContext hdc)
{
Expand Down
2 changes: 1 addition & 1 deletion src/samples/Petzold/5th/Clover/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ internal class Clover : MainWindow
private HRGN _hrgnClip;
private const double TWO_PI = Math.PI * 2;

public Clover() : base(text: "Draw a Clover", backgroundBrush: StockBrush.White) { }
public Clover() : base(title: "Draw a Clover", backgroundBrush: StockBrush.White) { }

protected override LRESULT WindowProcedure(HWND window, MessageType message, WPARAM wParam, LPARAM lParam)
{
Expand Down
2 changes: 1 addition & 1 deletion src/samples/Petzold/5th/HelloWin/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private static LRESULT WindowProcedure(HWND window, uint message, WPARAM wParam,

private class HelloWindow : MainWindow
{
public HelloWindow(string text) : base(text, backgroundBrush: StockBrush.White)
public HelloWindow(string title) : base(title: title, backgroundBrush: StockBrush.White)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/samples/Petzold/5th/LineDemo/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ private class LineDemo : MainWindow
{
private static int s_cxClient, s_cyClient;

public LineDemo(string title) : base(title) { }
public LineDemo(string title) : base(title: title) { }

protected override LRESULT WindowProcedure(HWND window, MessageType message, WPARAM wParam, LPARAM lParam)
{
Expand Down
2 changes: 1 addition & 1 deletion src/samples/Windows101/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected override LRESULT WindowProcedure(HWND window, MessageType message, WPA

private class HelloWindow : MainWindow
{
public HelloWindow() : base("HelloWindow")
public HelloWindow() : base(title: "HelloWindow")
{
}

Expand Down
22 changes: 2 additions & 20 deletions src/thirtytwo/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,16 @@ namespace Windows;
public class MainWindow : Window
{
public MainWindow(
Rectangle bounds = default,
string? title = default,
WindowStyles style = WindowStyles.OverlappedWindow,
ExtendedWindowStyles extendedStyle = ExtendedWindowStyles.Default,
WindowClass? windowClass = default,
nint parameters = default,
HMENU menuHandle = default,
HBRUSH backgroundBrush = default) : this(
DefaultBounds,
title,
style,
extendedStyle,
windowClass,
parameters,
menuHandle,
backgroundBrush)
{ }

public MainWindow(
Rectangle bounds,
string? text = default,
WindowStyles style = WindowStyles.OverlappedWindow,
ExtendedWindowStyles extendedStyle = ExtendedWindowStyles.Default,
WindowClass? windowClass = default,
nint parameters = default,
HMENU menuHandle = default,
HBRUSH backgroundBrush = default) : base(
bounds,
text,
title,
style,
extendedStyle,
default,
Expand Down
2 changes: 1 addition & 1 deletion src/thirtytwo/Win32/Graphics/GdiPlus/Brush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ protected override void Dispose(bool disposing)

_pointer = null;
}
}
}
2 changes: 1 addition & 1 deletion src/thirtytwo/Win32/Graphics/GdiPlus/GdiPlusException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ public class GdiPlusException : ThirtyTwoException
{
public GdiPlusException(Status status) : base(status.ToString()) => Status = status;
public Status Status { get; private set; }
}
}
2 changes: 1 addition & 1 deletion src/thirtytwo/Win32/Graphics/GdiPlus/Pen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ protected override void Dispose(bool disposing)

_pointer = null;
}
}
}
2 changes: 1 addition & 1 deletion src/thirtytwo/Win32/Graphics/GdiPlus/SolidBrush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ public SolidBrush(ARGB color) : base(CreateBrush(color))
Interop.GdipCreateSolidFill(color, (GpSolidFill**)&brush).ThrowIfFailed();
return brush;
}
}
}

0 comments on commit 0690a5d

Please sign in to comment.