From ae7495632ec3fbf6d2c0e98f4190ce00e7a827d9 Mon Sep 17 00:00:00 2001 From: Florian Stinglmayr Date: Sun, 9 Jan 2022 11:13:01 +0100 Subject: [PATCH] add checkboxes to enable/disable objectives --- BGS/GenericDiscordLog.cs | 4 ++++ BGS/LogEntry.cs | 2 ++ BGS/NonaDiscordLog.cs | 4 ++++ BGS/Objective.cs | 17 +++++++++++++++++ MainWindow.xaml | 21 ++++++++++++++++++++- MainWindow.xaml.cs | 33 ++++++++++++--------------------- 6 files changed, 59 insertions(+), 22 deletions(-) diff --git a/BGS/GenericDiscordLog.cs b/BGS/GenericDiscordLog.cs index 1301dd7..a55744a 100644 --- a/BGS/GenericDiscordLog.cs +++ b/BGS/GenericDiscordLog.cs @@ -197,6 +197,10 @@ namespace EliteBGS.BGS { continue; } + if (!objective.IsEnabled) { + continue; + } + log.AppendFormat("**Date:** {0}\n", FormatDate()); log.AppendFormat("**Location:** {0}\n", objective.ToShortString()); log.AppendFormat("**Faction:** {0}\n", objective.Faction); diff --git a/BGS/LogEntry.cs b/BGS/LogEntry.cs index 472b8c5..bf41007 100644 --- a/BGS/LogEntry.cs +++ b/BGS/LogEntry.cs @@ -32,5 +32,7 @@ namespace EliteBGS.BGS { public virtual int CompareTo(LogEntry other) { throw new NotImplementedException("not implemented"); } + + public string Name => this.ToString(); } } diff --git a/BGS/NonaDiscordLog.cs b/BGS/NonaDiscordLog.cs index 6a91640..1ba379f 100644 --- a/BGS/NonaDiscordLog.cs +++ b/BGS/NonaDiscordLog.cs @@ -196,6 +196,10 @@ namespace EliteBGS.BGS { continue; } + if (!objective.IsEnabled) { + continue; + } + log.AppendFormat(":globe_with_meridians: `Location:` {0}\n", objective.ToShortString()); log.Append(":clipboard: `Conducted:`\n"); log.Append("```\n"); diff --git a/BGS/Objective.cs b/BGS/Objective.cs index 4336102..9217ad4 100644 --- a/BGS/Objective.cs +++ b/BGS/Objective.cs @@ -11,11 +11,26 @@ namespace EliteBGS.BGS { private List entries = new List(); + [JsonIgnore] + public bool IsEnabled { get; set; } + + [JsonIgnore] + public List Children { + get => entries; + } + + [JsonIgnore] + public string Name => this.ToString(); + + [JsonIgnore] + public bool IsExpanded { get; set; } + [JsonIgnore] public List LogEntries { get => entries; set => entries = value; } + public void Clear() { if (entries == null) { return; @@ -23,6 +38,8 @@ namespace EliteBGS.BGS { entries.RemoveAll(x => !x.ManuallyAdded); } + public bool ManuallyAdded { get; set; } + public int Matches(LogEntry e) { int match_count = 0; diff --git a/MainWindow.xaml b/MainWindow.xaml index 27140a5..1d6a650 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -48,7 +48,26 @@