Skip to content

Commit

Permalink
Merge branch 'preview' into releases/preview
Browse files Browse the repository at this point in the history
  • Loading branch information
SaviorXTanren committed Jun 20, 2020
2 parents 2d4cd02 + 3d4cae3 commit bb8185c
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 17 deletions.
6 changes: 6 additions & 0 deletions MixItUp.Base/Model/API/MixItUpUpdateModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ public class MixItUpUpdateModel
[JsonProperty]
public string ZipArchiveLink { get; set; }

[JsonProperty]
public string InstallerLink { get; set; }

[JsonIgnore]
public Version SystemVersion { get { return new Version(this.Version); } }

[JsonIgnore]
public bool IsPreview { get { return this.SystemVersion.Revision > 1000; } }
}
}
48 changes: 33 additions & 15 deletions MixItUp.WPF/UpdateWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
TextElement.FontSize="14"
FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto"

Title="Mix It Up - Update Available" Height="550" Width="600">
Title="Mix It Up - Update Available" Height="650" Width="600">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
Expand All @@ -38,24 +38,42 @@
</Grid.RowDefinitions>

<TextBlock Grid.Row="0" HorizontalAlignment="Center">A new update is available for Mix It Up!</TextBlock>

<Grid Grid.Row="2" HorizontalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="80" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<Grid Grid.Row="0" HorizontalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="80" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>

<TextBlock Grid.Column="0" VerticalAlignment="Center">New Version:</TextBlock>
<TextBlock Grid.Column="2" x:Name="NewVersionTextBlock" VerticalAlignment="Center" />

<TextBlock Grid.Column="4" VerticalAlignment="Center">Current Version:</TextBlock>
<TextBlock Grid.Column="6" x:Name="CurrentVersionTextBlock" VerticalAlignment="Center" />
</Grid>

<TextBlock Grid.Column="0" VerticalAlignment="Center">New Version:</TextBlock>
<TextBlock Grid.Column="2" x:Name="NewVersionTextBlock" VerticalAlignment="Center" />
<Grid Grid.Row="1" x:Name="PreviewUpdateGrid" Visibility="Collapsed" Margin="10,10,10,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="10" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<TextBlock Grid.Column="4" VerticalAlignment="Center">Current Version:</TextBlock>
<TextBlock Grid.Column="6" x:Name="CurrentVersionTextBlock" VerticalAlignment="Center" />
<TextBlock Grid.Row="0" TextWrapping="Wrap" Foreground="Red">IMPORTANT NOTICE: Preview updates are an opportunity to help test features early and report issues. They receive some amount of testing before they are released, but not the same amount given to public updates.</TextBlock>

<TextBlock Grid.Row="2" TextWrapping="Wrap" Foreground="Red">We encourage you backup of your settings first by clicking Skip below, then going to Settings -> Advanced. If you do not want to take this update, please click Skip below and optionally disable the Preview Program under the Settings -> General.</TextBlock>
</Grid>
</Grid>

<WebBrowser Grid.Row="4" x:Name="UpdateChangelogWebBrowser" Margin="20,0" ScrollViewer.VerticalScrollBarVisibility="Visible" />
Expand Down
11 changes: 9 additions & 2 deletions MixItUp.WPF/UpdateWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using MixItUp.WPF.Windows;
using StreamingClient.Base.Util;
using System;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Net.Http;
Expand All @@ -18,6 +17,8 @@ namespace MixItUp.WPF
/// </summary>
public partial class UpdateWindow : LoadingWindowBase
{
private const string DefaultInstallerLink = "https://github.com/SaviorXTanren/mixer-mixitup/releases/download/Installer-0.3.0/MixItUp-Setup.exe";

private MixItUpUpdateModel update;

public UpdateWindow(MixItUpUpdateModel update)
Expand All @@ -34,6 +35,11 @@ protected override async Task OnLoaded()
this.NewVersionTextBlock.Text = this.update.Version.ToString();
this.CurrentVersionTextBlock.Text = Assembly.GetEntryAssembly().GetName().Version.ToString();

if (this.update.IsPreview)
{
this.PreviewUpdateGrid.Visibility = Visibility.Visible;
}

try
{
using (HttpClient client = new HttpClient())
Expand Down Expand Up @@ -61,7 +67,8 @@ await this.RunAsyncOperation(async () =>
downloadComplete = true;
};

client.DownloadFileAsync(new Uri("https://github.com/SaviorXTanren/mixer-mixitup/releases/download/Installer-0.3.0/MixItUp-Setup.exe"), setupFilePath);
string installerLink = (!string.IsNullOrEmpty(this.update.InstallerLink)) ? this.update.InstallerLink : DefaultInstallerLink;
client.DownloadFileAsync(new Uri(installerLink), setupFilePath);

while (!downloadComplete)
{
Expand Down

0 comments on commit bb8185c

Please sign in to comment.