From 14d9a914793414aa4914b6e289f078a0204c5417 Mon Sep 17 00:00:00 2001 From: ytdlder Date: Wed, 21 Feb 2024 11:18:31 +0100 Subject: [PATCH 1/3] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index dd120b3..fae5072 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,9 @@ Reads the Windows registry which OpenXR runtimes/layers are installed, checks if * Windows 7, 10, 11 * .NET 6.0 Runtime *(if not using the rather big single EXE)* + * [Microsoft Runtime Download](https://dotnet.microsoft.com/en-us/download/dotnet/6.0) + * under **.NET Desktop Runtime 6.x.x**, next to **Windows**, click on your arch type (x86, x64) to download the newest runtime + * __Direct Link__: [Latest x64 Runtime](https://aka.ms/dotnet/6.0/windowsdesktop-runtime-win-x64.exe) * !! REQUIRES ADMIN RIGHTS !! *(-> the reg keys are located in _HKLM_!)* ### Installing From 91f0972c871381bd5e943e77e9f28a1621c26227 Mon Sep 17 00:00:00 2001 From: ytdlder Date: Tue, 6 Aug 2024 13:51:19 +0200 Subject: [PATCH 2/3] Update to 1.1 --- Functions.cs | 35 +++++++++++----- OpenXR Switcher.csproj | 1 + README.md | 3 ++ WindowMain.Designer.cs | 93 +++++++++++++++++++++++++++--------------- WindowMain.cs | 40 ++++++++++++++++++ WindowMain.resx | 3 ++ 6 files changed, 131 insertions(+), 44 deletions(-) diff --git a/Functions.cs b/Functions.cs index 4d9986c..e89ea01 100644 --- a/Functions.cs +++ b/Functions.cs @@ -6,6 +6,7 @@ using System.Configuration; using System.Diagnostics; using System.Linq; +using System.Reflection.Emit; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; @@ -248,30 +249,42 @@ private static bool WriteToReg(string Key, string Name, string Value, RegistryVa return false; } - private static void AddPanel(FlowLayoutPanel layoutpanel, string filepath, string value=null) + private static void AddPanel(FlowLayoutPanel layoutpanel, string filepath, string value = null) { - string filepathname = Path.GetFileName(filepath); - string[] temp = filepathname.Split('_', '-'); + string filename = Path.GetFileName(filepath); + + string[] parts = filepath.Split('\\'); + string filepathname = parts[parts.Length - 2] + '\\' + parts[parts.Length - 1]; + int image_width_border = 3; - if (string.Equals(filepathname, "MixedRealityRuntime.json", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(filepathname, "System32\\MixedRealityRuntime.json", StringComparison.OrdinalIgnoreCase)) filepathname = "WMR"; - else if (string.Equals(filepathname, "openxr-oculus-compatibility.json", StringComparison.OrdinalIgnoreCase)) + + + else if (string.Equals(filepathname, "Virtual Desktop Streamer\\openxr-oculus-compatibility.json", StringComparison.OrdinalIgnoreCase)) filepathname = "VirtualDesktop Oculus Compatibility"; - else if (string.Equals(filepathname, "XrApiLayer_dlvr.json", StringComparison.OrdinalIgnoreCase)) + else if (string.Equals(filepathname, "DlvrOpenXrLayer\\XrApiLayer_dlvr.json", StringComparison.OrdinalIgnoreCase)) filepathname = "Almalence DigitalLense"; - else if (string.Equals(filepathname, "UltraleapHandTracking.json", StringComparison.OrdinalIgnoreCase)) + else if (string.Equals(filepathname, "OpenXR\\UltraleapHandTracking.json", StringComparison.OrdinalIgnoreCase)) filepathname = "Ultraleap HandTracking"; - else if (string.Equals(filepathname, "XR_APILAYER_MBUCCHIA_toolkit.json", StringComparison.OrdinalIgnoreCase)) + else if (string.Equals(filepathname, "OpenXR-Toolkit\\XR_APILAYER_MBUCCHIA_toolkit.json", StringComparison.OrdinalIgnoreCase)) filepathname = "OpenXR Toolkit"; - else if (string.Equals(filepathname, "openxr-api-layer.json", StringComparison.OrdinalIgnoreCase)) + else if (string.Equals(filepathname, "OpenXR-Quad-Views-Foveated\\openxr-api-layer.json", StringComparison.OrdinalIgnoreCase)) filepathname = "QuadViews DFR"; - else if (string.Equals(filepathname, "XR_APILAYER_NOVENDOR_XRNeckSafer.json", StringComparison.OrdinalIgnoreCase)) + else if (string.Equals(filepathname, "OpenXR-Eye-Trackers\\openxr-api-layer.json", StringComparison.OrdinalIgnoreCase)) + filepathname = "SteamVR Eye Tracking / DFR"; + else if (string.Equals(filepathname, "OpenXrApiLayer\\XR_APILAYER_NOVENDOR_XRNeckSafer.json", StringComparison.OrdinalIgnoreCase)) filepathname = "NeckSafer"; - else if (string.Equals(filepathname, "OpenKneeboard-OpenXR.json", StringComparison.OrdinalIgnoreCase)) + else if (string.Equals(filepathname, "bin\\OpenKneeboard-OpenXR.json", StringComparison.OrdinalIgnoreCase)) filepathname = "OpenKneeBoard"; + + else + { + string[] temp = filename.Split('_', '-'); filepathname = temp[0].ToUpper(); + } // -------------------------------------------------------- diff --git a/OpenXR Switcher.csproj b/OpenXR Switcher.csproj index af23d9d..2bb87ae 100644 --- a/OpenXR Switcher.csproj +++ b/OpenXR Switcher.csproj @@ -12,6 +12,7 @@ app.manifest icon3.png icon3.ico + 1.1 diff --git a/README.md b/README.md index dd120b3..8e12ef9 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,9 @@ Reads the Windows registry which OpenXR runtimes/layers are installed, checks if ## Version History +* 1.1 + * added Refresh button + * added recognized layers * 1.0 * initial release diff --git a/WindowMain.Designer.cs b/WindowMain.Designer.cs index b671270..4c5b9ad 100644 --- a/WindowMain.Designer.cs +++ b/WindowMain.Designer.cs @@ -30,15 +30,41 @@ private void InitializeComponent() { components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WindowMain)); - tableLayoutPanel = new TableLayoutPanel(); - flowRuntimes = new FlowLayoutPanel(); - flowLayers = new FlowLayoutPanel(); toolTipActive = new ToolTip(components); toolTipInactive = new ToolTip(components); toolTipNotFound = new ToolTip(components); + flowRuntimes = new FlowLayoutPanel(); + tableLayoutPanel = new TableLayoutPanel(); + flowLayers = new FlowLayoutPanel(); + buttonRefresh = new Button(); + toolTipRefresh = new ToolTip(components); tableLayoutPanel.SuspendLayout(); SuspendLayout(); // + // toolTipActive + // + toolTipActive.ToolTipIcon = ToolTipIcon.Info; + toolTipActive.ToolTipTitle = "Active"; + // + // toolTipInactive + // + toolTipInactive.ToolTipIcon = ToolTipIcon.Info; + toolTipInactive.ToolTipTitle = "Inactive"; + // + // toolTipNotFound + // + toolTipNotFound.ToolTipIcon = ToolTipIcon.Error; + toolTipNotFound.ToolTipTitle = "Disabled"; + // + // flowRuntimes + // + flowRuntimes.AutoScroll = true; + flowRuntimes.Dock = DockStyle.Fill; + flowRuntimes.Location = new Point(3, 3); + flowRuntimes.Name = "flowRuntimes"; + flowRuntimes.Size = new Size(494, 494); + flowRuntimes.TabIndex = 0; + // // tableLayoutPanel // tableLayoutPanel.AutoSize = true; @@ -53,65 +79,66 @@ private void InitializeComponent() tableLayoutPanel.Name = "tableLayoutPanel"; tableLayoutPanel.RowCount = 1; tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 20F)); - tableLayoutPanel.Size = new Size(984, 511); + tableLayoutPanel.Size = new Size(1000, 500); tableLayoutPanel.TabIndex = 0; // - // flowRuntimes - // - flowRuntimes.AutoScroll = true; - flowRuntimes.Dock = DockStyle.Fill; - flowRuntimes.Location = new Point(3, 3); - flowRuntimes.Name = "flowRuntimes"; - flowRuntimes.Size = new Size(486, 505); - flowRuntimes.TabIndex = 0; - // // flowLayers // flowLayers.AutoScroll = true; flowLayers.Dock = DockStyle.Fill; - flowLayers.Location = new Point(495, 3); + flowLayers.Location = new Point(503, 3); flowLayers.Name = "flowLayers"; - flowLayers.Size = new Size(486, 505); + flowLayers.Size = new Size(494, 494); flowLayers.TabIndex = 1; // - // toolTipActive - // - toolTipActive.ToolTipIcon = ToolTipIcon.Info; - toolTipActive.ToolTipTitle = "Active"; - // - // toolTipInactive - // - toolTipInactive.ToolTipIcon = ToolTipIcon.Info; - toolTipInactive.ToolTipTitle = "Inactive"; + // buttonRefresh // - // toolTipNotFound - // - toolTipNotFound.ToolTipIcon = ToolTipIcon.Error; - toolTipNotFound.ToolTipTitle = "Disabled"; + buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Right; + buttonRefresh.AutoSize = true; + buttonRefresh.AutoSizeMode = AutoSizeMode.GrowAndShrink; + buttonRefresh.BackColor = Color.LightSkyBlue; + buttonRefresh.Cursor = Cursors.Help; + buttonRefresh.FlatAppearance.BorderColor = Color.RoyalBlue; + buttonRefresh.FlatAppearance.MouseDownBackColor = Color.DodgerBlue; + buttonRefresh.FlatStyle = FlatStyle.Flat; + buttonRefresh.Location = new Point(922, 6); + buttonRefresh.Name = "buttonRefresh"; + buttonRefresh.Size = new Size(58, 27); + buttonRefresh.TabIndex = 0; + buttonRefresh.TabStop = false; + buttonRefresh.Text = "Refresh"; + toolTipRefresh.SetToolTip(buttonRefresh, "Reload data from Registry!"); + buttonRefresh.UseVisualStyleBackColor = false; + buttonRefresh.Click += buttonRefresh_Click; // // WindowMain // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(984, 511); + ClientSize = new Size(1000, 500); + Controls.Add(buttonRefresh); Controls.Add(tableLayoutPanel); Icon = (Icon)resources.GetObject("$this.Icon"); MinimumSize = new Size(800, 400); Name = "WindowMain"; Text = "OpenXR Switcher"; Load += WindowMain_Load; + Shown += WindowMain_Shown; + Resize += WindowMain_Resize; tableLayoutPanel.ResumeLayout(false); ResumeLayout(false); PerformLayout(); } #endregion - - private TableLayoutPanel tableLayoutPanel; - public FlowLayoutPanel flowRuntimes; - public FlowLayoutPanel flowLayers; public ToolTip toolTipActive; public ToolTip toolTipInactive; public ToolTip toolTipNotFound; + private FlowLayoutPanel flowButton; + public FlowLayoutPanel flowRuntimes; + private TableLayoutPanel tableLayoutPanel; + public FlowLayoutPanel flowLayers; + private Button buttonRefresh; + public ToolTip toolTipRefresh; } } diff --git a/WindowMain.cs b/WindowMain.cs index 5d19ee6..600dc50 100644 --- a/WindowMain.cs +++ b/WindowMain.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Windows.Forms; +using System.Windows.Forms.VisualStyles; using System.Xml.Linq; namespace OpenXR_Switcher @@ -13,6 +14,24 @@ public WindowMain() InitializeComponent(); } + private void RepositionRefreshButton() + { + int ScrollbarWidth = 17; + int MarginsBordersPadding = 19; + + int PosX = WindowMain.ActiveForm.Width - buttonRefresh.Width - MarginsBordersPadding; + + if (flowLayers.VerticalScroll.Visible) + { + PosX -= ScrollbarWidth; + buttonRefresh.Location = new Point(PosX, 6); + } + else + { + buttonRefresh.Location = new Point(PosX, 6); + } + } + private void WindowMain_Load(object sender, EventArgs e) { Functions.GetRuntimes(); @@ -25,5 +44,26 @@ private void WindowMain_Load(object sender, EventArgs e) Functions.GetAddLayers(); } + + private void buttonRefresh_Click(object sender, EventArgs e) + { + flowRuntimes.Controls.Clear(); + flowLayers.Controls.Clear(); + + WindowMain_Load(sender, e); + + RepositionRefreshButton(); + } + + private void WindowMain_Resize(object sender, EventArgs e) + { + RepositionRefreshButton(); + } + + + private void WindowMain_Shown(object sender, EventArgs e) + { + RepositionRefreshButton(); + } } } diff --git a/WindowMain.resx b/WindowMain.resx index e6f3849..bff695a 100644 --- a/WindowMain.resx +++ b/WindowMain.resx @@ -126,6 +126,9 @@ 273, 17 + + 418, 17 + From 60d8542487bcb84d2f4a421385dc3a69d30be871 Mon Sep 17 00:00:00 2001 From: ytdlder Date: Thu, 8 Aug 2024 09:02:25 +0200 Subject: [PATCH 3/3] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3126578..ed5bbdd 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,8 @@ Reads the Windows registry which OpenXR runtimes/layers are installed, checks if ### Dependencies * Windows 7, 10, 11 -* .NET 6.0 Runtime *(if not using the rather big single EXE)* +* for whatever reasons, Visual Studio no longer creates a stand-alone, all-in-one EXE, so the .Net Runtime **has to be installed** +* .NET 6.0 Runtime * [Microsoft Runtime Download](https://dotnet.microsoft.com/en-us/download/dotnet/6.0) * under **.NET Desktop Runtime 6.x.x**, next to **Windows**, click on your arch type (x86, x64) to download the newest runtime * __Direct Link__: [Latest x64 Runtime](https://aka.ms/dotnet/6.0/windowsdesktop-runtime-win-x64.exe)