diff --git a/Controls/RaidButton.axaml b/Controls/RaidButton.axaml
index 941f3bc..4eec746 100644
--- a/Controls/RaidButton.axaml
+++ b/Controls/RaidButton.axaml
@@ -62,6 +62,9 @@
HorizontalContentAlignment="Center"
Foreground="{Binding ViewerCountColor}"
Content="{Binding Channel.ViewerCount}" />
+
diff --git a/Models/BetterRaidDatabase.cs b/Models/BetterRaidDatabase.cs
index fc855e9..1c39ec7 100644
--- a/Models/BetterRaidDatabase.cs
+++ b/Models/BetterRaidDatabase.cs
@@ -28,6 +28,7 @@ public class BetterRaidDatabase : INotifyPropertyChanged
}
}
public List Channels { get; set; } = [];
+ public Dictionary LastRaided = [];
public bool AutoSave { get; set; }
public static BetterRaidDatabase LoadFromFile(string path)
@@ -51,6 +52,14 @@ public class BetterRaidDatabase : INotifyPropertyChanged
dbObj._databaseFilePath = path;
+ foreach (var channel in dbObj.Channels)
+ {
+ if (dbObj.LastRaided.ContainsKey(channel) == false)
+ {
+ dbObj.LastRaided.Add(channel, null);
+ }
+ }
+
Console.WriteLine("[DEBUG] Loaded database from {0}", path);
return dbObj;
@@ -93,6 +102,36 @@ public class BetterRaidDatabase : INotifyPropertyChanged
OnPropertyChanged(nameof(Channels));
}
+ public void SetRaided(string channel, DateTime dateTime)
+ {
+ ArgumentNullException.ThrowIfNull(channel);
+
+ if (LastRaided.ContainsKey(channel))
+ {
+ LastRaided[channel] = dateTime;
+ }
+ else
+ {
+ LastRaided.Add(channel, dateTime);
+ }
+
+ OnPropertyChanged(nameof(LastRaided));
+ }
+
+ public DateTime? GetLastRaided(string channel)
+ {
+ ArgumentNullException.ThrowIfNull(channel);
+
+ if (LastRaided.ContainsKey(channel))
+ {
+ return LastRaided[channel];
+ }
+ else
+ {
+ return null;
+ }
+ }
+
private void OnPropertyChanged([CallerMemberName] string? propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
diff --git a/ViewModels/RaidButtonViewModel.cs b/ViewModels/RaidButtonViewModel.cs
index f78d7e0..0c3e839 100644
--- a/ViewModels/RaidButtonViewModel.cs
+++ b/ViewModels/RaidButtonViewModel.cs
@@ -31,6 +31,8 @@ public class RaidButtonViewModel : ViewModelBase
public MainWindowViewModel? MainVm { get; set; }
+ public DateTime? LastRaided => MainVm?.Database?.GetLastRaided(ChannelName);
+
public async Task GetOrUpdateChannelAsync()
{
if (_channel == null)
@@ -119,6 +121,11 @@ public class RaidButtonViewModel : ViewModelBase
var createdAt = raid.Data[0].CreatedAt;
var isMature = raid.Data[0].IsMature;
}
+
+ if (MainVm?.Database != null)
+ {
+ MainVm.Database.SetRaided(ChannelName, DateTime.Now);
+ }
}
public void RemoveChannel()
diff --git a/Views/MainWindow.axaml.cs b/Views/MainWindow.axaml.cs
index 163fe5f..908402a 100644
--- a/Views/MainWindow.axaml.cs
+++ b/Views/MainWindow.axaml.cs
@@ -173,8 +173,9 @@ public partial class MainWindow : Window
var addButton = new Button
{
Content = "+",
- FontSize = 36,
+ FontSize = 72,
Margin = new Avalonia.Thickness(5),
+ MinHeight = 250,
HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Stretch,
VerticalAlignment = Avalonia.Layout.VerticalAlignment.Stretch,
HorizontalContentAlignment = Avalonia.Layout.HorizontalAlignment.Center,
diff --git a/db.json b/db.json
index a88f587..03da05e 100644
--- a/db.json
+++ b/db.json
@@ -1 +1 @@
-{"OnlyOnline":true,"Channels":["Cedricun","ZanTal","PropzMaster","Artimus83","HyperonsLive","theshroomlife","Robocraft999","sllikson","Aron_dc","AIEsports","TobinatorLP","Lordabgrund","GronkhTV"],"AutoSave":true}
\ No newline at end of file
+{"LastRaided":{"Cedricun":null,"ZanTal":null,"PropzMaster":null,"Artimus83":null,"HyperonsLive":null,"theshroomlife":null,"Robocraft999":null,"sllikson":null,"Aron_dc":null,"AIEsports":null,"TobinatorLP":null,"Lordabgrund":null,"GronkhTV":null},"OnlyOnline":false,"Channels":["Cedricun","ZanTal","PropzMaster","Artimus83","HyperonsLive","theshroomlife","Robocraft999","sllikson","Aron_dc","AIEsports","TobinatorLP","Lordabgrund","GronkhTV"],"AutoSave":true}
\ No newline at end of file