Add Outlook folder browser and user settings
- Replace Outlook folder ComboBox with TextBox + Browse button that opens a TreeView-based folder browser dialog - Add per-user settings stored in %AppData% (not HKLM) with option to start minimized (System Tray only) - Add Settings button to main window - Settings are per-user, independent of profiles Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace StarfaceOutlookSync.Models
|
||||
{
|
||||
public class UserSettings
|
||||
{
|
||||
public bool StartMinimized { get; set; } = false;
|
||||
|
||||
private static readonly string SettingsFile = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
||||
"StarfaceOutlookSync", "settings.json");
|
||||
|
||||
public static UserSettings Load()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (File.Exists(SettingsFile))
|
||||
return JsonConvert.DeserializeObject<UserSettings>(File.ReadAllText(SettingsFile))
|
||||
?? new UserSettings();
|
||||
}
|
||||
catch { }
|
||||
return new UserSettings();
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(SettingsFile));
|
||||
File.WriteAllText(SettingsFile, JsonConvert.SerializeObject(this, Formatting.Indented));
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user