Skip to content

Commit

Permalink
Auto updater.
Browse files Browse the repository at this point in the history
  • Loading branch information
rembound committed May 13, 2016
1 parent 17bc0b5 commit e35b4e9
Show file tree
Hide file tree
Showing 12 changed files with 546 additions and 71 deletions.
6 changes: 6 additions & 0 deletions ArenaHelper.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArenaHelper", "ArenaHelper.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestPlugin", "TestPlugin\TestPlugin.csproj", "{9DBE89DA-8673-4657-A0DC-EC1F26C70B8A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Updater", "Updater\Updater.csproj", "{BA9680FE-9A15-4AC1-B218-511D1EA691FA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -21,6 +23,10 @@ Global
{9DBE89DA-8673-4657-A0DC-EC1F26C70B8A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9DBE89DA-8673-4657-A0DC-EC1F26C70B8A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9DBE89DA-8673-4657-A0DC-EC1F26C70B8A}.Release|Any CPU.Build.0 = Release|Any CPU
{BA9680FE-9A15-4AC1-B218-511D1EA691FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BA9680FE-9A15-4AC1-B218-511D1EA691FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BA9680FE-9A15-4AC1-B218-511D1EA691FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BA9680FE-9A15-4AC1-B218-511D1EA691FA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
43 changes: 37 additions & 6 deletions ArenaWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,53 @@
<!-- About -->
<controls:Flyout x:Name="FlyoutAbout" Header="About" CloseButtonVisibility="Collapsed" Position="Left" Width="400">
<StackPanel Margin="5">
<TextBlock Margin="10,5,10,15" FontWeight="SemiBold" TextWrapping="Wrap">
<Run Text="Thank you for using my plugin! Arena Helper " /><Run Text="{Binding StringVersion, Mode=OneWay}" /><Run Text=" was made by " /><Hyperlink NavigateUri="{Binding StringWebsite}" RequestNavigate="Hyperlink_RequestNavigate" Style="{StaticResource HyperlinkAboutStyle}">Rembound</Hyperlink>
<TextBlock Margin="10,5,10,15" FontWeight="SemiBold" FontSize="13" TextWrapping="Wrap">
<Run Text="Arena Helper " /><Run Text="{Binding StringVersion, Mode=OneWay}" /><Run Text=" was made by " /><Hyperlink NavigateUri="{Binding StringWebsite}" RequestNavigate="Hyperlink_RequestNavigate" Style="{StaticResource HyperlinkAboutStyle}">Rembound</Hyperlink>
<Run Text="with support from the community at GitHub." />
<Run Text="Thanks go out to Grinning Goat for providing " /><Hyperlink NavigateUri="{Binding StringTierList}" RequestNavigate="Hyperlink_RequestNavigate" Style="{StaticResource HyperlinkAboutStyle}">Hearthstone Arena Tier List</Hyperlink><Run Text="!" />
<LineBreak /><LineBreak />
<Hyperlink NavigateUri="{Binding StringDonate}" RequestNavigate="Hyperlink_RequestNavigate" Style="{StaticResource HyperlinkAboutStyle}">Donations</Hyperlink>
<Run Text="are greatly appreciated. Thanks for your support!" />
<Run Text="Thanks for your support! Any " /><Hyperlink NavigateUri="{Binding StringDonate}" RequestNavigate="Hyperlink_RequestNavigate" Style="{StaticResource HyperlinkAboutStyle}">donation</Hyperlink><Run Text=" is greatly appreciated." />
</TextBlock>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Button Name="AboutDonate" Content="donate" Width="60" Margin="0,0,0,0" Height="30" Style="{DynamicResource AccentedSquareButtonStyle}" Click="AboutDonate_Click"/>
<Button Name="AboutVisitWebsite" Content="rembound.com" Margin="10,0,0,0" Width="100" Height="30" Style="{DynamicResource AccentedSquareButtonStyle}" Click="AboutVisitWebsite_Click"/>
<Button Name="AboutVisitGitHub" Content="github" Width="60" Margin="10,0,0,0" Height="30" Style="{DynamicResource AccentedSquareButtonStyle}" Click="AboutVisitGitHub_Click"/>
<Button Name="AboutVisitWebsite" Content="rembound.com" Margin="10,0,0,0" Width="100" Height="30" Style="{DynamicResource SquareButtonStyle}" Click="AboutVisitWebsite_Click"/>
<Button Name="AboutVisitGitHub" Content="github" Width="60" Margin="10,0,0,0" Height="30" Style="{DynamicResource SquareButtonStyle}" Click="AboutVisitGitHub_Click"/>
<Button Name="AboutButtonClose" Content="close" Width="60" Margin="10,0,0,0" Height="30" Style="{DynamicResource SquareButtonStyle}" Click="AboutButtonClose_Click"/>
</StackPanel>
</StackPanel>
</controls:Flyout>

<!-- Update -->
<controls:Flyout x:Name="FlyoutUpdate" Header="Update available!" CloseButtonVisibility="Collapsed" Position="Left" Width="400">
<StackPanel Margin="5">
<TextBlock Margin="10,5,10,15" FontWeight="SemiBold" FontSize="13" TextWrapping="Wrap">
<Run Text="Press &quot;download&quot; to automatically download and install the new update. This will restart Hearthstone Deck Tracker." />
</TextBlock>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Button Name="UpdateDownload" Content="download" Width="70" Margin="0,0,0,0" Height="30" Style="{DynamicResource AccentedSquareButtonStyle}" Click="UpdateDownload_Click"/>
<Button Name="UpdateWebsite" Content="website" Margin="10,0,0,0" Width="70" Height="30" Style="{DynamicResource SquareButtonStyle}" Click="UpdateWebsite_Click"/>
<Button Name="UpdateClose" Content="close" Width="70" Margin="10,0,0,0" Height="30" Style="{DynamicResource SquareButtonStyle}" Click="UpdateClose_Click"/>
</StackPanel>
</StackPanel>
</controls:Flyout>

<!-- Data Update -->
<controls:Flyout x:Name="FlyoutDataUpdate" Header="Data update applied!" CloseButtonVisibility="Collapsed" Position="Left" Width="400">
<StackPanel Margin="5">
<TextBlock Margin="10,5,10,15" FontWeight="SemiBold" FontSize="13" TextWrapping="Wrap">
<Run Text="The tier list and card data was updated to the latest version." />
<Run Text="More info about the tier list can be found at: " /><Hyperlink NavigateUri="{Binding StringTierList}" RequestNavigate="Hyperlink_RequestNavigate" Style="{StaticResource HyperlinkAboutStyle}">Hearthstone Arena Tier List</Hyperlink>
<LineBreak /><LineBreak />
<Run Text="Thanks for your support! Any " /><Hyperlink NavigateUri="{Binding StringDonate}" RequestNavigate="Hyperlink_RequestNavigate" Style="{StaticResource HyperlinkAboutStyle}">donation</Hyperlink><Run Text=" is greatly appreciated." />
</TextBlock>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Button Name="DataUpdateDonate" Content="donate" Width="60" Margin="0,0,0,0" Height="30" Style="{DynamicResource AccentedSquareButtonStyle}" Click="AboutDonate_Click"/>
<Button Name="DataUpdateWebsite" Content="rembound.com" Margin="10,0,0,0" Width="100" Height="30" Style="{DynamicResource SquareButtonStyle}" Click="AboutVisitWebsite_Click"/>
<Button Name="DataUpdateGitHub" Content="github" Width="60" Margin="10,0,0,0" Height="30" Style="{DynamicResource SquareButtonStyle}" Click="AboutVisitGitHub_Click"/>
<Button Name="DataUpdateClose" Content="close" Width="60" Margin="10,0,0,0" Height="30" Style="{DynamicResource SquareButtonStyle}" Click="DataUpdateClose_Click"/>
</StackPanel>
</StackPanel>
</controls:Flyout>
</controls:FlyoutsControl>
</controls:MetroWindow.Flyouts>

Expand Down
29 changes: 29 additions & 0 deletions ArenaWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public partial class ArenaWindow
public OnCheckbox oncheckboxautosave = null;
public OnCheckbox oncheckboxdebug = null;

public OnEvent onupdatedownloadclick = null;

public bool initconfig = false;

public ArenaWindow()
Expand Down Expand Up @@ -152,6 +154,7 @@ private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e
Process.Start(e.Uri.AbsoluteUri);
}

// About
private void AboutDonate_Click(object sender, RoutedEventArgs e)
{
Process.Start(StringDonate);
Expand All @@ -172,6 +175,32 @@ private void AboutButtonClose_Click(object sender, RoutedEventArgs e)
FlyoutAbout.IsOpen = false;
}

// Update
private void UpdateDownload_Click(object sender, RoutedEventArgs e)
{
if (onupdatedownloadclick != null)
{
onupdatedownloadclick();
}
}

private void UpdateWebsite_Click(object sender, RoutedEventArgs e)
{
Process.Start(StringGitHub);
}

private void UpdateClose_Click(object sender, RoutedEventArgs e)
{
FlyoutUpdate.IsOpen = false;
}

// Data update
private void DataUpdateClose_Click(object sender, RoutedEventArgs e)
{
FlyoutDataUpdate.IsOpen = false;
}


private void ButtonNewArena_Click(object sender, RoutedEventArgs e)
{
if (onbuttonnewarenaclick != null)
Expand Down
Loading

0 comments on commit e35b4e9

Please sign in to comment.