diff --git a/MainWindow.axaml.cs b/MainWindow.axaml.cs index ac34a00..1563b79 100644 --- a/MainWindow.axaml.cs +++ b/MainWindow.axaml.cs @@ -19,6 +19,7 @@ public partial class MainWindow : Window private WikiService _wikiService; public Uri filePath; + private string _selectedWikiFilePath; public MainWindow() { @@ -230,6 +231,7 @@ public partial class MainWindow : Window { if (NavTree.SelectedItem is TreeViewItem t && t.Tag is WikiItem item && !item.IsFolder) { + _selectedWikiFilePath = item.Path; var text = await _wikiService.LoadFileContentAsync(item.Path); try { @@ -246,9 +248,14 @@ public partial class MainWindow : Window EditButton.IsEnabled = true; } + else + { + _selectedWikiFilePath = null; + EditButton.IsEnabled = false; + } } - private void PopulateNavTree() + public void PopulateNavTree() { var roots = _wikiService.GetRootItems(); var nodes = new List(); @@ -446,7 +453,16 @@ 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"); + if (string.IsNullOrWhiteSpace(_selectedWikiFilePath)) + { + await MessageBox.Show(this, "Bitte wählen Sie zunächst eine Wiki-Datei aus.", "Keine Datei ausgewählt"); + return; + } + + EditorWindow ew = new(_selectedWikiFilePath); + ew.Show(); + + //await MessageBox.Show(this, "Edit feature is currently disabled.", "Edit Disabled"); } public void RefreshCustomerItems(int index = 0) diff --git a/Wiki/EditorWindow.axaml b/Wiki/EditorWindow.axaml index 296188f..3e15dcc 100644 --- a/Wiki/EditorWindow.axaml +++ b/Wiki/EditorWindow.axaml @@ -1,8 +1,17 @@ + Title="Wiki Editor" MinWidth="600" MinHeight="350" WindowState="Maximized"> - Coming soon. + + + + + +