Skip to content

Commit

Permalink
Add a link to the enrollment EULA in the enrollment window
Browse files Browse the repository at this point in the history
  • Loading branch information
vanessagertman committed Apr 26, 2017
1 parent 1f56a9c commit 7ada9a5
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/Magpie/Magpie/Models/Channel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public class Channel
[DataMember(Name = "requires_enrollment", IsRequired = false)]
public bool RequiresEnrollment { get; private set; }

[DataMember(Name = "enrollment_eula_url", IsRequired = false)]
public string EnrollmentEulaUrl { get; private set; }

// Dates example:
// e.g. January 30, 2015 18:15:00 +0200
// 10/03/2015
Expand Down
12 changes: 12 additions & 0 deletions src/Magpie/Magpie/ViewModels/EnrollmentViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ internal class EnrollmentViewModel : BindableBase
private readonly Enrollment _enrollment;
private string _channelName;
private string _appIconPath;
private string _enrollmentEulaUrl;

public string AppIconPath
{
Expand Down Expand Up @@ -46,13 +47,24 @@ public string ChannelName
}
}

public string EnrollmentEulaUrl
{
get { return _enrollmentEulaUrl; }
set
{
_enrollmentEulaUrl = value;
SetProperty(ref _enrollmentEulaUrl, value);
}
}

public DelegateCommand EnrollCommand { get; set; }

public EnrollmentViewModel(Enrollment enrollment, AppInfo appInfo)
{
_enrollment = enrollment;
AppIconPath = appInfo.AppIconPath;
ChannelName = _enrollment.Channel.Build;
EnrollmentEulaUrl = _enrollment.Channel.EnrollmentEulaUrl;
EnrollCommand = new DelegateCommand(EnrollCommandHandler, CanEnroll);
}

Expand Down
9 changes: 7 additions & 2 deletions src/Magpie/Magpie/Views/EnrollmentWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,13 @@
<TextBlock Grid.Row="2" Margin="10 5 10 10"
FontSize="13"
Foreground="#555"
Text="By enrolling in this program you agree with our EULA."
TextWrapping="Wrap" />
Text="By enrolling in this program you agree with our "
TextWrapping="Wrap">
<Hyperlink NavigateUri="{Binding EnrollmentEulaUrl}"
RequestNavigate="NavigateUri">
<Run Text="EULA"/>
</Hyperlink>
</TextBlock>
<Border Grid.Row="3"
Margin="0 10 0 0"
BorderBrush="Silver"
Expand Down
11 changes: 10 additions & 1 deletion src/Magpie/Magpie/Views/EnrollmentWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
namespace MagpieUpdater.Views
using System.Diagnostics;
using System.Windows.Navigation;

namespace MagpieUpdater.Views
{
public partial class EnrollmentWindow
{
Expand All @@ -12,5 +15,11 @@ private void CloseWindow(object sender, System.Windows.RoutedEventArgs e)
{
Close();
}

private void NavigateUri(object sender, RequestNavigateEventArgs e)
{
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
e.Handled = true;
}
}
}

0 comments on commit 7ada9a5

Please sign in to comment.