JT
2 years ago
committed by
GitHub
14 changed files with 216 additions and 67 deletions
@ -0,0 +1,12 @@
|
||||
using System.Threading.Tasks; |
||||
using Refit; |
||||
using StabilityMatrix.Models.Api; |
||||
|
||||
namespace StabilityMatrix.Api; |
||||
|
||||
[Headers("User-Agent: StabilityMatrix")] |
||||
public interface IGithubApi |
||||
{ |
||||
[Get("/repos/{username}/{repository}/releases/latest")] |
||||
Task<GithubRelease> GetLatestRelease(string username, string repository); |
||||
} |
@ -1,59 +1,65 @@
|
||||
<ui:FluentWindow x:Class="StabilityMatrix.MainWindow" |
||||
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:local="clr-namespace:StabilityMatrix" |
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" |
||||
mc:Ignorable="d" |
||||
Background="{DynamicResource ApplicationBackgroundBrush}" |
||||
Foreground="{DynamicResource TextFillColorPrimaryBrush}" |
||||
ExtendsContentIntoTitleBar="True" |
||||
WindowBackdropType="Mica" |
||||
Loaded="MainWindow_OnLoaded" |
||||
Title="Stability Matrix" Height="700" Width="1100"> |
||||
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:local="clr-namespace:StabilityMatrix" |
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" |
||||
mc:Ignorable="d" |
||||
Background="{DynamicResource ApplicationBackgroundBrush}" |
||||
Foreground="{DynamicResource TextFillColorPrimaryBrush}" |
||||
ExtendsContentIntoTitleBar="True" |
||||
WindowBackdropType="Mica" |
||||
Loaded="MainWindow_OnLoaded" |
||||
Title="Stability Matrix" Height="700" Width="1100"> |
||||
<Grid> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="*" /> |
||||
</Grid.RowDefinitions> |
||||
|
||||
|
||||
<ui:TitleBar Foreground="White" Background="#191919"> |
||||
<ui:TitleBar.Header> |
||||
<TextBlock Text="Stability Matrix" Margin="16,8" /> |
||||
</ui:TitleBar.Header> |
||||
</ui:TitleBar> |
||||
|
||||
<ui:NavigationView |
||||
Grid.Row="1" x:Name="RootNavigation" |
||||
IsBackButtonVisible="Collapsed"> |
||||
<ui:NavigationView.Header> |
||||
<ui:BreadcrumbBar |
||||
Margin="42,32,0,0" |
||||
FontSize="28" |
||||
FontWeight="DemiBold" /> |
||||
</ui:NavigationView.Header> |
||||
<ui:NavigationView.MenuItems> |
||||
<ui:NavigationViewItem Content="Launch" IsActive="true" TargetPageType="{x:Type local:LaunchPage}"> |
||||
<ui:NavigationViewItem.Icon> |
||||
<ui:SymbolIcon Symbol="Rocket24" /> |
||||
</ui:NavigationViewItem.Icon> |
||||
</ui:NavigationViewItem> |
||||
<ui:NavigationViewItem Content="Install" TargetPageType="{x:Type local:InstallPage}"> |
||||
<ui:NavigationViewItem.Icon> |
||||
<ui:SymbolIcon Symbol="Wrench24" /> |
||||
</ui:NavigationViewItem.Icon> |
||||
</ui:NavigationViewItem> |
||||
</ui:NavigationView.MenuItems> |
||||
<ui:NavigationView.FooterMenuItems> |
||||
<ui:NavigationViewItem Content="Settings" TargetPageType="{x:Type local:SettingsPage}"> |
||||
<ui:NavigationViewItem.Icon> |
||||
<ui:SymbolIcon Symbol="Settings24" /> |
||||
</ui:NavigationViewItem.Icon> |
||||
</ui:NavigationViewItem> |
||||
</ui:NavigationView.FooterMenuItems> |
||||
</ui:NavigationView> |
||||
|
||||
<Grid Grid.Row="1" Visibility="{Binding AdvancedModeVisibility, FallbackValue=Visible}"> |
||||
<ui:NavigationView x:Name="RootNavigation" |
||||
IsBackButtonVisible="Collapsed"> |
||||
<ui:NavigationView.Header> |
||||
<ui:BreadcrumbBar |
||||
Margin="42,32,0,16" |
||||
FontSize="28" |
||||
FontWeight="DemiBold" /> |
||||
</ui:NavigationView.Header> |
||||
<ui:NavigationView.MenuItems> |
||||
<ui:NavigationViewItem Content="Launch" IsActive="true" TargetPageType="{x:Type local:LaunchPage}"> |
||||
<ui:NavigationViewItem.Icon> |
||||
<ui:SymbolIcon Symbol="Rocket24" /> |
||||
</ui:NavigationViewItem.Icon> |
||||
</ui:NavigationViewItem> |
||||
<ui:NavigationViewItem Content="Install" TargetPageType="{x:Type local:InstallPage}"> |
||||
<ui:NavigationViewItem.Icon> |
||||
<ui:SymbolIcon Symbol="Wrench24" /> |
||||
</ui:NavigationViewItem.Icon> |
||||
</ui:NavigationViewItem> |
||||
</ui:NavigationView.MenuItems> |
||||
<ui:NavigationView.FooterMenuItems> |
||||
<ui:NavigationViewItem Content="Settings" TargetPageType="{x:Type local:SettingsPage}"> |
||||
<ui:NavigationViewItem.Icon> |
||||
<ui:SymbolIcon Symbol="Settings24" /> |
||||
</ui:NavigationViewItem.Icon> |
||||
</ui:NavigationViewItem> |
||||
</ui:NavigationView.FooterMenuItems> |
||||
</ui:NavigationView> |
||||
</Grid> |
||||
<Grid Grid.Row="1" Visibility="{Binding SimpleModeVisibility, FallbackValue=Hidden}"> |
||||
<ui:Button Content="Install" HorizontalAlignment="Center" FontSize="36" Padding="16"/> |
||||
<Button Content="Advanced Options" HorizontalAlignment="Center" |
||||
Background="Transparent" |
||||
Command="{Binding GoAdvancedModeCommand}" |
||||
VerticalAlignment="Bottom" Margin="16" FontSize="14"/> |
||||
</Grid> |
||||
<ContentPresenter x:Name="RootContentDialog" Grid.Row="1" /> |
||||
</Grid> |
||||
</ui:FluentWindow> |
||||
|
@ -0,0 +1,9 @@
|
||||
using System.Text.Json.Serialization; |
||||
|
||||
namespace StabilityMatrix.Models.Api; |
||||
|
||||
public class GithubRelease |
||||
{ |
||||
[JsonPropertyName("tag_name")] |
||||
public string TagName { get; set; } |
||||
} |
@ -0,0 +1,50 @@
|
||||
using System.Windows; |
||||
using CommunityToolkit.Mvvm.ComponentModel; |
||||
using CommunityToolkit.Mvvm.Input; |
||||
using StabilityMatrix.Helper; |
||||
using Wpf.Ui.Appearance; |
||||
|
||||
namespace StabilityMatrix.ViewModels; |
||||
|
||||
public partial class MainWindowViewModel : ObservableObject |
||||
{ |
||||
private readonly ISettingsManager settingsManager; |
||||
|
||||
public MainWindowViewModel(ISettingsManager settingsManager) |
||||
{ |
||||
this.settingsManager = settingsManager; |
||||
} |
||||
|
||||
[ObservableProperty] |
||||
private Visibility advancedModeVisibility; |
||||
|
||||
[ObservableProperty] |
||||
private Visibility simpleModeVisibility; |
||||
|
||||
public void OnLoaded() |
||||
{ |
||||
SetTheme(); |
||||
GoAdvancedMode(); |
||||
} |
||||
|
||||
[RelayCommand] |
||||
private void GoAdvancedMode() |
||||
{ |
||||
AdvancedModeVisibility = Visibility.Visible; |
||||
SimpleModeVisibility = Visibility.Hidden; |
||||
} |
||||
|
||||
private void SetTheme() |
||||
{ |
||||
var theme = settingsManager.Settings.Theme; |
||||
switch (theme) |
||||
{ |
||||
case "Dark": |
||||
Theme.Apply(ThemeType.Dark); |
||||
break; |
||||
case "Light": |
||||
Theme.Apply(ThemeType.Light); |
||||
break; |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue