Skip to content

Commit

Permalink
Add changelog page
Browse files Browse the repository at this point in the history
  • Loading branch information
Drommedhar committed Sep 24, 2024
1 parent e12a310 commit 5d0092d
Show file tree
Hide file tree
Showing 12 changed files with 126 additions and 6 deletions.
2 changes: 2 additions & 0 deletions DlssUpdater/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ public partial class App
services.AddSingleton<DLSSViewModel>();
services.AddSingleton<SettingsPage>();
services.AddSingleton<SettingsViewModel>();
services.AddSingleton<ChangelogPage>();
services.AddSingleton<ChangelogViewModel>();

services.AddSingleton<Settings>();
services.AddSingleton<DllUpdater>();
Expand Down
4 changes: 4 additions & 0 deletions DlssUpdater/DLSSUpdater.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

<ItemGroup>
<PackageReference Include="Expression.Blend.Sdk" Version="1.0.2" />
<PackageReference Include="MdXaml" Version="1.27.0" />
<PackageReference Include="System.Drawing.Common" Version="8.0.8" />
<PackageReference Include="WPF-UI" Version="3.0.5" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
Expand All @@ -40,6 +41,9 @@
</ItemGroup>

<ItemGroup>
<None Update="changelog.md">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="version.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down
2 changes: 2 additions & 0 deletions DlssUpdater/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class AntiCheat

public Paths Directories { get; set; } = new();
public AntiCheat AntiCheatSettings { get; set; } = new();
public bool ShowChangelogOnStartup { get; set; } = false;

public void Save()
{
Expand All @@ -60,5 +61,6 @@ private void copyData(Settings other)
{
Directories = other.Directories;
AntiCheatSettings = other.AntiCheatSettings;
ShowChangelogOnStartup = other.ShowChangelogOnStartup;
}
}
38 changes: 38 additions & 0 deletions DlssUpdater/ViewModels/Pages/ChangelogViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using DlssUpdater.Defines;
using DlssUpdater.Helpers;
using DlssUpdater.Singletons;
using DlssUpdater.Singletons.AntiCheatChecker;
using Microsoft.VisualBasic;
using System.ComponentModel;
using System.Reflection;
using System.Runtime;
using Wpf.Ui.Appearance;
using Wpf.Ui.Controls;

namespace DlssUpdater.ViewModels.Pages;

public partial class ChangelogViewModel : ObservableObject, INavigationAware
{
private bool _isInitialized = false;
private Settings _settings;

public ChangelogViewModel(Settings settings)
{
_settings = settings;
}

public void OnNavigatedTo()
{
if (!_isInitialized)
InitializeViewModel();
}

public void OnNavigatedFrom()
{
}

private void InitializeViewModel()
{
_isInitialized = true;
}
}
6 changes: 6 additions & 0 deletions DlssUpdater/ViewModels/Windows/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ public partial class MainWindowViewModel : ObservableObject

[ObservableProperty] private ObservableCollection<object> _footerMenuItems = new()
{
new NavigationViewItem
{
Content = "Changelog",
Icon = new SymbolIcon { Symbol = SymbolRegular.DocumentOnePage20 },
TargetPageType = typeof(ChangelogPage)
},
new NavigationViewItem
{
Content = "Settings",
Expand Down
23 changes: 23 additions & 0 deletions DlssUpdater/Views/Pages/ChangelogPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Page
x:Class="DlssUpdater.Views.Pages.ChangelogPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:mdxam="clr-namespace:MdXaml;assembly=MdXaml"
xmlns:helpers="clr-namespace:DlssUpdater.Helpers"
xmlns:pages="clr-namespace:DlssUpdater.Views.Pages"
Title="ChangelogPage"
d:DataContext="{d:DesignInstance pages:ChangelogPage,
IsDesignTimeCreatable=False}"
d:DesignHeight="450"
d:DesignWidth="800"
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}"
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
mc:Ignorable="d">
<StackPanel>
<mdxam:MarkdownScrollViewer x:Name="viewLog" xml:space="preserve" Grid.Row="1" MarkdownStyleName="Sasabune" />
</StackPanel>
</Page>
19 changes: 19 additions & 0 deletions DlssUpdater/Views/Pages/ChangelogPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using DlssUpdater.ViewModels.Pages;
using Wpf.Ui.Controls;

namespace DlssUpdater.Views.Pages;

public partial class ChangelogPage : INavigableView<ChangelogViewModel>
{
public ChangelogPage(ChangelogViewModel viewModel)
{
ViewModel = viewModel;
DataContext = this;

InitializeComponent();

viewLog.Markdown = System.IO.File.ReadAllText("changelog.md");
}

public ChangelogViewModel ViewModel { get; }
}
21 changes: 17 additions & 4 deletions DlssUpdater/Views/Windows/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using DlssUpdater.ViewModels.Windows;
using DlssUpdater.Views.Pages;
using System.Runtime;
using Wpf.Ui;
using Wpf.Ui.Appearance;
using Wpf.Ui.Controls;
Expand All @@ -8,10 +9,15 @@ namespace DlssUpdater.Views.Windows;

public partial class MainWindow : INavigationWindow
{
public MainWindowViewModel ViewModel { get; }

private readonly Settings _settings;

public MainWindow(MainWindowViewModel viewModel, IPageService pageService, INavigationService navigationService,
ISnackbarService snackbarService)
ISnackbarService snackbarService, Settings settings)
{
ViewModel = viewModel;
_settings = settings;
DataContext = this;

SystemThemeWatcher.Watch(this);
Expand All @@ -23,8 +29,6 @@ public MainWindow(MainWindowViewModel viewModel, IPageService pageService, INavi
navigationService.SetNavigationControl(RootNavigation);
}

public MainWindowViewModel ViewModel { get; }

INavigationView INavigationWindow.GetNavigation()
{
throw new NotImplementedException();
Expand Down Expand Up @@ -66,7 +70,16 @@ public void SetPageService(IPageService pageService)
public void ShowWindow()
{
Show();
Navigate(typeof(GamesPage));
if (_settings.ShowChangelogOnStartup)
{
Navigate(typeof(ChangelogPage));
_settings.ShowChangelogOnStartup = false;
_settings.Save();
}
else
{
Navigate(typeof(GamesPage));
}
}

public void CloseWindow()
Expand Down
3 changes: 3 additions & 0 deletions DlssUpdater/Windows/Splashscreen/Splashscreen.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ protected override async void OnContentRendered(EventArgs e)

if(installUpdate)
{
_settings.ShowChangelogOnStartup = true;
_settings.Save();

// Download the update and start the ApplicationUpdater
var outputPath = Path.Combine(AppContext.BaseDirectory, _settings.Directories.DownloadPath, "update.zip");
var updateUrl = "http://github.com/Drommedhar/DlssUpdater/releases/latest/download/dlssupdater.zip";
Expand Down
5 changes: 5 additions & 0 deletions DlssUpdater/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# v1.0.0.1
* Add changelog window, which will automatically be shown after update

# v1.0.0.0
* Initial release
2 changes: 1 addition & 1 deletion DlssUpdater/version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "1.0.0.0"
"version": "1.0.0.1"
}
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ To build Dlss Updater on your machine, you first need to check out the git repos
At the time of writing, these nugets include:
* [WPF UI](https://github.com/lepoco/wpfui)
* [WpfBindingErrors](https://github.com/bblanchon/WpfBindingErrors)
* [MdXaml](https://github.com/whistyun/MdXaml)

With this you should be able to compile Dlss Updater.

Expand Down Expand Up @@ -58,4 +59,8 @@ Dlss Updater will not prevent you from updating any DLSS dll for such games, but
Dlss Updater is free and open source software licensed under the MIT License. You can use it in both private and commercial projects. But you must include a copy of the license in your project.

# Discord
If you have further question feel free to join the official discord [here](https://discord.gg/WShdqSDSvu)
If you have further question feel free to join the official discord [here](https://discord.gg/WShdqSDSvu)

# Known issues
* Changes to folders in the [Settings Page](#Settings Page) will not take effect until the application is restarted.
* Game auto-detection cannot be turned off at this time.

0 comments on commit 5d0092d

Please sign in to comment.