Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,18 @@

<Grid x:Name="TitleBar" Grid.Column="1">
<Image VerticalAlignment="Center" HorizontalAlignment="Left" Width="16" Height="16" Margin="16 0 0 0" Source="ms-appx:///Assets/icon.png" />
<TextBlock
Text="WinDurango"
Style="{StaticResource CaptionTextBlockStyle}"
VerticalAlignment="Center"
Margin="48,0,0,0"/>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="48,0,48,0">
<TextBlock
Text="WinDurango"
Style="{StaticResource CaptionTextBlockStyle}"
VerticalAlignment="Center"/>
<TextBlock
Name="controllerIndicator"
Text=" 🎮"
Style="{StaticResource CaptionTextBlockStyle}"
VerticalAlignment="Center"
Visibility="Collapsed"/>
</StackPanel>
</Grid>
</Grid>
<NavigationView
Expand All @@ -37,7 +44,8 @@
IsPaneOpen="false"
IsBackButtonVisible="Collapsed"
ItemInvoked="NavigationInvoked"
x:Name="navView">
x:Name="navView"
x:FieldModifier="public">
<NavigationView.MenuItems>
<NavigationViewItem Icon="AllApps" Content="Home" Tag="AppsListPage" IsSelected="True"/>
</NavigationView.MenuItems>
Expand All @@ -48,7 +56,7 @@
</NavigationViewItem.Icon>
</NavigationViewItem>
</NavigationView.FooterMenuItems>
<Frame x:Name="contentFrame"/>
<Frame x:Name="contentFrame" x:FieldModifier="public"/>
</NavigationView>
</Grid>
</Window>
37 changes: 36 additions & 1 deletion MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Microsoft.UI.Xaml.Navigation;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using WinDurango.UI.Dialogs;
using WinDurango.UI.Pages;
using WinDurango.UI.Settings;
Expand Down Expand Up @@ -41,6 +42,9 @@ private void NavigationInvoked(NavigationView sender, NavigationViewItemInvokedE
else if (args.InvokedItemContainer is NavigationViewItem item)
{
string tag = item.Tag.ToString();



Type pageType = tag switch
{
"AppsListPage" => typeof(AppsListPage),
Expand Down Expand Up @@ -100,6 +104,12 @@ public MainWindow()

contentFrame.Navigate(typeof(AppsListPage));
AppsListPage = (AppsListPage)contentFrame.Content;

// Controller init
ControllerManager.Instance.Initialize(this);

// Check for updates on startup
_ = CheckForUpdatesAsync();
}

private async void appTitleBar_Loaded(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -151,7 +161,9 @@ private void appTitleBar_SizeChanged(object sender, SizeChangedEventArgs e)
public void SwitchMode(AppMode mode)
{
currentMode = mode;
navView.PaneDisplayMode = currentMode == AppMode.CONTROLLER ? NavigationViewPaneDisplayMode.Top : NavigationViewPaneDisplayMode.LeftCompact;
navView.PaneDisplayMode = NavigationViewPaneDisplayMode.LeftCompact;
navView.IsPaneOpen = currentMode == AppMode.CONTROLLER;
controllerIndicator.Visibility = currentMode == AppMode.CONTROLLER ? Visibility.Visible : Visibility.Collapsed;
}

private void SetupTitleBar()
Expand All @@ -161,5 +173,28 @@ private void SetupTitleBar()
rightPaddingColumn.Width = new GridLength(titleBar.RightInset / scaleAdjustment);
leftPaddingColumn.Width = new GridLength(titleBar.LeftInset / scaleAdjustment);
}

private async Task CheckForUpdatesAsync()
{
try
{
var release = await UpdateManager.CheckForUpdatesAsync();
if (release != null)
{
var dialog = new Confirmation(
$"Update {release.tag_name} is available!\n\n{release.body}\n\nWould you like to download and install it?",
"Update Available");

if (await dialog.Show() == Dialog.BtnClicked.Yes)
{
await UpdateManager.DownloadAndInstallUpdateAsync(release);
}
}
}
catch (Exception ex)
{
Logger.WriteException($"Update check failed: {ex.Message}");
}
}
}
}
9 changes: 7 additions & 2 deletions Pages/AboutPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@
<StackPanel Orientation="Vertical" Padding="10">
<TextBlock Text="About" FontSize="24"/>
<controls:ApplicationInfo Margin="0 10 10 10" HorizontalAlignment="Left"/>
<TextBlock Text="Contributors" FontSize="24"/>
<ScrollViewer>

<TextBlock Text="Repository" FontSize="20" Margin="0 20 0 10"/>
<HyperlinkButton Content="View on GitHub" NavigateUri="https://github.com/WinDurango/WinDurango.UI" Margin="0 0 0 20"/>

<TextBlock Text="Contributors" FontSize="20" Margin="0 20 0 10"/>
<TextBlock Text="Loading contributors..." Name="loadingText" Margin="0 0 0 10" Opacity="0.7"/>
<ScrollViewer MaxHeight="400">
<StackPanel Name="contributorList" />
</ScrollViewer>
</StackPanel>
Expand Down
39 changes: 38 additions & 1 deletion Pages/AboutPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Microsoft.UI.Xaml.Media.Imaging;
using System;
using System.IO;
using System.Threading.Tasks;
using WinDurango.UI.Controls;
using WinDurango.UI.Utils;

Expand All @@ -14,7 +15,44 @@ public sealed partial class AboutPage : Page
public AboutPage()
{
this.InitializeComponent();
_ = LoadContributorsAsync();
}

private async Task LoadContributorsAsync()
{
try
{
// Load Locally saved contributors first
LoadLocalContributors();

// Now load from Github
var githubContributors = await GitHubContributorManager.GetUIContributorsAsync();
if (githubContributors.Count > 0)
{
contributorList.Children.Clear();
foreach (var contributor in githubContributors)
{
if (contributor.type != "Bot") // Skip bot accounts
{
contributorList.Children.Add(new ContributorInfo(
contributor.login,
contributor.avatar_url,
contributor.html_url));
}
}
}

loadingText.Visibility = Microsoft.UI.Xaml.Visibility.Collapsed;
}
catch (Exception ex)
{
Logger.WriteException($"Failed to load GitHub contributors: {ex.Message}");
loadingText.Text = "Failed to load GitHub contributors, showing local data";
}
}

private void LoadLocalContributors()
{
if (File.Exists("Assets/contributors.txt"))
{
string[] lines = File.ReadAllLines("Assets/contributors.txt");
Expand All @@ -24,7 +62,6 @@ public AboutPage()
string name = info[0].Replace("WD_CONTRIB_SEMICOLON", ";");
string avatar = info[1].Replace("WD_CONTRIB_SEMICOLON", ";");
string link = info[2].Replace("WD_CONTRIB_SEMICOLON", ";");
string contributionCount = info[3];

contributorList.Children.Add(new ContributorInfo(name, avatar, link));
}
Expand Down
1 change: 1 addition & 0 deletions Pages/Settings/UiSettingsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<TextBlock Margin="0 5 0 5" Text="Other"/>
<ToggleSwitch OnContent="Enable debug logging" OffContent="Enable debug logging" Toggled="OnDebugLogToggled" Name="DebugLogToggle" Loaded="OnDebugLogToggleLoaded"/>
<Button Name="appdataButton" Margin="0 5 0 5" Click="OpenAppData">Open WinDurango AppData folder</Button>
<Button Name="updateButton" Margin="0 5 0 5" Click="CheckForUpdates">Check for Updates</Button>
</StackPanel>
</ScrollView>
</Page>
32 changes: 32 additions & 0 deletions Pages/Settings/UiSettingsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
using System;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using WinDurango.UI.Dialogs;
using WinDurango.UI.Settings;
using WinDurango.UI.Utils;


namespace WinDurango.UI.Pages.Settings
Expand Down Expand Up @@ -112,5 +115,34 @@ private void HorizontalScrollingToggle_Toggled(object sender, RoutedEventArgs e)
App.MainWindow.AppsListPage.SwitchScrollDirection(toggleSwitch.IsOn);
}
}

private async void CheckForUpdates(object sender, RoutedEventArgs e)
{
try
{
var release = await UpdateManager.CheckForUpdatesAsync();
if (release != null)
{
var dialog = new Confirmation(
$"Update {release.tag_name} is available!\n\n{release.body}\n\nWould you like to download and install it?",
"Update Available");

if (await dialog.Show() == Dialogs.Dialog.BtnClicked.Yes)
{
await UpdateManager.DownloadAndInstallUpdateAsync(release);
}
}
else
{
var noUpdateDialog = new NoticeDialog("You are already running the latest version.", "No Updates Available");
await noUpdateDialog.ShowAsync();
}
}
catch (Exception ex)
{
var errorDialog = new NoticeDialog($"Failed to check for updates: {ex.Message}", "Update Check Failed");
await errorDialog.ShowAsync();
}
}
}
}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ For building you'll need Visual Studio 2022 with the following:
- [X] Mod Manager
- [X] Scan for already installed EraOS/XUWP stuff
- [X] Allow for any existing installed package to be added to the applist
- [ ] Built in updater
- [ ] Controller support
- [X] Built in updater
- [X] Controller support
- [ ] Setup program (maybe MSIX?)
- [ ] Fitting place for extra xbox-specific info
- [ ] Resize content to fit to screen
Expand All @@ -30,7 +30,7 @@ For building you'll need Visual Studio 2022 with the following:
- [X] Fix UI load speed when loading a lot of packages on startup
- [X] Applist scrolling
- [X] Fix icon in the titlebar
- [ ] Repo contributors on the about screen
- [X] Repo contributors on the about screen
- [ ] Get Fluent Thin working
- [ ] Use InfoBar for many progress related things (such as registering package, etc)
- [ ] Add versioning to the InstalledPackages json (as in versioning the JSON file itself)
Expand Down
Loading