[feat:] implemented a basic editor for the wiki

This commit is contained in:
Elias Fierke
2026-01-18 14:36:52 +01:00
parent 2c909820d3
commit ea31637bdb
3 changed files with 80 additions and 13 deletions

View File

@@ -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<TreeViewItem>();
@@ -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)