Compare commits
No commits in common. "c0fd36c8dec4e9a7a1c52e5954580c22b1f53259" and "1693d8882dc99addd91dc80704d34c7f8f7b0f19" have entirely different histories.
c0fd36c8de
...
1693d8882d
@ -1,31 +0,0 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
|
||||||
using MsBox.Avalonia;
|
|
||||||
|
|
||||||
namespace EliteBGS;
|
|
||||||
|
|
||||||
public class Helper {
|
|
||||||
public static void MessageBox(Window owner, string caption, string text) {
|
|
||||||
var box = MessageBoxManager
|
|
||||||
.GetMessageBoxStandard(caption, text)
|
|
||||||
;
|
|
||||||
var result = box.ShowAsPopupAsync(owner);
|
|
||||||
result.Wait();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string? OpenFileDialog(Window owner) {
|
|
||||||
OpenFileDialog dlg = new OpenFileDialog();
|
|
||||||
|
|
||||||
dlg.AllowMultiple = false;
|
|
||||||
|
|
||||||
var result = dlg.ShowAsync(owner);
|
|
||||||
result.Wait();
|
|
||||||
var filename = result.Result;
|
|
||||||
|
|
||||||
if (filename == null || filename.Length <= 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return filename[0];
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +1,5 @@
|
|||||||
<Window x:Class="EliteBGS.LoadEntriesWindow"
|
<Window x:Class="EliteBGS.LoadEntriesWindow"
|
||||||
xmlns="https://github.com/avaloniaui"
|
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:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
@ -3,7 +3,6 @@ using System.Linq;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Platform.Storage;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
@ -48,12 +47,8 @@ public partial class LoadEntriesWindow : Window {
|
|||||||
EntriesLoaded?.Invoke(entries);
|
EntriesLoaded?.Invoke(entries);
|
||||||
}
|
}
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
Helper.MessageBox(
|
MessageBox.Show(string.Format("There was an error while parsing the JSON: {0}",
|
||||||
this, "Error",
|
exception.ToString()));
|
||||||
string.Format(
|
|
||||||
"There was an error while parsing the JSON: {0}",
|
|
||||||
exception.ToString())
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,14 +57,23 @@ public partial class LoadEntriesWindow : Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void LoadFile_Click(object sender, RoutedEventArgs e) {
|
private void LoadFile_Click(object sender, RoutedEventArgs e) {
|
||||||
string? filename = Helper.OpenFileDialog(this);
|
OpenFileDialog dialog = new OpenFileDialog();
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(filename)) {
|
dialog.DefaultExt = ".log";
|
||||||
|
dialog.Filter = "Log files (*.log)|*.log|All files (*.*)|*";
|
||||||
|
|
||||||
|
var location = AppConfig.DefaultJournalLocation;
|
||||||
|
if (Directory.Exists(location)) {
|
||||||
|
dialog.InitialDirectory = location;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool result = dialog.ShowDialog(this) ?? false;
|
||||||
|
if (!result) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
using (FileStream stream = File.OpenRead(filename)) {
|
using (FileStream stream = File.OpenRead(dialog.FileName)) {
|
||||||
using (StreamReader reader = new StreamReader(stream)) {
|
using (StreamReader reader = new StreamReader(stream)) {
|
||||||
Lines.Text = reader.ReadToEnd();
|
Lines.Text = reader.ReadToEnd();
|
||||||
}
|
}
|
||||||
@ -109,11 +113,8 @@ public partial class LoadEntriesWindow : Window {
|
|||||||
;
|
;
|
||||||
Lines.Text = string.Join("\n", text).Trim();
|
Lines.Text = string.Join("\n", text).Trim();
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
Helper.MessageBox(
|
MessageBox.Show(string.Format("There was an error while parsing the JSON: {0}",
|
||||||
"Error",
|
exception.ToString()));
|
||||||
string.Format("There was an error while parsing the JSON: {0}",
|
|
||||||
exception.ToString())
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,6 +150,9 @@ public partial class MainWindow : Window {
|
|||||||
DateTime today = DateTime.Today;
|
DateTime today = DateTime.Today;
|
||||||
DateTime tomorrow = today.AddDays(1);
|
DateTime tomorrow = today.AddDays(1);
|
||||||
|
|
||||||
|
// HOCHKULTUR
|
||||||
|
startdate.Culture = enddate.Culture = CultureInfo.GetCultureInfo("de-AT");
|
||||||
|
|
||||||
startdate.SelectedDate = today;
|
startdate.SelectedDate = today;
|
||||||
enddate.SelectedDate = tomorrow;
|
enddate.SelectedDate = tomorrow;
|
||||||
}
|
}
|
||||||
@ -166,7 +169,7 @@ public partial class MainWindow : Window {
|
|||||||
builder.Append(message);
|
builder.Append(message);
|
||||||
builder.Append("\n");
|
builder.Append("\n");
|
||||||
|
|
||||||
log.Text = log.Text + builder.ToString();
|
log.AppendText(builder.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Log(string message) {
|
private void Log(string message) {
|
||||||
@ -361,7 +364,7 @@ public partial class MainWindow : Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void RefreshView() {
|
private void RefreshView() {
|
||||||
//entries.Items.Refresh();
|
entries.Items.Refresh();
|
||||||
GenerateLog();
|
GenerateLog();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -521,7 +524,7 @@ public partial class MainWindow : Window {
|
|||||||
startdate.SelectedDate = ResetTimeToZero(d.Value);
|
startdate.SelectedDate = ResetTimeToZero(d.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
d = enddate.SelectedDate?.Date;
|
d = enddate.SelectedDate;
|
||||||
if (d != null) {
|
if (d != null) {
|
||||||
enddate.SelectedDate = ResetTimeToZero(d.Value);
|
enddate.SelectedDate = ResetTimeToZero(d.Value);
|
||||||
}
|
}
|
||||||
@ -605,7 +608,7 @@ public partial class MainWindow : Window {
|
|||||||
Name = "Discord Server Name",
|
Name = "Discord Server Name",
|
||||||
Webhook = "..."
|
Webhook = "..."
|
||||||
});
|
});
|
||||||
//Webhooks.Items.Refresh();
|
Webhooks.Items.Refresh();
|
||||||
RefreshPostMenu();
|
RefreshPostMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -621,17 +624,17 @@ public partial class MainWindow : Window {
|
|||||||
foreach (var item in selection) {
|
foreach (var item in selection) {
|
||||||
Config.Global.Webhooks.Remove(item);
|
Config.Global.Webhooks.Remove(item);
|
||||||
}
|
}
|
||||||
//Webhooks.Items.Refresh();
|
Webhooks.Items.Refresh();
|
||||||
RefreshPostMenu();
|
RefreshPostMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Webhooks_KeyUp(object sender, KeyEventArgs e) {
|
private void Webhooks_KeyUp(object sender, KeyEventArgs e) {
|
||||||
DataGridCell cell = e.Source as DataGridCell;
|
DataGridCell cell = e.OriginalSource as DataGridCell;
|
||||||
/* We also get keypresses from DataGridCells that are currently
|
/* We also get keypresses from DataGridCells that are currently
|
||||||
* editing their content. Filter those out. We don't want to delete
|
* editing their content. Filter those out. We don't want to delete
|
||||||
* the row when the user presses DEL while editing the cells content
|
* the row when the user presses DEL while editing the cells content
|
||||||
*/
|
*/
|
||||||
if (cell == null) {
|
if (cell == null || cell.IsEditing) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (e.Key == Key.Delete) {
|
if (e.Key == Key.Delete) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user