mirror of
https://github.com/Stone-Red-Code/DesktopMagic.git
synced 2026-09-09 07:46:15 +02:00
Fix log messages
This commit is contained in:
@@ -23,10 +23,10 @@ public partial class App : Application
|
|||||||
#else
|
#else
|
||||||
private readonly Updater updater = new Updater(TimeSpan.FromDays(1), "https://raw.githubusercontent.com/Stone-Red-Code/DesktopMagic/main/update/updateInfo.json");
|
private readonly Updater updater = new Updater(TimeSpan.FromDays(1), "https://raw.githubusercontent.com/Stone-Red-Code/DesktopMagic/main/update/updateInfo.json");
|
||||||
#endif
|
#endif
|
||||||
private Thread? eventThread;
|
private readonly Thread? eventThread;
|
||||||
private EventWaitHandle eventWaitHandle;
|
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 string ApplicationDataPath { get; } = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "StoneRed", AppName);
|
||||||
|
|
||||||
public static Logger Logger
|
public static Logger Logger
|
||||||
@@ -42,7 +42,7 @@ public partial class App : Application
|
|||||||
|
|
||||||
public App()
|
public App()
|
||||||
{
|
{
|
||||||
logFilePath = ApplicationDataPath + "\\Log.log";
|
logFilePath = ApplicationDataPath + "\\log.log";
|
||||||
|
|
||||||
// Setup global event handler
|
// Setup global event handler
|
||||||
eventWaitHandle = new EventWaitHandle(false, EventResetMode.AutoReset, AppGuid, out bool createdNew);
|
eventWaitHandle = new EventWaitHandle(false, EventResetMode.AutoReset, AppGuid, out bool createdNew);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ internal class MainWindowDataContext : INotifyPropertyChanged
|
|||||||
public event PropertyChangedEventHandler? PropertyChanged;
|
public event PropertyChangedEventHandler? PropertyChanged;
|
||||||
|
|
||||||
private static DesktopMagicSettings settings = new();
|
private static DesktopMagicSettings settings = new();
|
||||||
|
private bool isLoading = true;
|
||||||
|
|
||||||
public DesktopMagicSettings Settings
|
public DesktopMagicSettings Settings
|
||||||
{
|
{
|
||||||
@@ -21,6 +22,16 @@ internal class MainWindowDataContext : INotifyPropertyChanged
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsLoading
|
||||||
|
{
|
||||||
|
get => isLoading;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
isLoading = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static DesktopMagicSettings GetSettings()
|
public static DesktopMagicSettings GetSettings()
|
||||||
{
|
{
|
||||||
return settings;
|
return settings;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
|
xmlns:busyIndicator="https://github.com/moh3ngolshani/BusyIndicator"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
@@ -22,7 +23,8 @@
|
|||||||
StateChanged="Window_StateChanged"
|
StateChanged="Window_StateChanged"
|
||||||
Loaded="Window_Loaded">
|
Loaded="Window_Loaded">
|
||||||
|
|
||||||
<Grid x:Name="grid">
|
<busyIndicator:BusyMask x:Name="BusyIndicator" IsBusy="{Binding IsLoading}" IndicatorType="Cogs" BusyContent="Please wait..." BusyContentMargin="0,20,0,0" IsBusyAtStartup="False">
|
||||||
|
<Grid>
|
||||||
<TextBlock TextWrapping="Wrap" Text="0" VerticalAlignment="Top" FontFamily="Comic Sans MS" Loaded="TextBlock_Loaded" Foreground="Transparent" />
|
<TextBlock TextWrapping="Wrap" Text="0" VerticalAlignment="Top" FontFamily="Comic Sans MS" Loaded="TextBlock_Loaded" Foreground="Transparent" />
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
@@ -137,7 +139,7 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Grid.Column="1" Margin="{StaticResource DefaultMargin}" VerticalAlignment="Bottom">
|
<StackPanel Grid.Column="1" Margin="{StaticResource DefaultMargin}" VerticalAlignment="Bottom">
|
||||||
<Button x:Name="updatePluginsButton" Content="{DynamicResource updatePlugins}" Margin="0,0,0,5" HorizontalAlignment="Center" Width="170" Click="UpdatePluginsButton_Click" FontWeight="Regular" />
|
<Button x:Name="updatePluginsButton" Content="{DynamicResource updatePlugins}" Margin="0,0,0,5" HorizontalAlignment="Center" Width="170" Click="UpdatePluginsButton_Click" FontWeight="Regular" />
|
||||||
<Button x:Name="githubButton" Content="GitHub" HorizontalAlignment="Center" Width="170" Click="GithubButton_Click" FontWeight="Regular" Cursor="Hand" />
|
<Button x:Name="githubButton" Content="GitHub" HorizontalAlignment="Center" Width="170" Click="GitHubButton_Click" FontWeight="Regular" Cursor="Hand" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Grid.Column="2" Margin="{StaticResource DefaultMargin}" VerticalAlignment="Bottom">
|
<StackPanel Grid.Column="2" Margin="{StaticResource DefaultMargin}" VerticalAlignment="Bottom">
|
||||||
<Button x:Name="downloadPluginsButton" Content="{DynamicResource pluginManager}" Margin="0,0,0,5" HorizontalAlignment="Right" Width="170" Click="PluginManagerButton_Click" FontWeight="Regular" Cursor="Hand" />
|
<Button x:Name="downloadPluginsButton" Content="{DynamicResource pluginManager}" Margin="0,0,0,5" HorizontalAlignment="Right" Width="170" Click="PluginManagerButton_Click" FontWeight="Regular" Cursor="Hand" />
|
||||||
@@ -147,4 +149,5 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
</busyIndicator:BusyMask>
|
||||||
</Window>
|
</Window>
|
||||||
@@ -111,6 +111,7 @@ namespace DesktopMagic
|
|||||||
|
|
||||||
private void LoadPlugins()
|
private void LoadPlugins()
|
||||||
{
|
{
|
||||||
|
mainWindowDataContext.IsLoading = true;
|
||||||
plugins.Clear();
|
plugins.Clear();
|
||||||
|
|
||||||
foreach (var buildInPlugin in builtInPlugins.Keys)
|
foreach (var buildInPlugin in builtInPlugins.Keys)
|
||||||
@@ -153,6 +154,7 @@ namespace DesktopMagic
|
|||||||
|
|
||||||
plugins.Add(pluginMetadata.Id, new(pluginMetadata, directory));
|
plugins.Add(pluginMetadata.Id, new(pluginMetadata, directory));
|
||||||
}
|
}
|
||||||
|
mainWindowDataContext.IsLoading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Load
|
#endregion Load
|
||||||
@@ -194,7 +196,6 @@ namespace DesktopMagic
|
|||||||
|
|
||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
{
|
{
|
||||||
//Not sure how to handle this
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
blockWindowsClosing = false;
|
blockWindowsClosing = false;
|
||||||
@@ -428,8 +429,8 @@ namespace DesktopMagic
|
|||||||
|
|
||||||
private void CornerRadiusTextBox_TextChanged(object? sender, TextChangedEventArgs? e)
|
private void CornerRadiusTextBox_TextChanged(object? sender, TextChangedEventArgs? e)
|
||||||
{
|
{
|
||||||
bool sucess = int.TryParse(cornerRadiusTextBox.Text, out int cornerRadius);
|
bool success = int.TryParse(cornerRadiusTextBox.Text, out int cornerRadius);
|
||||||
if (sucess)
|
if (success)
|
||||||
{
|
{
|
||||||
cornerRadiusTextBox.Foreground = Brushes.Black;
|
cornerRadiusTextBox.Foreground = Brushes.Black;
|
||||||
Settings.CurrentLayout.Theme.CornerRadius = cornerRadius;
|
Settings.CurrentLayout.Theme.CornerRadius = cornerRadius;
|
||||||
@@ -442,8 +443,8 @@ namespace DesktopMagic
|
|||||||
|
|
||||||
private void MarginTextBox_TextChanged(object? sender, TextChangedEventArgs? e)
|
private void MarginTextBox_TextChanged(object? sender, TextChangedEventArgs? e)
|
||||||
{
|
{
|
||||||
bool sucess = int.TryParse(marginTextBox.Text, out int margin);
|
bool success = int.TryParse(marginTextBox.Text, out int margin);
|
||||||
if (sucess)
|
if (success)
|
||||||
{
|
{
|
||||||
marginTextBox.Foreground = Brushes.Black;
|
marginTextBox.Foreground = Brushes.Black;
|
||||||
Settings.CurrentLayout.Theme.Margin = margin;
|
Settings.CurrentLayout.Theme.Margin = margin;
|
||||||
@@ -535,6 +536,7 @@ namespace DesktopMagic
|
|||||||
|
|
||||||
private void LoadLayout(bool minimize = true)
|
private void LoadLayout(bool minimize = true)
|
||||||
{
|
{
|
||||||
|
mainWindowDataContext.IsLoading = true;
|
||||||
cornerRadiusTextBox.Text = Settings.CurrentLayout.Theme.CornerRadius.ToString();
|
cornerRadiusTextBox.Text = Settings.CurrentLayout.Theme.CornerRadius.ToString();
|
||||||
marginTextBox.Text = Settings.CurrentLayout.Theme.Margin.ToString();
|
marginTextBox.Text = Settings.CurrentLayout.Theme.Margin.ToString();
|
||||||
blockWindowsClosing = false;
|
blockWindowsClosing = false;
|
||||||
@@ -607,6 +609,7 @@ namespace DesktopMagic
|
|||||||
WindowState = WindowState.Normal;
|
WindowState = WindowState.Normal;
|
||||||
Window_StateChanged(null, null);
|
Window_StateChanged(null, null);
|
||||||
}
|
}
|
||||||
|
mainWindowDataContext.IsLoading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Layout
|
#endregion Layout
|
||||||
@@ -634,7 +637,7 @@ namespace DesktopMagic
|
|||||||
RestoreWindow();
|
RestoreWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GithubButton_Click(object sender, RoutedEventArgs e)
|
private void GitHubButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
string uri = "https://github.com/Stone-Red-Code/DesktopMagic";
|
string uri = "https://github.com/Stone-Red-Code/DesktopMagic";
|
||||||
ProcessStartInfo psi = new ProcessStartInfo
|
ProcessStartInfo psi = new ProcessStartInfo
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ public partial class PluginWindow : Window
|
|||||||
|
|
||||||
private void Window_ContentRendered(object? sender, EventArgs e)
|
private void Window_ContentRendered(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
App.Logger.Log($"\"{PluginMetadata}\" - Starting plugin thread", "Plugin");
|
App.Logger.Log($"\"{PluginMetadata.Name}\" - Starting plugin thread", "Plugin");
|
||||||
pluginThread = new Thread(LoadPlugin);
|
pluginThread = new Thread(LoadPlugin);
|
||||||
pluginThread.Start();
|
pluginThread.Start();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user