diff --git a/App.config b/App.config
new file mode 100644
index 0000000..f66c5bc
--- /dev/null
+++ b/App.config
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+ 800, 600
+
+
+
+
\ No newline at end of file
diff --git a/Functions.cs b/Functions.cs
index c17a493..6a3dae9 100644
--- a/Functions.cs
+++ b/Functions.cs
@@ -315,7 +315,7 @@ private static void AddPanel(FlowLayoutPanel layoutpanel, string filepath, strin
filepathname = "NeckSafer";
else if (string.Equals(filepathname, "bin\\OpenKneeboard-OpenXR.json", StringComparison.OrdinalIgnoreCase))
filepathname = "OpenKneeBoard";
-
+
else
{
string[] temp = filename.Split('_', '-');
@@ -364,13 +364,17 @@ private static void AddPanel(FlowLayoutPanel layoutpanel, string filepath, strin
// Check filepathname with user set name
string originalname = filepathname;
- for (int i = 0; i < (allusersetnames.Length / 2); i++) // durch 2, weil zweidimensionales Array und Length alle Felder zählt!
+ // Are there any user-saved names?
+ if (allusersetnames != null)
{
- if (filepathname == allusersetnames[i, 0])
+ for (int i = 0; i < (allusersetnames.Length / 2); i++) // durch 2, weil zweidimensionales Array und Length alle Felder zählt!
{
- originalname = allusersetnames[i, 0];
- filepathname = allusersetnames[i, 1];
- break;
+ if (filepathname == allusersetnames[i, 0])
+ {
+ originalname = allusersetnames[i, 0];
+ filepathname = allusersetnames[i, 1];
+ break;
+ }
}
}
diff --git a/OpenXR Switcher.csproj b/OpenXR Switcher.csproj
index 59734d7..7432f53 100644
--- a/OpenXR Switcher.csproj
+++ b/OpenXR Switcher.csproj
@@ -12,7 +12,7 @@
app.manifest
icon3.png
icon3.ico
- 1.2.1
+ 1.2.2
x64
OpenXR-Switcher
@@ -44,6 +44,11 @@
True
Resources.resx
+
+ True
+ True
+ Settings.settings
+
@@ -53,4 +58,11 @@
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
\ No newline at end of file
diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..c78adbc
--- /dev/null
+++ b/Properties/Settings.Designer.cs
@@ -0,0 +1,38 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace OpenXR_Switcher.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.12.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("800, 600")]
+ public global::System.Drawing.Size WindowSize {
+ get {
+ return ((global::System.Drawing.Size)(this["WindowSize"]));
+ }
+ set {
+ this["WindowSize"] = value;
+ }
+ }
+ }
+}
diff --git a/Properties/Settings.settings b/Properties/Settings.settings
new file mode 100644
index 0000000..4780a45
--- /dev/null
+++ b/Properties/Settings.settings
@@ -0,0 +1,9 @@
+
+
+
+
+
+ 800, 600
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 194cfa6..6ed524b 100644
--- a/README.md
+++ b/README.md
@@ -58,6 +58,9 @@ Reads the Windows registry which OpenXR runtimes/layers are installed, checks if
## Version History
+* 1.2.2
+ * fixed bug, when no custom name has been set yet
+ * added: open with last window size
* 1.2.1
* add version information to the title
* 1.2
diff --git a/WindowMain.Designer.cs b/WindowMain.Designer.cs
index 0df32c7..7a26976 100644
--- a/WindowMain.Designer.cs
+++ b/WindowMain.Designer.cs
@@ -34,20 +34,20 @@ private void InitializeComponent()
toolTipInactive = new ToolTip(components);
toolTipNotFound = new ToolTip(components);
toolTipRefresh = new ToolTip(components);
+ buttonRefresh = new Button();
toolTipEdit = new ToolTip(components);
toolTipReset = new ToolTip(components);
+ buttonReset = new Button();
tableLayoutPanel = new TableLayoutPanel();
- tableLayoutPanel.SuspendLayout();
flowRuntimes = new FlowLayoutPanel();
flowLayers = new FlowLayoutPanel();
- buttonRefresh = new Button();
panelEdit = new Panel();
- panelEdit.SuspendLayout();
- labelEdit = new System.Windows.Forms.Label();
- buttonReset = new Button();
+ labelEdit = new Label();
maskedTextBox = new MaskedTextBox();
- buttonSave = new Button();
buttonCancel = new Button();
+ buttonSave = new Button();
+ tableLayoutPanel.SuspendLayout();
+ panelEdit.SuspendLayout();
SuspendLayout();
//
// toolTipActive
@@ -65,14 +65,36 @@ private void InitializeComponent()
toolTipNotFound.ToolTipIcon = ToolTipIcon.Error;
toolTipNotFound.ToolTipTitle = "Disabled";
//
- // flowRuntimes
+ // buttonRefresh
//
- 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;
+ 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;
+ //
+ // buttonReset
+ //
+ buttonReset.Location = new Point(343, 3);
+ buttonReset.Name = "buttonReset";
+ buttonReset.Size = new Size(60, 23);
+ buttonReset.TabIndex = 1003;
+ buttonReset.Text = "Reset";
+ toolTipReset.SetToolTip(buttonReset, "Change the display name back to its default");
+ buttonReset.UseVisualStyleBackColor = true;
+ buttonReset.Click += evtbuttonReset_Click;
//
// tableLayoutPanel
//
@@ -91,6 +113,15 @@ private void InitializeComponent()
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(494, 494);
+ flowRuntimes.TabIndex = 0;
+ //
// flowLayers
//
flowLayers.AutoScroll = true;
@@ -100,26 +131,6 @@ private void InitializeComponent()
flowLayers.Size = new Size(494, 494);
flowLayers.TabIndex = 1;
//
- // buttonRefresh
- //
- 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;
- //
// panelEdit
//
panelEdit.AutoSize = true;
@@ -136,6 +147,7 @@ private void InitializeComponent()
panelEdit.Name = "panelEdit";
panelEdit.Padding = new Padding(5, 5, 2, 2);
panelEdit.Size = new Size(444, 63);
+ panelEdit.TabIndex = 1;
panelEdit.Visible = false;
//
// labelEdit
@@ -143,47 +155,26 @@ private void InitializeComponent()
labelEdit.Dock = DockStyle.Top;
labelEdit.Enabled = false;
labelEdit.FlatStyle = FlatStyle.Flat;
- labelEdit.Font = new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point, 0);
+ labelEdit.Font = new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
labelEdit.ForeColor = Color.White;
labelEdit.Location = new Point(5, 5);
labelEdit.Margin = new Padding(0);
labelEdit.Name = "labelEdit";
labelEdit.Size = new Size(435, 23);
+ labelEdit.TabIndex = 0;
labelEdit.Text = "Enter a new custom name:";
//
- // buttonReset
- //
- buttonReset.Location = new Point(343, 3);
- buttonReset.Name = "buttonReset";
- buttonReset.Size = new Size(60, 23);
- buttonReset.TabIndex = 1003;
- buttonReset.Text = "Reset";
- buttonReset.UseVisualStyleBackColor = true;
- toolTipReset.SetToolTip(buttonReset, "Change the display name back to its default");
- buttonReset.BringToFront();
- buttonReset.Click += evtbuttonReset_Click;
- //
// maskedTextBox
//
maskedTextBox.Anchor = AnchorStyles.Left;
maskedTextBox.AsciiOnly = true;
- maskedTextBox.Font = new Font("Segoe UI", 11.25F, FontStyle.Regular, GraphicsUnit.Point, 0);
+ maskedTextBox.Font = new Font("Segoe UI", 11.25F, FontStyle.Regular, GraphicsUnit.Point);
maskedTextBox.HidePromptOnLeave = true;
maskedTextBox.Location = new Point(5, 29);
maskedTextBox.Name = "maskedTextBox";
maskedTextBox.Size = new Size(300, 27);
maskedTextBox.TabIndex = 1000;
- maskedTextBox.KeyDown += new KeyEventHandler(maskedTextBox_KeyDown);
- //
- // buttonSave
- //
- buttonSave.Location = new Point(311, 29);
- buttonSave.Name = "buttonSave";
- buttonSave.Size = new Size(60, 27);
- buttonSave.TabIndex = 1001;
- buttonSave.Text = "Save";
- buttonSave.UseVisualStyleBackColor = true;
- buttonSave.Click += evtbuttonSave_Click;
+ maskedTextBox.KeyDown += maskedTextBox_KeyDown;
//
// buttonCancel
//
@@ -195,6 +186,16 @@ private void InitializeComponent()
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += evtbuttonCancel_Click;
//
+ // buttonSave
+ //
+ buttonSave.Location = new Point(311, 29);
+ buttonSave.Name = "buttonSave";
+ buttonSave.Size = new Size(60, 27);
+ buttonSave.TabIndex = 1001;
+ buttonSave.Text = "Save";
+ buttonSave.UseVisualStyleBackColor = true;
+ buttonSave.Click += evtbuttonSave_Click;
+ //
// WindowMain
//
AutoScaleDimensions = new SizeF(7F, 15F);
@@ -207,6 +208,7 @@ private void InitializeComponent()
MinimumSize = new Size(800, 400);
Name = "WindowMain";
Text = "OpenXR Switcher";
+ FormClosing += WindowMain_Closing;
Load += WindowMain_Load;
Shown += WindowMain_Shown;
Resize += WindowMain_Resize;
diff --git a/WindowMain.cs b/WindowMain.cs
index cb1fe15..fd3bbff 100644
--- a/WindowMain.cs
+++ b/WindowMain.cs
@@ -1,4 +1,5 @@
using Microsoft.Win32;
+using OpenXR_Switcher.Properties;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
@@ -13,10 +14,43 @@ public partial class WindowMain : Form
public WindowMain()
{
InitializeComponent();
+ }
+ private void WindowMain_Load(object sender, EventArgs e)
+ {
// display version in the title
Version version = Assembly.GetExecutingAssembly().GetName().Version;
Text = Text + " (v" + version.Major + "." + version.Minor + "." + version.Build + ")";
+
+ // set previous window size
+ if (Settings.Default.WindowSize != null && Settings.Default.WindowSize.Width >= 400 && Settings.Default.WindowSize.Height >= 400)
+ {
+ this.Size = Settings.Default.WindowSize;
+ }
+
+ Functions.GetRuntimes();
+
+ Functions.GetActiveRuntime();
+
+ Functions.CheckArguments();
+
+ Functions.AddRuntimes();
+
+ Functions.GetAddLayers();
+ }
+
+ private void WindowMain_Closing(object sender, FormClosingEventArgs e)
+ {
+ if (this.WindowState == FormWindowState.Normal)
+ {
+ Settings.Default.WindowSize = this.Size;
+ }
+ else
+ {
+ Settings.Default.WindowSize = this.RestoreBounds.Size;
+ }
+
+ Settings.Default.Save();
}
private void RepositionRefreshButton()
@@ -24,7 +58,7 @@ private void RepositionRefreshButton()
int ScrollbarWidth = 17;
int MarginsBordersPadding = 19;
- int PosX = WindowMain.ActiveForm.Width - buttonRefresh.Width - MarginsBordersPadding;
+ int PosX = this.Width - buttonRefresh.Width - MarginsBordersPadding;
if (flowLayers.VerticalScroll.Visible)
{
@@ -37,19 +71,6 @@ private void RepositionRefreshButton()
}
}
- private void WindowMain_Load(object sender, EventArgs e)
- {
- Functions.GetRuntimes();
-
- Functions.GetActiveRuntime();
-
- Functions.CheckArguments();
-
- Functions.AddRuntimes();
-
- Functions.GetAddLayers();
- }
-
private void buttonRefresh_Click(object sender, EventArgs e)
{
flowRuntimes.Controls.Clear();
@@ -87,14 +108,14 @@ private void evtbuttonCancel_Click(object sender, EventArgs e)
private void evtbuttonSave_Click(object sender, EventArgs e)
{
- if(!Functions.WriteToReg("HKCU", Functions.reg_usersetnames, Functions.saved_name, maskedTextBox.Text, RegistryValueKind.String))
+ if (!Functions.WriteToReg("HKCU", Functions.reg_usersetnames, Functions.saved_name, maskedTextBox.Text, RegistryValueKind.String))
MessageBox.Show("Couldn't write to registry!", "ERROR", MessageBoxButtons.OK);
ResetOverlay();
buttonRefresh.PerformClick();
}
-
+
private void evtbuttonReset_Click(object sender, EventArgs e)
{
if (!Functions.WriteToReg("HKCU", Functions.reg_usersetnames, "#DELETE#", Functions.saved_name, RegistryValueKind.String))
diff --git a/WindowMain.resx b/WindowMain.resx
index bff695a..367c41a 100644
--- a/WindowMain.resx
+++ b/WindowMain.resx
@@ -1,7 +1,7 @@