[chore:] code cleanup by IDE
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
@@ -13,10 +14,10 @@ public partial class MainWindow : Window
|
|||||||
{
|
{
|
||||||
public static MainWindow _instance;
|
public static MainWindow _instance;
|
||||||
|
|
||||||
private WikiService _wikiService;
|
|
||||||
|
|
||||||
private Country _selectedCountry;
|
private Country _selectedCountry;
|
||||||
private bool _suppressCountryRefresh;
|
private bool _suppressCountryRefresh;
|
||||||
|
|
||||||
|
private WikiService _wikiService;
|
||||||
public Uri filePath;
|
public Uri filePath;
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
@@ -49,15 +50,21 @@ public partial class MainWindow : Window
|
|||||||
if (!string.IsNullOrWhiteSpace(Global._instance.wiki_storage_path))
|
if (!string.IsNullOrWhiteSpace(Global._instance.wiki_storage_path))
|
||||||
TbWikiPath.Text = Global._instance.wiki_storage_path;
|
TbWikiPath.Text = Global._instance.wiki_storage_path;
|
||||||
}
|
}
|
||||||
catch { }
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
BtnWikiChoose.Click += BtnWikiChoose_Click;
|
BtnWikiPath.Click += BtnWikiPath_Click;
|
||||||
}
|
}
|
||||||
catch { }
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
}
|
}
|
||||||
catch { }
|
|
||||||
|
|
||||||
//Thread.Sleep(3000);
|
//Thread.Sleep(3000);
|
||||||
//Show();
|
//Show();
|
||||||
@@ -234,6 +241,7 @@ public partial class MainWindow : Window
|
|||||||
PreviewPanel.Children.Clear();
|
PreviewPanel.Children.Clear();
|
||||||
PreviewPanel.Children.Add(new TextBlock { Text = text ?? string.Empty });
|
PreviewPanel.Children.Add(new TextBlock { Text = text ?? string.Empty });
|
||||||
}
|
}
|
||||||
|
|
||||||
EditButton.IsEnabled = true;
|
EditButton.IsEnabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -250,38 +258,36 @@ public partial class MainWindow : Window
|
|||||||
{
|
{
|
||||||
var node = new TreeViewItem { Header = item.Name, Tag = item };
|
var node = new TreeViewItem { Header = item.Name, Tag = item };
|
||||||
if (item.IsFolder)
|
if (item.IsFolder)
|
||||||
{
|
|
||||||
foreach (var c in item.Children)
|
foreach (var c in item.Children)
|
||||||
{
|
|
||||||
node.Items.Add(BuildNode(c));
|
node.Items.Add(BuildNode(c));
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OpenFolderButton_Click(object? sender, RoutedEventArgs e)
|
private void OpenFolderButton_Click(object? sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var path = _wikiService.WikiRootFullPath;
|
var path = Global._instance.wiki_storage_path;
|
||||||
if (!System.IO.Directory.Exists(path)) return;
|
if (!Directory.Exists(path)) return;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo
|
Process.Start(new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = path,
|
FileName = path,
|
||||||
UseShellExecute = true
|
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 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
|
AllowMultiple = false
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -406,6 +412,7 @@ public partial class MainWindow : Window
|
|||||||
{
|
{
|
||||||
await MessageBox.Show(this, "Edit feature is currently disabled.", "Edit Disabled");
|
await MessageBox.Show(this, "Edit feature is currently disabled.", "Edit Disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RefreshCustomerItems(int index = 0)
|
public void RefreshCustomerItems(int index = 0)
|
||||||
{
|
{
|
||||||
if (LstCustomers.Items.Count > 0)
|
if (LstCustomers.Items.Count > 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user