committed by
GitHub
18 changed files with 219 additions and 63 deletions
@ -0,0 +1,38 @@ |
|||||
|
using System; |
||||
|
using System.Reactive.Disposables; |
||||
|
|
||||
|
namespace Avalonia.Controls.Mixins |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Extension methods associated with the IDisposable interface.
|
||||
|
/// </summary>
|
||||
|
public static class DisposableMixin |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Ensures the provided disposable is disposed with the specified <see cref="CompositeDisposable"/>.
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="T">
|
||||
|
/// The type of the disposable.
|
||||
|
/// </typeparam>
|
||||
|
/// <param name="item">
|
||||
|
/// The disposable we are going to want to be disposed by the CompositeDisposable.
|
||||
|
/// </param>
|
||||
|
/// <param name="compositeDisposable">
|
||||
|
/// The <see cref="CompositeDisposable"/> to which <paramref name="item"/> will be added.
|
||||
|
/// </param>
|
||||
|
/// <returns>
|
||||
|
/// The disposable.
|
||||
|
/// </returns>
|
||||
|
public static T DisposeWith<T>(this T item, CompositeDisposable compositeDisposable) |
||||
|
where T : IDisposable |
||||
|
{ |
||||
|
if (compositeDisposable is null) |
||||
|
{ |
||||
|
throw new ArgumentNullException(nameof(compositeDisposable)); |
||||
|
} |
||||
|
|
||||
|
compositeDisposable.Add(item); |
||||
|
return item; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,8 +1,13 @@ |
|||||
|
using System; |
||||
|
|
||||
namespace Avalonia.Win32 |
namespace Avalonia.Win32 |
||||
{ |
{ |
||||
static class PlatformConstants |
public static class PlatformConstants |
||||
{ |
{ |
||||
public const string WindowHandleType = "HWND"; |
public const string WindowHandleType = "HWND"; |
||||
public const string CursorHandleType = "HCURSOR"; |
public const string CursorHandleType = "HCURSOR"; |
||||
|
|
||||
|
public static readonly Version Windows8 = new Version(6, 2); |
||||
|
public static readonly Version Windows7 = new Version(6, 1); |
||||
} |
} |
||||
} |
} |
||||
|
|||||
Loading…
Reference in new issue