This repository has been archived by the owner on Dec 29, 2023. It is now read-only.
-
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.
- Loading branch information
Showing
7 changed files
with
151 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Microsoft.Win32; | ||
|
||
namespace WMR_USB_Controller.YUART.Holographic | ||
{ | ||
/// <summary> | ||
/// Base class, that provides base data and behaviour for holographic managers. | ||
/// </summary> | ||
public class HolographicManager | ||
{ | ||
private const string PathToHololensRegKeys = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Holographic"; | ||
protected readonly RegistryKey HololensRegKey = Registry.CurrentUser.OpenSubKey(PathToHololensRegKeys, true); | ||
} | ||
} |
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,49 @@ | ||
using System.Windows.Controls; | ||
using WMR_USB_Controller.YUART.Utilities; | ||
|
||
namespace WMR_USB_Controller.YUART.Holographic.VirtualScreens | ||
{ | ||
/// <summary> | ||
/// Class, that provide methods to manage Virtual Screens Allocation option. | ||
/// </summary> | ||
public sealed class VirtualScreensManager : HolographicManager | ||
{ | ||
private const string VirtualScreensRegkey = "PreallocateVirtualMonitors"; | ||
|
||
private readonly CheckBox _virtualScreensCheckbox; | ||
|
||
public VirtualScreensManager(CheckBox virtualScreensCheckbox) | ||
{ | ||
_virtualScreensCheckbox = virtualScreensCheckbox; | ||
} | ||
|
||
/// <summary> | ||
/// Initialize class and set startup UI values | ||
/// </summary> | ||
public void Initialize() | ||
{ | ||
SetVirtualMonitorsCheckboxValue(); | ||
} | ||
|
||
private void SetVirtualMonitorsCheckboxValue() | ||
{ | ||
if (_virtualScreensCheckbox.IsChecked == null) return; | ||
|
||
_virtualScreensCheckbox.IsChecked = !GetCurrentVirtualScreensStatusFromRegistry(); | ||
} | ||
|
||
private bool GetCurrentVirtualScreensStatusFromRegistry() | ||
{ | ||
return HololensRegKey.IsExists(VirtualScreensRegkey) && ((int) HololensRegKey.GetValue(VirtualScreensRegkey)).ConvertIntToBool(); | ||
} | ||
|
||
/// <summary> | ||
/// Set new status for Virtual Screens option. | ||
/// </summary> | ||
/// <param name="newStatus">Turn on/off virtual screens</param> | ||
public void SetVirtualScreensStatus(bool newStatus) | ||
{ | ||
HololensRegKey.SetValue(VirtualScreensRegkey, newStatus.ConvertBoolToInt()); | ||
} | ||
} | ||
} |