From 5b640280f2762c294d5bb556296c59c3f805b6b3 Mon Sep 17 00:00:00 2001 From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com> Date: Wed, 27 Dec 2023 21:57:41 +0100 Subject: [PATCH] Fix log messages --- src/DesktopMagic/App.xaml.cs | 8 +- .../DataContexts/MainWindowDataContext.cs | 11 + src/DesktopMagic/MainWindow.xaml | 219 +++++++++--------- src/DesktopMagic/MainWindow.xaml.cs | 15 +- src/DesktopMagic/Plugins/PluginWindow.xaml.cs | 2 +- 5 files changed, 136 insertions(+), 119 deletions(-) diff --git a/src/DesktopMagic/App.xaml.cs b/src/DesktopMagic/App.xaml.cs index 3c9fe73..66044cb 100644 --- a/src/DesktopMagic/App.xaml.cs +++ b/src/DesktopMagic/App.xaml.cs @@ -23,10 +23,10 @@ public partial class App : Application #else private readonly Updater updater = new Updater(TimeSpan.FromDays(1), "https://raw.githubusercontent.com/Stone-Red-Code/DesktopMagic/main/update/updateInfo.json"); #endif - private Thread? eventThread; - private EventWaitHandle eventWaitHandle; + private readonly Thread? eventThread; + private readonly EventWaitHandle eventWaitHandle; - private Logger logger = new Logger(); + private readonly Logger logger = new Logger(); public static string ApplicationDataPath { get; } = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "StoneRed", AppName); public static Logger Logger @@ -42,7 +42,7 @@ public partial class App : Application public App() { - logFilePath = ApplicationDataPath + "\\Log.log"; + logFilePath = ApplicationDataPath + "\\log.log"; // Setup global event handler eventWaitHandle = new EventWaitHandle(false, EventResetMode.AutoReset, AppGuid, out bool createdNew); diff --git a/src/DesktopMagic/DataContexts/MainWindowDataContext.cs b/src/DesktopMagic/DataContexts/MainWindowDataContext.cs index 8cb37c0..725f55f 100644 --- a/src/DesktopMagic/DataContexts/MainWindowDataContext.cs +++ b/src/DesktopMagic/DataContexts/MainWindowDataContext.cs @@ -10,6 +10,7 @@ internal class MainWindowDataContext : INotifyPropertyChanged public event PropertyChangedEventHandler? PropertyChanged; private static DesktopMagicSettings settings = new(); + private bool isLoading = true; public DesktopMagicSettings Settings { @@ -21,6 +22,16 @@ internal class MainWindowDataContext : INotifyPropertyChanged } } + public bool IsLoading + { + get => isLoading; + set + { + isLoading = value; + OnPropertyChanged(); + } + } + public static DesktopMagicSettings GetSettings() { return settings; diff --git a/src/DesktopMagic/MainWindow.xaml b/src/DesktopMagic/MainWindow.xaml index a619453..271e2ea 100644 --- a/src/DesktopMagic/MainWindow.xaml +++ b/src/DesktopMagic/MainWindow.xaml @@ -2,6 +2,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:busyIndicator="https://github.com/moh3ngolshani/BusyIndicator" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" @@ -22,129 +23,131 @@ StateChanged="Window_StateChanged" Loaded="Window_Loaded"> - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - - - + - - + + - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - -