34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
using Inspectron.Settings;
|
|
using Inspectron.Settings.Windows.Configuration;
|
|
using VisionBuilder.UI.Common;
|
|
using VisionBuilder.UI.Common.ViewModel.Interfaces.UI;
|
|
|
|
namespace VisionBuilder.UI.Windows.Settings;
|
|
|
|
public class WindowsSettingsService: ISettingsService
|
|
{
|
|
private readonly UIConfiguration _uiConfiguration;
|
|
private readonly InspectronSettings _settings;
|
|
|
|
public WindowsSettingsService(UIConfiguration uiConfiguration, InspectronSettings settings)
|
|
{
|
|
_uiConfiguration = uiConfiguration ?? throw new ArgumentNullException(nameof(uiConfiguration));
|
|
_settings = settings ?? throw new ArgumentNullException(nameof(settings));
|
|
|
|
}
|
|
|
|
public void ShowSettingsDialog()
|
|
{
|
|
Thread th = new Thread(() =>
|
|
{
|
|
OptionsWindow window = new OptionsWindow(new DefaultControlFactory());
|
|
window.LoadFromSettings(_settings);
|
|
if (window.ShowDialog()==DialogResult.OK)
|
|
{
|
|
_settings.SaveSettings();
|
|
}
|
|
});
|
|
th.SetApartmentState(ApartmentState.STA);
|
|
th.Start();
|
|
}
|
|
} |