Skip to content

Commit e9eb3ab

Browse files
committed
Merge branch 'dev'
2 parents 4ace479 + 1017721 commit e9eb3ab

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<GlobalVersionYear>$([System.DateTime]::Now.ToString("yyyy"))</GlobalVersionYear>
44
<GlobalVersionMonthDay>$([System.DateTime]::Now.ToString("Mdd"))</GlobalVersionMonthDay>
5-
<GlobalBuild>2</GlobalBuild>
5+
<GlobalBuild>3</GlobalBuild>
66
<GlobalVersion>$(GlobalVersionYear).$(GlobalVersionMonthDay).$(GlobalBuild).0</GlobalVersion>
77
</PropertyGroup>
88
</Project>

VRCOSC.App/SDK/Modules/Module.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public abstract class Module
8282
private SerialisationManager moduleSerialisationManager = null!;
8383
private SerialisationManager persistenceSerialisationManager = null!;
8484

85-
internal IManagedWindow? SettingsWindow { get; private set; }
85+
internal Type? SettingsWindowType { get; private set; }
8686
internal Type? RuntimeViewType { get; private set; }
8787

8888
private bool isLoaded;
@@ -163,9 +163,7 @@ private void setSettingsWindow()
163163
if (!windowType.IsAssignableTo(typeof(IManagedWindow))) throw new Exception("Cannot set settings window that doesn't extend IManagedWindow");
164164
if (!windowType.HasConstructorThatAccepts(GetType())) throw new Exception($"Cannot set settings window that doesn't have a constructor that accepts type {GetType().Name}");
165165

166-
var window = (Window)Activator.CreateInstance(windowType, this)!;
167-
window.Closing += (_, _) => Serialise();
168-
SettingsWindow = (IManagedWindow)window;
166+
SettingsWindowType = windowType;
169167
}
170168

171169
#endregion

VRCOSC.App/UI/Views/Modules/ModulesView.xaml.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) VolcanicArts. Licensed under the GPL-3.0 License.
22
// See the LICENSE file in the repository root for full license text.
33

4+
using System;
45
using System.Windows;
56
using VRCOSC.App.Modules;
67
using VRCOSC.App.Profiles;
@@ -64,7 +65,16 @@ private void SettingsButton_OnClick(object sender, RoutedEventArgs e)
6465
var element = (FrameworkElement)sender;
6566
var module = (Module)element.Tag;
6667

67-
settingsWindowManager.TrySpawnChild(module.SettingsWindow ?? new ModuleSettingsWindow(module));
68+
if (module.SettingsWindowType is not null)
69+
{
70+
var window = (Window)Activator.CreateInstance(module.SettingsWindowType, module)!;
71+
window.Closing += (_, _) => module.Serialise();
72+
settingsWindowManager.TrySpawnChild((IManagedWindow)window);
73+
}
74+
else
75+
{
76+
settingsWindowManager.TrySpawnChild(new ModuleSettingsWindow(module));
77+
}
6878
}
6979

7080
private void InfoButton_OnClick(object sender, RoutedEventArgs e)

0 commit comments

Comments
 (0)