-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A number of tweaks to Window creation. - Add MainWindow derived class to set OverlappedWindow as default - Allow passing a background brush to Window - Have Application.Run dispose the run window by default - Send messages during creation - Move Get/SetFont handling to Window - Clear HWND when destroyed as it is no longer valid Also - Add DisposableBase to handle double disposal - Add inheritdoc to MessageType
- Loading branch information
1 parent
a106b8f
commit a6f5533
Showing
23 changed files
with
840 additions
and
263 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright (c) Jeremy W. Kuhne. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace Windows; | ||
|
||
/// <summary> | ||
/// Base class for implementing <see cref="IDisposable"/> with double disposal protection. | ||
/// </summary> | ||
public abstract class DisposableBase : IDisposable | ||
{ | ||
private int _disposedValue; | ||
|
||
protected bool Disposed => _disposedValue != 0; | ||
|
||
/// <summary> | ||
/// Called when the component is being disposed or finalized. | ||
/// </summary> | ||
/// <param name="disposing"> | ||
/// <see langword="false"/> if called via a destructor on the finalizer queue. Do not access object fields | ||
/// unless <see langword="true"/>. | ||
/// </param> | ||
protected abstract void Dispose(bool disposing); | ||
|
||
private void DisposeInternal(bool disposing) | ||
{ | ||
// Want to ensure both paths are guarded against double disposal. | ||
if (Interlocked.Exchange(ref _disposedValue, 1) == 1) | ||
{ | ||
return; | ||
} | ||
|
||
Dispose(disposing); | ||
} | ||
|
||
/// <summary> | ||
/// Disposes the component. | ||
/// </summary> | ||
public void Dispose() | ||
{ | ||
DisposeInternal(disposing: true); | ||
GC.SuppressFinalize(this); | ||
} | ||
|
||
/// <summary> | ||
/// <see cref="DisposableBase"/> with a finalizer. | ||
/// </summary> | ||
public abstract class Finalizable : DisposableBase | ||
{ | ||
~Finalizable() => DisposeInternal(disposing: false); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.