From 71859fa978a2f45d25be5e113bf35a0c7affb7d7 Mon Sep 17 00:00:00 2001 From: Elias Fierke Date: Tue, 13 Jan 2026 20:47:19 +0100 Subject: [PATCH] [chore:] code cleanup by IDE --- MainWindow.axaml.cs | 49 ++++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/MainWindow.axaml.cs b/MainWindow.axaml.cs index fba404e..91468b2 100644 --- a/MainWindow.axaml.cs +++ b/MainWindow.axaml.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.IO; using System.Threading.Tasks; using Avalonia.Controls; using Avalonia.Interactivity; @@ -13,10 +14,10 @@ public partial class MainWindow : Window { public static MainWindow _instance; - private WikiService _wikiService; - private Country _selectedCountry; private bool _suppressCountryRefresh; + + private WikiService _wikiService; public Uri filePath; public MainWindow() @@ -49,15 +50,21 @@ public partial class MainWindow : Window if (!string.IsNullOrWhiteSpace(Global._instance.wiki_storage_path)) TbWikiPath.Text = Global._instance.wiki_storage_path; } - catch { } + catch + { + } try { - BtnWikiChoose.Click += BtnWikiChoose_Click; + BtnWikiPath.Click += BtnWikiPath_Click; + } + catch + { } - catch { } } - catch { } + catch + { + } //Thread.Sleep(3000); //Show(); @@ -234,6 +241,7 @@ public partial class MainWindow : Window PreviewPanel.Children.Clear(); PreviewPanel.Children.Add(new TextBlock { Text = text ?? string.Empty }); } + EditButton.IsEnabled = true; } } @@ -250,38 +258,36 @@ public partial class MainWindow : Window { var node = new TreeViewItem { Header = item.Name, Tag = item }; if (item.IsFolder) - { foreach (var c in item.Children) - { node.Items.Add(BuildNode(c)); - } - } return node; } private void OpenFolderButton_Click(object? sender, RoutedEventArgs e) { - var path = _wikiService.WikiRootFullPath; - if (!System.IO.Directory.Exists(path)) return; + var path = Global._instance.wiki_storage_path; + if (!Directory.Exists(path)) return; try { - System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo + Process.Start(new ProcessStartInfo { FileName = path, UseShellExecute = true }); } - catch { } + catch + { + } } - private async void BtnWikiChoose_Click(object? sender, RoutedEventArgs e) + private async void BtnWikiPath_Click(object? sender, RoutedEventArgs e) { var top = GetTopLevel(this); - var folder = await top.StorageProvider.OpenFolderPickerAsync(new Avalonia.Platform.Storage.FolderPickerOpenOptions + var folder = await top.StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions { - Title = "Choose wiki folder", + Title = "Wiki Pfad wählen", AllowMultiple = false }); @@ -402,10 +408,11 @@ public partial class MainWindow : Window } } - private async void EditButton_Click(object? sender, RoutedEventArgs e) - { - await MessageBox.Show(this, "Edit feature is currently disabled.", "Edit Disabled"); - } + private async void EditButton_Click(object? sender, RoutedEventArgs e) + { + await MessageBox.Show(this, "Edit feature is currently disabled.", "Edit Disabled"); + } + public void RefreshCustomerItems(int index = 0) { if (LstCustomers.Items.Count > 0)