save window position and left and right panel size

This commit is contained in:
Oleksandr Bezdieniezhnykh
2024-07-23 14:58:35 +03:00
parent d130e6fdcf
commit c72f7fc265
5 changed files with 49 additions and 37 deletions
+11 -13
View File
@@ -18,11 +18,16 @@ public class Config
public List<AnnotationClass> AnnotationClasses { get; set; } = [];
private Dictionary<int, AnnotationClass>? _annotationClassesDict;
public Dictionary<int, AnnotationClass> AnnotationClassesDict => _annotationClassesDict ??= AnnotationClasses.ToDictionary(x => x.Id);
public Dictionary<int, AnnotationClass> AnnotationClassesDict => _annotationClassesDict ??= AnnotationClasses.ToDictionary(x => x.Id);
public Size WindowSize { get; set; }
public Point WindowLocation { get; set; }
public bool ShowHelpOnStart { get; set; }
public Size WindowSize { get; set; }
public Point WindowLocation { get; set; }
public bool FullScreen { get; set; }
public double LeftPanelWidth { get; set; }
public double RightPanelWidth { get; set; }
public bool ShowHelpOnStart { get; set; }
}
public interface IConfigRepository
@@ -63,15 +68,8 @@ public class FileConfigRepository(ILogger<FileConfigRepository> logger) : IConfi
ShowHelpOnStart = true
};
}
try
{
var str = File.ReadAllText(CONFIG_PATH);
return JsonConvert.DeserializeObject<Config>(str) ?? new Config();
}
catch (Exception)
{
return new Config();
}
var str = File.ReadAllText(CONFIG_PATH);
return JsonConvert.DeserializeObject<Config>(str) ?? new Config();
}
public void Save(Config config)