Skip to content

Commit a6aba70

Browse files
authored
Merge pull request #34 from danielchalmers/master
Cosmetic improvements
2 parents 013afd0 + 6e4b51c commit a6aba70

File tree

10 files changed

+107
-43
lines changed

10 files changed

+107
-43
lines changed

source/VirtualDesktop.WPF/WindowExtensions.cs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,50 +11,66 @@ namespace WindowsDesktop
1111
public static class WindowExtensions
1212
{
1313
/// <summary>
14-
/// Determines whether the window is located over the virtual desktop that current displayed.
14+
/// Returns a bool indicating whether the specified window is on the current virtual desktop.
1515
/// </summary>
1616
public static bool IsCurrentVirtualDesktop(this Window window)
1717
{
1818
return VirtualDesktopHelper.IsCurrentVirtualDesktop(window.GetHandle());
1919
}
2020

2121
/// <summary>
22-
/// Returns a virtual desktop that window is located.
22+
/// Returns the virtual desktop the specified window is located on, or null if the window cannot be found.
2323
/// </summary>
2424
public static VirtualDesktop GetCurrentDesktop(this Window window)
2525
{
2626
return VirtualDesktop.FromHwnd(window.GetHandle());
2727
}
2828

2929
/// <summary>
30-
/// Move this window to specified virtual desktop.
30+
/// Moves a window to the specified virtual desktop.
3131
/// </summary>
3232
public static void MoveToDesktop(this Window window, VirtualDesktop virtualDesktop)
3333
{
3434
VirtualDesktopHelper.MoveToDesktop(window.GetHandle(), virtualDesktop);
3535
}
3636

37+
/// <summary>
38+
/// Switches to the specified virtual desktop and moves the specified window to the virtual desktop.
39+
/// </summary>
40+
/// <param name="window">The window to move.</param>
3741
public static void SwitchAndMove(this VirtualDesktop virtualDesktop, Window window)
3842
{
3943
window.MoveToDesktop(virtualDesktop);
4044
virtualDesktop.Switch();
4145
}
4246

47+
/// <summary>
48+
/// Returns a bool indicating whether the specified window is pinned.
49+
/// </summary>
4350
public static bool IsPinned(this Window window)
4451
{
4552
return VirtualDesktop.IsPinnedWindow(window.GetHandle());
4653
}
4754

55+
/// <summary>
56+
/// Pins the specified window. A pinned window will be shown on all virtual desktops.
57+
/// </summary>
4858
public static void Pin(this Window window)
4959
{
5060
VirtualDesktop.PinWindow(window.GetHandle());
5161
}
5262

63+
/// <summary>
64+
/// Unpins the specified window.
65+
/// </summary>
5366
public static void Unpin(this Window window)
5467
{
5568
VirtualDesktop.UnpinWindow(window.GetHandle());
5669
}
5770

71+
/// <summary>
72+
/// Toggles the specified window between being pinned and unpinned.
73+
/// </summary>
5874
public static void TogglePin(this Window window)
5975
{
6076
var handle = window.GetHandle();
@@ -69,6 +85,9 @@ public static void TogglePin(this Window window)
6985
}
7086
}
7187

88+
/// <summary>
89+
/// Gets the window handle for this <see cref="Visual" />.
90+
/// </summary>
7291
internal static IntPtr GetHandle(this Visual window)
7392
{
7493
var hwndSource = (HwndSource)PresentationSource.FromVisual(window);

source/VirtualDesktop.WinForms/FormExtensions.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,24 @@ namespace WindowsDesktop
88
{
99
public static class FormExtensions
1010
{
11+
/// <summary>
12+
/// Returns a bool indicating whether the form is on the current virtual desktop.
13+
/// </summary>
1114
public static bool IsCurrentVirtualDesktop(this Form form)
1215
{
1316
return VirtualDesktopHelper.IsCurrentVirtualDesktop(form.Handle);
1417
}
1518

19+
/// <summary>
20+
/// Moves a form to the specified virtual desktop.
21+
/// </summary>
1622
public static void MoveToDesktop(this Form form, VirtualDesktop virtualDesktop)
1723
{
1824
VirtualDesktopHelper.MoveToDesktop(form.Handle, virtualDesktop);
1925
}
20-
26+
/// <summary>
27+
/// Returns the virtual desktop the specified form is located on, or null if the form cannot be found.
28+
/// </summary>
2129
public static VirtualDesktop GetCurrentDesktop(this Form form)
2230
{
2331
return VirtualDesktop.FromHwnd(form.Handle);
Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
3-
<metadata>
4-
<id>$id$</id>
5-
<title>$title$</title>
6-
<version>$version$</version>
7-
<authors>$author$</authors>
8-
<owners>$author$</owners>
9-
<licenseUrl>https://github.com/Grabacr07/VirtualDesktop/blob/master/LICENSE</licenseUrl>
10-
<projectUrl>https://github.com/Grabacr07/VirtualDesktop</projectUrl>
11-
<requireLicenseAcceptance>false</requireLicenseAcceptance>
12-
<description>$description$</description>
13-
<language>en-US</language>
14-
<tags>Windows Windows10 Desktop VirtualDesktop WinForms</tags>
15-
<dependencies>
16-
<dependency id="VirtualDesktop" version="1.0.3" />
17-
</dependencies>
18-
</metadata>
3+
<metadata>
4+
<id>$id$</id>
5+
<title>$title$</title>
6+
<version>$version$</version>
7+
<authors>$author$</authors>
8+
<owners>$author$</owners>
9+
<licenseUrl>https://github.com/Grabacr07/VirtualDesktop/blob/master/LICENSE</licenseUrl>
10+
<projectUrl>https://github.com/Grabacr07/VirtualDesktop</projectUrl>
11+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
12+
<description>$description$</description>
13+
<language>en-US</language>
14+
<tags>Windows Windows10 Desktop VirtualDesktop WinForms</tags>
15+
<dependencies>
16+
<dependency id="VirtualDesktop" version="1.0.3" />
17+
</dependencies>
18+
</metadata>
1919
</package>

source/VirtualDesktop/VirtualDesktop.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace WindowsDesktop
1010
{
1111
/// <summary>
12-
/// Encapsulates a virtual desktop on Windows 10.
12+
/// Encapsulates a Windows 10 virtual desktop.
1313
/// </summary>
1414
[ComInterfaceWrapper]
1515
[DebuggerDisplay("{Id}")]
@@ -29,15 +29,15 @@ internal VirtualDesktop(ComInterfaceAssembly assembly, Guid id, object comObject
2929
}
3030

3131
/// <summary>
32-
/// Display the virtual desktop.
32+
/// Displays the virtual desktop.
3333
/// </summary>
3434
public void Switch()
3535
{
3636
ComInterface.VirtualDesktopManagerInternal.SwitchDesktop(this);
3737
}
3838

3939
/// <summary>
40-
/// Remove the virtual desktop.
40+
/// Removes the virtual desktop.
4141
/// </summary>
4242
public void Remove()
4343
{
@@ -46,8 +46,9 @@ public void Remove()
4646
}
4747

4848
/// <summary>
49-
/// Remove the virtual desktop, specifying a virtual desktop that display after destroyed.
49+
/// Removes the virtual desktop.
5050
/// </summary>
51+
/// <param name="fallbackDesktop">A virtual desktop to be displayed after the virtual desktop is removed.</param>
5152
public void Remove(VirtualDesktop fallbackDesktop)
5253
{
5354
if (fallbackDesktop == null) throw new ArgumentNullException(nameof(fallbackDesktop));
@@ -56,7 +57,7 @@ public void Remove(VirtualDesktop fallbackDesktop)
5657
}
5758

5859
/// <summary>
59-
/// Returns a virtual desktop on the left.
60+
/// Returns the adjacent virtual desktop on the left, or null if there are no virtual desktops to the left.
6061
/// </summary>
6162
public VirtualDesktop GetLeft()
6263
{
@@ -71,7 +72,7 @@ public VirtualDesktop GetLeft()
7172
}
7273

7374
/// <summary>
74-
/// Returns a virtual desktop on the right.
75+
/// Returns the adjacent virtual desktop on the right, or null if there are no virtual desktops to the right.
7576
/// </summary>
7677
public VirtualDesktop GetRight()
7778
{

source/VirtualDesktop/VirtualDesktop.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<licenseUrl>https://github.com/Grabacr07/VirtualDesktop/blob/master/LICENSE</licenseUrl>
1010
<projectUrl>https://github.com/Grabacr07/VirtualDesktop</projectUrl>
1111
<requireLicenseAcceptance>false</requireLicenseAcceptance>
12-
<description>$description$ You need to include the app manifest in your project so as to target Windows 10.</description>
12+
<description>$description$ You must target Windows 10 in your app.manifest.</description>
1313
<language>en-US</language>
1414
<tags>Windows Windows10 Desktop VirtualDesktop</tags>
1515
</metadata>

source/VirtualDesktop/VirtualDesktop.static.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ partial class VirtualDesktop
1212
private static bool? _isSupported = null;
1313

1414
/// <summary>
15-
/// Gets a value indicating whether the operating system is support virtual desktop.
15+
/// Gets a value indicating whether virtual desktops are supported by the operating system.
1616
/// </summary>
1717
public static bool IsSupported => GetIsSupported();
1818

@@ -30,9 +30,8 @@ public static VirtualDesktop Current
3030
}
3131

3232
/// <summary>
33-
/// Returns all the virtual desktops of currently valid.
33+
/// Returns an array of available virtual desktops.
3434
/// </summary>
35-
/// <returns></returns>
3635
public static VirtualDesktop[] GetDesktops()
3736
{
3837
VirtualDesktopHelper.ThrowIfNotSupported();
@@ -41,7 +40,7 @@ public static VirtualDesktop[] GetDesktops()
4140
}
4241

4342
/// <summary>
44-
/// Creates a virtual desktop.
43+
/// Returns a new virtual desktop.
4544
/// </summary>
4645
public static VirtualDesktop Create()
4746
{
@@ -51,8 +50,9 @@ public static VirtualDesktop Create()
5150
}
5251

5352
/// <summary>
54-
/// Returns the virtual desktop of the specified identifier.
53+
/// Returns the virtual desktop of the specified identifier, or null if not found.
5554
/// </summary>
55+
/// <param name="desktopId">The identifier of the virtual desktop.</param>
5656
public static VirtualDesktop FromId(Guid desktopId)
5757
{
5858
VirtualDesktopHelper.ThrowIfNotSupported();
@@ -68,17 +68,18 @@ public static VirtualDesktop FromId(Guid desktopId)
6868
}
6969

7070
/// <summary>
71-
/// Returns the virtual desktop that the specified window is located.
71+
/// Returns the virtual desktop the specified window is located on, or null if the window cannot be found.
7272
/// </summary>
73-
public static VirtualDesktop FromHwnd(IntPtr hwnd)
73+
/// <param name="hWnd">The handle of the window.</param>
74+
public static VirtualDesktop FromHwnd(IntPtr hWnd)
7475
{
7576
VirtualDesktopHelper.ThrowIfNotSupported();
7677

77-
if (hwnd == IntPtr.Zero) return null;
78+
if (hWnd == IntPtr.Zero) return null;
7879

7980
try
8081
{
81-
var desktopId = ComInterface.VirtualDesktopManager.GetWindowDesktopId(hwnd);
82+
var desktopId = ComInterface.VirtualDesktopManager.GetWindowDesktopId(hWnd);
8283
return ComInterface.VirtualDesktopManagerInternal.FindDesktop(ref desktopId);
8384
}
8485
catch (COMException ex) when (ex.Match(HResult.REGDB_E_CLASSNOTREG, HResult.TYPE_E_ELEMENTNOTFOUND))

source/VirtualDesktop/VirtualDesktop.static.notification.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ partial class VirtualDesktop
2626
public static event EventHandler ApplicationViewChanged;
2727

2828
/// <summary>
29-
/// Occurs when a current virtual desktop is changed.
29+
/// Occurs when the current virtual desktop is changed.
3030
/// </summary>
3131
public static event EventHandler<VirtualDesktopChangedEventArgs> CurrentChanged;
3232

source/VirtualDesktop/VirtualDesktop.static.pin.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,21 @@ namespace WindowsDesktop
88
{
99
partial class VirtualDesktop
1010
{
11+
/// <summary>
12+
/// Returns a bool indicating whether the specified window is pinned.
13+
/// </summary>
14+
/// <param name="hWnd">The handle of the window.</param>
1115
public static bool IsPinnedWindow(IntPtr hWnd)
1216
{
1317
VirtualDesktopHelper.ThrowIfNotSupported();
1418

1519
return ComInterface.VirtualDesktopPinnedApps.IsViewPinned(hWnd.GetApplicationView());
1620
}
1721

22+
/// <summary>
23+
/// Pins the specified window. A pinned window will be shown on all virtual desktops.
24+
/// </summary>
25+
/// <param name="hWnd">The handle of the window.</param>
1826
public static void PinWindow(IntPtr hWnd)
1927
{
2028
VirtualDesktopHelper.ThrowIfNotSupported();
@@ -27,6 +35,10 @@ public static void PinWindow(IntPtr hWnd)
2735
}
2836
}
2937

38+
/// <summary>
39+
/// Unpins the specified window.
40+
/// </summary>
41+
/// <param name="hWnd">The handle of the window.</param>
3042
public static void UnpinWindow(IntPtr hWnd)
3143
{
3244
VirtualDesktopHelper.ThrowIfNotSupported();
@@ -39,13 +51,21 @@ public static void UnpinWindow(IntPtr hWnd)
3951
}
4052
}
4153

54+
/// <summary>
55+
/// Returns a bool indicating whether the specified app is pinned.
56+
/// </summary>
57+
/// <param name="appId">The identifier of the app.</param>
4258
public static bool IsPinnedApplication([NotNull] string appId)
4359
{
4460
VirtualDesktopHelper.ThrowIfNotSupported();
4561

4662
return ComInterface.VirtualDesktopPinnedApps.IsAppIdPinned(appId);
4763
}
4864

65+
/// <summary>
66+
/// Pins the specified app.
67+
/// </summary>
68+
/// <param name="appId">The identifier of the app.</param>
4969
public static void PinApplication([NotNull] string appId)
5070
{
5171
VirtualDesktopHelper.ThrowIfNotSupported();
@@ -56,6 +76,10 @@ public static void PinApplication([NotNull] string appId)
5676
}
5777
}
5878

79+
/// <summary>
80+
/// Unpins the specified app.
81+
/// </summary>
82+
/// <param name="appId">The identifier of the app.</param>
5983
public static void UnpinApplication([NotNull] string appId)
6084
{
6185
VirtualDesktopHelper.ThrowIfNotSupported();

source/VirtualDesktop/VirtualDesktopDestroyEventArgs.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
namespace WindowsDesktop
44
{
55
/// <summary>
6-
/// Provides data for the <see cref="VirtualDesktop.DestroyBegin"/> and <see cref="VirtualDesktop.DestroyFailed"/>, <see cref="VirtualDesktop.Destroyed"/> event.
6+
/// Provides data for the <see cref="VirtualDesktop.DestroyBegin" /> and <see cref="VirtualDesktop.DestroyFailed" />, <see cref="VirtualDesktop.Destroyed" /> event.
77
/// </summary>
88
public class VirtualDesktopDestroyEventArgs : EventArgs
99
{
1010
/// <summary>
11-
/// Gets which virtual desktop was destroyed.
11+
/// Gets the virtual desktop that was destroyed.
1212
/// </summary>
1313
public VirtualDesktop Destroyed { get; }
1414

1515
/// <summary>
16-
/// Gets the virtual desktop displayed after <see cref="Destroyed"/> is destroyed.
16+
/// Gets the virtual desktop displayed after <see cref="Destroyed" /> is destroyed.
1717
/// </summary>
1818
public VirtualDesktop Fallback { get; }
1919

0 commit comments

Comments
 (0)