Skip to content

Commit a3178a6

Browse files
committed
Update assembly version, modernize dependencies, and add MOTD UI
Updated assembly version to 1.6.5.3. Modernized dependency management in `Songify Slim.csproj` by removing `<Import>` elements, old references, and `packages.config`, and adding `PackageReference` entries. Enhanced `MotdControl.xaml` and `MotdControl.xaml.cs` with new UI elements and logic for marking messages as read. Updated `ConfigHandler.cs` and `Settings.cs` to support new MOTD settings. Improved `MainWindow.xaml` and `MainWindow.xaml.cs` with new UI elements and toast notifications. Reformatted `packages.config` for consistency. Introduced `Window_UniversalDialog.xaml` and its code-behind for dynamic content display.
1 parent 42bf546 commit a3178a6

12 files changed

+1555
-543
lines changed

MigrationBackup/301b44c9/Songify Slim/Songify Slim.csproj

+893
Large diffs are not rendered by default.

Songify Slim/packages.config MigrationBackup/301b44c9/Songify Slim/packages.config

+107-107
Large diffs are not rendered by default.

Songify Slim/Properties/AssemblyInfo.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
// You can specify all the values or you can default the Build and Revision Numbers
5151
// by using the '*' as shown below:
5252
// [assembly: AssemblyVersion("1.0.*")]
53-
[assembly: AssemblyVersion("1.6.5.2")]
53+
[assembly: AssemblyVersion("1.6.5.3")]
5454
[assembly: AssemblyFileVersion("1.6.5.3")]
5555
[assembly: NeutralResourcesLanguage("en")]
5656
[assembly: Guid("442379e3-32d8-42d1-ab09-cba229672453")]

Songify Slim/Songify Slim.csproj

+235-404
Large diffs are not rendered by default.

Songify Slim/UserControls/MotdControl.xaml

+17
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
67
xmlns:local="clr-namespace:Songify_Slim.UserControls"
78
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
89
MinWidth="588"
@@ -51,6 +52,22 @@
5152
Orientation="Horizontal">
5253
<TextBlock Text="Author: " />
5354
<TextBlock x:Name="TbAuthor" />
55+
<Button
56+
x:Name="btnRead"
57+
Margin="6,0"
58+
Click="BtnRead_OnClick"
59+
Style="{DynamicResource MahApps.Styles.Button.WindowCommands}"
60+
ToolTip="Mark As Read">
61+
<Button.Content>
62+
<iconPacks:Material
63+
x:Name="badgeIcon"
64+
Width="12"
65+
Height="12"
66+
Kind="Read"
67+
Spin="False"
68+
SpinAutoReverse="False" />
69+
</Button.Content>
70+
</Button>
5471
</StackPanel>
5572

5673
<TextBlock

Songify Slim/UserControls/MotdControl.xaml.cs

+37-6
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
using System.Windows.Media.Imaging;
1313
using System.Windows.Navigation;
1414
using System.Windows.Shapes;
15+
using MahApps.Metro.IconPacks;
1516
using Songify_Slim.Models;
1617
using Songify_Slim.Util.General;
18+
using Songify_Slim.Util.Settings;
1719

1820
namespace Songify_Slim.UserControls
1921
{
@@ -22,15 +24,26 @@ namespace Songify_Slim.UserControls
2224
/// </summary>
2325
public partial class MotdControl : UserControl
2426
{
27+
private Motd _motd;
28+
29+
PackIconMaterial readIcon = new()
30+
{
31+
Kind = PackIconMaterialKind.Check,
32+
Width = 12,
33+
Height = 12,
34+
VerticalAlignment = VerticalAlignment.Center
35+
};
36+
2537
public MotdControl(Motd motd)
2638
{
2739
InitializeComponent();
28-
TbAuthor.Text = motd.Author;
29-
TbDate.Text = motd.CreatedAtDateTime?.ToString("dd.MM.yyyy HH:mm");
30-
TbMessage.Text = IOManager.InterpretEscapeCharacters(motd.MessageText);
31-
TbSeverity.Text = motd.Severity;
40+
this._motd = motd;
41+
TbAuthor.Text = _motd.Author;
42+
TbDate.Text = _motd.CreatedAtDateTime?.ToString("dd.MM.yyyy HH:mm");
43+
TbMessage.Text = IOManager.InterpretEscapeCharacters(_motd.MessageText);
44+
TbSeverity.Text = _motd.Severity;
3245

33-
Brush severitybrush = motd.Severity switch
46+
Brush severitybrush = _motd.Severity switch
3447
{
3548
"Low" => Brushes.ForestGreen,
3649
"Medium" => Brushes.DarkOrange,
@@ -41,10 +54,28 @@ public MotdControl(Motd motd)
4154
BorderSeverity.BorderBrush = severitybrush;
4255
BorderSeverity.Background = severitybrush;
4356

44-
if (motd.Severity == "High")
57+
if (_motd.Severity == "High")
4558
{
4659
BorderMotd.BorderBrush = severitybrush;
4760
}
61+
62+
if (Settings.ReadNotificationIds != null && Settings.ReadNotificationIds.Contains(motd.Id))
63+
{
64+
65+
btnRead.Content = readIcon;
66+
}
67+
}
68+
69+
private void BtnRead_OnClick(object sender, RoutedEventArgs e)
70+
{
71+
btnRead.Content = readIcon;
72+
List<int> readNotificationIds = Settings.ReadNotificationIds;
73+
if (readNotificationIds != null && readNotificationIds.Contains(_motd.Id))
74+
return;
75+
readNotificationIds ??= [];
76+
readNotificationIds.Add(_motd.Id);
77+
Settings.ReadNotificationIds = readNotificationIds;
78+
4879
}
4980
}
5081
}

Songify Slim/Util/Settings/ConfigHandler.cs

+4
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ public static void ReadConfig()
271271
FontSize = 22,
272272
FontsizeQueue = 12,
273273
BaseUrl = "https://songify.overcode.tv",
274+
LastShownMotdId = 0,
275+
ReadNotificationIds = [],
274276
};
275277
}
276278
break;
@@ -706,6 +708,8 @@ public class AppConfig
706708
public int FontSize { get; set; } = 22;
707709
public int FontsizeQueue { get; set; } = 12;
708710
public string BaseUrl { get; set; } = "https://songify.rocks";
711+
public int LastShownMotdId { get; set; }
712+
public List<int> ReadNotificationIds { get; set; } = [];
709713
}
710714

711715
public class Config

Songify Slim/Util/Settings/Settings.cs

+27
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,31 @@ public static Enums.PauseOptions PauseOption
2323
public static int Fontsize { get => GetFontSize(); set => SetFontSize(value); }
2424
public static int FontsizeQueue { get => GetFontSizeQueue(); set => SetFontSizeQueue(value); }
2525
public static string BaseUrl { get => GetBaseUrl(); set => SetBaseUrl(value); }
26+
public static int LastShownMotdId { get => GetLastShownMotdId(); set => SetLastShownMotdId(value); }
27+
public static List<int> ReadNotificationIds { get => GetReadNotificationIds(); set => SetReadNotificationIds(value); }
28+
29+
private static void SetReadNotificationIds(List<int> value)
30+
{
31+
_currentConfig.AppConfig.ReadNotificationIds = value;
32+
ConfigHandler.WriteConfig(Enums.ConfigTypes.AppConfig, _currentConfig.AppConfig);
33+
}
34+
35+
private static List<int> GetReadNotificationIds()
36+
{
37+
return _currentConfig.AppConfig.ReadNotificationIds;
38+
}
39+
40+
private static void SetLastShownMotdId(int value)
41+
{
42+
_currentConfig.AppConfig.LastShownMotdId = value;
43+
ConfigHandler.WriteConfig(Enums.ConfigTypes.AppConfig, _currentConfig.AppConfig);
44+
}
45+
46+
private static int GetLastShownMotdId()
47+
{
48+
return _currentConfig.AppConfig.LastShownMotdId;
49+
}
50+
2651

2752
private static void SetBaseUrl(string value)
2853
{
@@ -1080,6 +1105,8 @@ public static Configuration Export()
10801105
WebServerPort = GetWebServerPort(),
10811106
WebUserAgent = GetWebua(),
10821107
BaseUrl = GetBaseUrl(),
1108+
LastShownMotdId = GetLastShownMotdId(),
1109+
ReadNotificationIds = GetReadNotificationIds()
10831110
};
10841111

10851112
return new Configuration

Songify Slim/Views/MainWindow.xaml

+35-13
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
xmlns:local="clr-namespace:Songify_Slim.Properties"
1010
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
1111
xmlns:songifySlim="clr-namespace:Songify_Slim"
12+
xmlns:userControls="clr-namespace:Songify_Slim.UserControls"
1213
Title="Songify"
1314
Width="588"
1415
Height="285"
@@ -397,18 +398,37 @@
397398
FontSize="20"
398399
FontWeight="Bold"
399400
Text="{Binding}" />
400-
<Button
401-
x:Name="BtnFlyOutClose"
402-
Width="28"
403-
Height="28"
401+
<StackPanel
404402
HorizontalAlignment="Right"
405403
VerticalAlignment="Top"
406-
Click="BtnFlyOutClose_OnClick"
407-
Style="{DynamicResource MahApps.Styles.Button.Circle}">
408-
<Button.Content>
409-
<iconPacks:FontAwesome Kind="ArrowRightSolid" />
410-
</Button.Content>
411-
</Button>
404+
Orientation="Horizontal">
405+
<Button
406+
x:Name="BtnFlyOutAllread"
407+
Width="40"
408+
Height="28"
409+
Margin="10,0"
410+
Click="BtnFlyOutAllread_OnClick"
411+
Style="{DynamicResource MahApps.Styles.Button.WindowCommands}"
412+
ToolTip="Mark All As Read">
413+
<Button.Content>
414+
<iconPacks:Material
415+
Width="18"
416+
Height="18"
417+
Kind="Read" />
418+
</Button.Content>
419+
</Button>
420+
<Button
421+
x:Name="BtnFlyOutClose"
422+
Width="28"
423+
Height="28"
424+
Margin="0"
425+
Click="BtnFlyOutClose_OnClick"
426+
Style="{DynamicResource MahApps.Styles.Button.Circle}">
427+
<Button.Content>
428+
<iconPacks:FontAwesome Kind="ArrowRightSolid" />
429+
</Button.Content>
430+
</Button>
431+
</StackPanel>
412432
</Grid>
413433
</DataTemplate>
414434
</controls:Flyout.HeaderTemplate>
@@ -417,7 +437,6 @@
417437
</ScrollViewer>
418438
</controls:Flyout>
419439
</Grid>
420-
421440
<Grid
422441
Grid.Row="1"
423442
Grid.RowSpan="2"
@@ -443,16 +462,19 @@
443462
<Viewbox
444463
Grid.Column="1"
445464
Margin="6"
446-
HorizontalAlignment="Left"
465+
HorizontalAlignment="Stretch"
447466
VerticalAlignment="Stretch">
448467
<TextBlock
449468
x:Name="TxtblockLiveoutput"
450469
MaxWidth="500"
451470
Padding="10"
452471
HorizontalAlignment="Left"
453472
VerticalAlignment="Center"
473+
SnapsToDevicePixels="True"
454474
Text="{x:Static local:Resources.mw_LiveOutputPlaceholder}"
455-
TextWrapping="Wrap" />
475+
TextOptions.TextFormattingMode="Display"
476+
TextWrapping="Wrap"
477+
UseLayoutRounding="True" />
456478
</Viewbox>
457479

458480
</Grid>

0 commit comments

Comments
 (0)