refactor: cleaup and implemented mvvm

This commit is contained in:
tux
2025-07-05 06:18:00 +05:30
parent 896b2a9f40
commit 7ffdfea18f
13 changed files with 249 additions and 210 deletions

View File

@@ -9,20 +9,11 @@ public partial class SettingsUserControl : UserControl
public SettingsUserControl()
{
InitializeComponent();
ModelTextBox.Text = InMemoryDb.Obj.SettingsManager.Settings.Model;
ApiUrlTextBox.Text = InMemoryDb.Obj.SettingsManager.Settings.ApiURL;
ApiKeyTextBox.Text = InMemoryDb.Obj.SettingsManager.Settings.ApiKey;
ScreenshotPromptTextBox.Text = InMemoryDb.Obj.SettingsManager.Settings.ScreenshotPrompt;
AudioPromptTextbox.Text = InMemoryDb.Obj.SettingsManager.Settings.AudioPrompt;
DataContext = InMemoryDb.Obj.SettingsViewModel;
}
private void SaveSettingsBtn_OnClick(object? sender, RoutedEventArgs e)
{
InMemoryDb.Obj.SaveSettings(new AppSettings()
{
ApiKey = ApiKeyTextBox.Text, ApiURL = ApiUrlTextBox.Text, Model = ModelTextBox.Text,
ScreenshotPrompt = ScreenshotPromptTextBox.Text, AudioPrompt = AudioPromptTextbox.Text
});
InMemoryDb.Obj.SaveSettings();
}
}