Skip to content

Commit

Permalink
Implement About Page
Browse files Browse the repository at this point in the history
  • Loading branch information
TrinityDevelopers committed Jun 9, 2020
1 parent 2d4aa24 commit d474845
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 9 deletions.
2 changes: 1 addition & 1 deletion ZenovaLauncher/Pages/ModsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
<ui:SimpleStackPanel Grid.Column="0" HorizontalAlignment="Left" Orientation="Horizontal">
<ui:SimpleStackPanel>
<TextBlock FontWeight="Bold" FontSize="16" Text="{Binding Name}" />
<TextBlock FontSize="12" Text="{Binding Description}" />
<TextBlock FontSize="12" Text="{Binding Description}" Foreground="{DynamicResource SystemControlPageTextBaseMediumBrush}" />
</ui:SimpleStackPanel>
</ui:SimpleStackPanel>
<ui:SimpleStackPanel x:Name="InteractButtons" Grid.Column="2" HorizontalAlignment="Right" Orientation="Horizontal" Spacing="8" Visibility="Hidden">
Expand Down
2 changes: 1 addition & 1 deletion ZenovaLauncher/Pages/PlayPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
<DataTemplate>
<ui:SimpleStackPanel Spacing="4">
<TextBlock FontWeight="Bold" FontSize="14" Text="{Binding Path=Name}" />
<TextBlock FontSize="10" Text="{Binding Path=VersionName}" />
<TextBlock FontSize="10" Text="{Binding Path=VersionName}" Foreground="{DynamicResource SystemControlPageTextBaseMediumBrush}" />
</ui:SimpleStackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
Expand Down
2 changes: 1 addition & 1 deletion ZenovaLauncher/Pages/ProfilesPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
<ui:SimpleStackPanel Grid.Column="0" HorizontalAlignment="Left" Orientation="Horizontal">
<ui:SimpleStackPanel>
<TextBlock FontWeight="Bold" FontSize="16" Text="{Binding Path=Name}" />
<TextBlock FontSize="12" Text="{Binding Path=VersionName}" />
<TextBlock FontSize="12" Text="{Binding Path=VersionName}" Foreground="{DynamicResource SystemControlPageTextBaseMediumBrush}" />
</ui:SimpleStackPanel>
</ui:SimpleStackPanel>
<ui:SimpleStackPanel x:Name="InteractButtons" Grid.Column="2" HorizontalAlignment="Right" Orientation="Horizontal" Spacing="8" Visibility="Hidden">
Expand Down
23 changes: 22 additions & 1 deletion ZenovaLauncher/Pages/SettingsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,28 @@
<TextBlock Text="Accounts Settings" />
</control:MyTabItem>
<control:MyTabItem Header="About">
<TextBlock Text="About Launcher" />
<Grid Margin="63,21,63,0">
<ItemsControl x:Name="AboutPanel" HorizontalAlignment="Stretch">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Height="118">
<Separator x:Name="Separator" VerticalAlignment="Top" Background="{DynamicResource AppBarSeparatorLowForeground}" />
<ui:SimpleStackPanel Spacing="4" VerticalAlignment="Center">
<TextBlock FontSize="17" FontWeight="Bold" Text="{Binding Path=RepositoryName}" />
<TextBlock FontSize="12" Text="{Binding Path=InstalledVersionString}" Foreground="{DynamicResource SystemControlPageTextBaseMediumBrush}" />
<TextBlock FontSize="12" Text="{Binding Path=PublishDateString}" Foreground="{DynamicResource SystemControlPageTextBaseMediumBrush}" />
<TextBlock FontSize="12" Text="{Binding Path=CommitHashString}" Foreground="{DynamicResource SystemControlPageTextBaseMediumBrush}" />
</ui:SimpleStackPanel>
</Grid>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource PreviousData}}" Value="{x:Null}">
<Setter Property="Visibility" TargetName="Separator" Value="Collapsed"/>
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</control:MyTabItem>
</control:LauncherTabControl>
</Grid>
Expand Down
11 changes: 10 additions & 1 deletion ZenovaLauncher/Pages/SettingsPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Windows;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Controls;

namespace ZenovaLauncher
Expand All @@ -8,6 +9,8 @@ namespace ZenovaLauncher
/// </summary>
public partial class SettingsPage : Page
{
private ObservableCollection<ZenovaUpdater.AssemblyType> Assemblies = new ObservableCollection<ZenovaUpdater.AssemblyType>();

public SettingsPage()
{
InitializeComponent();
Expand All @@ -16,6 +19,12 @@ public SettingsPage()
FreeSpaceBox.DataContext = Preferences.instance;
DebugBox.DataContext = Preferences.instance;
UpdateBox.DataContext = Preferences.instance;

Assemblies.Add(ZenovaUpdater.InstallerAssembly);
Assemblies.Add(ZenovaUpdater.ApiAssembly);
Assemblies.Add(ZenovaUpdater.LoaderAssembly);

AboutPanel.ItemsSource = Assemblies;
}

private void FreeSpaceClick(object sender, RoutedEventArgs e)
Expand Down
4 changes: 2 additions & 2 deletions ZenovaLauncher/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1.2")]
[assembly: AssemblyFileVersion("1.0.1.2")]
[assembly: AssemblyVersion("1.0.1.3")]
[assembly: AssemblyFileVersion("1.0.1.3")]
10 changes: 8 additions & 2 deletions ZenovaLauncher/Utils/ZenovaUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Reflection;
using System.Threading;
Expand Down Expand Up @@ -118,8 +119,8 @@ public async Task<bool> CheckUpdate(AssemblyType type)
{
try
{
var releases = await Client.Repository.Release.GetAll("MinecraftZenova", type.RepositoryName);
type.LatestRelease = releases[0];
type.LatestRelease = await Client.Repository.Release.GetLatest("MinecraftZenova", type.RepositoryName);
type.TagInfo = (await Client.Repository.GetAllTags("MinecraftZenova", type.RepositoryName)).FirstOrDefault(x => x.Name == type.LatestRelease.TagName);

if (type.InstalledVersion == null)
return true;
Expand Down Expand Up @@ -206,6 +207,7 @@ public class AssemblyType
private Version _installedVersion;
public string RepositoryName { get; set; }
public Release LatestRelease { get; set; }
public RepositoryTag TagInfo { get; set; }
public GetDLPath DownloadPath { get; set; }
public PostDownload PostDownloadTask { get; set; }
public Version InstalledVersion
Expand Down Expand Up @@ -234,6 +236,10 @@ private static Version GetVersionFromPath(string path)
}
return null;
}

public string InstalledVersionString => InstalledVersion.ToString();
public string PublishDateString => LatestRelease?.PublishedAt.Value.DateTime.ToString("dddd, MMMM dd, yyyy, HH:mm:ss");
public string CommitHashString => TagInfo.Commit.Sha;
}
}
}

0 comments on commit d474845

Please sign in to comment.