From 0eb9428531ccf1d4b422c8b062aeb20f9092618a Mon Sep 17 00:00:00 2001 From: gosha20777 Date: Tue, 5 May 2020 16:13:12 +0300 Subject: [PATCH] fix: config path and window size --- src/LacmusApp.csproj | 2 +- src/Models/AppConfig.cs | 2 +- src/Program.cs | 4 +++- src/ViewModels/FourthWizardViewModel.cs | 3 +++ src/ViewModels/ThirdWizardViewModel.cs | 4 ++-- src/Views/ModelManagerWindow.xaml | 9 ++++----- src/Views/SettingsWindow.xaml | 7 +++---- 7 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/LacmusApp.csproj b/src/LacmusApp.csproj index 3d1ec6f..cb8918f 100644 --- a/src/LacmusApp.csproj +++ b/src/LacmusApp.csproj @@ -24,7 +24,7 @@ - + diff --git a/src/Models/AppConfig.cs b/src/Models/AppConfig.cs index e4589db..46da853 100644 --- a/src/Models/AppConfig.cs +++ b/src/Models/AppConfig.cs @@ -82,7 +82,7 @@ public async Task Save(string path) public async Task Save() { - var confDir = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); + var confDir = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "lacmus"); var configPath = Path.Join(confDir,"appConfig.json"); await Save(configPath); } diff --git a/src/Program.cs b/src/Program.cs index 1e4abcf..160481f 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using System.Runtime.InteropServices; using Avalonia; using Avalonia.Logging.Serilog; @@ -21,10 +22,11 @@ private static void Main(string[] args) Console.WriteLine("This is free software, and you are welcome to redistribute it under GNU GPL license;\nClick `help` -> `about' for details."); Console.WriteLine("------------------------------------"); + var logPath = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "lacmus", "log.log"); Log.Logger = new LoggerConfiguration() .MinimumLevel.Debug() .WriteTo.Console() - .WriteTo.File("log.txt", + .WriteTo.File(logPath, rollingInterval: RollingInterval.Day, rollOnFileSizeLimit: true) .CreateLogger(); diff --git a/src/ViewModels/FourthWizardViewModel.cs b/src/ViewModels/FourthWizardViewModel.cs index e4b3257..5db09f5 100644 --- a/src/ViewModels/FourthWizardViewModel.cs +++ b/src/ViewModels/FourthWizardViewModel.cs @@ -122,6 +122,9 @@ public async Task PredictAll() { Status = "starting ml model..."; //load config + var confDir = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "lacmus"); + var configPath = Path.Join(confDir,"appConfig.json"); + _appConfig = await AppConfig.Create(configPath); var config = _appConfig.MlModelConfig; using (var model = new MLModel(config)) { diff --git a/src/ViewModels/ThirdWizardViewModel.cs b/src/ViewModels/ThirdWizardViewModel.cs index 1dbb0f1..7a70fcf 100644 --- a/src/ViewModels/ThirdWizardViewModel.cs +++ b/src/ViewModels/ThirdWizardViewModel.cs @@ -54,8 +54,8 @@ public async void UpdateModelStatus() { Log.Information("Loading ml model."); Status = "Loading ml model..."; - var confDir = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); - var configPath = Path.Join(confDir, "lacmus", "appConfig.json"); + var confDir = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "lacmus"); + var configPath = Path.Join(confDir,"appConfig.json"); _appConfig = await AppConfig.Create(configPath); var config = _appConfig.MlModelConfig;; // get local versions diff --git a/src/Views/ModelManagerWindow.xaml b/src/Views/ModelManagerWindow.xaml index a038869..8bbfad1 100644 --- a/src/Views/ModelManagerWindow.xaml +++ b/src/Views/ModelManagerWindow.xaml @@ -2,14 +2,13 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:cp="clr-namespace:ThemeEditor.Controls.ColorPicker;assembly=ThemeEditor.Controls.ColorPicker" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" - x:Class="LacmusApp.Views.ModelManagerWindow" - SizeToContent="WidthAndHeight" + x:Class="LacmusApp.Views.ModelManagerWindow" Icon="resm:LacmusApp.Assets.avalonia-logo.ico" CanResize="True" - Width = "400" - Height = "350" Title="Models Manager"> + Width = "550" + Height = "450" + Title="Models Manager">