Skip to content

Commit

Permalink
Added an updater (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo-Peyronnet committed Mar 23, 2021
1 parent 98d93cf commit 0f77bb6
Show file tree
Hide file tree
Showing 11 changed files with 608 additions and 1 deletion.
8 changes: 7 additions & 1 deletion InternetTest/InternetTest.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31025.194
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InternetTest", "InternetTest\InternetTest.csproj", "{4AE91DB8-9CD8-47FA-B27B-C7E659300991}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InternetTest", "InternetTest\InternetTest.csproj", "{4AE91DB8-9CD8-47FA-B27B-C7E659300991}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xalyus Updater", "Xalyus Updater\Xalyus Updater.csproj", "{40F7B033-68D4-41C5-938C-EB818245BF6A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -15,6 +17,10 @@ Global
{4AE91DB8-9CD8-47FA-B27B-C7E659300991}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4AE91DB8-9CD8-47FA-B27B-C7E659300991}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4AE91DB8-9CD8-47FA-B27B-C7E659300991}.Release|Any CPU.Build.0 = Release|Any CPU
{40F7B033-68D4-41C5-938C-EB818245BF6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{40F7B033-68D4-41C5-938C-EB818245BF6A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{40F7B033-68D4-41C5-938C-EB818245BF6A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{40F7B033-68D4-41C5-938C-EB818245BF6A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
9 changes: 9 additions & 0 deletions InternetTest/Xalyus Updater/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Application x:Class="Xalyus_Updater.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Xalyus_Updater"
StartupUri="MainWindow.xaml">
<Application.Resources>

</Application.Resources>
</Application>
40 changes: 40 additions & 0 deletions InternetTest/Xalyus Updater/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
MIT License
Copyright (c) Léo Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace Xalyus_Updater
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
33 changes: 33 additions & 0 deletions InternetTest/Xalyus Updater/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
MIT License
Copyright (c) Léo Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
57 changes: 57 additions & 0 deletions InternetTest/Xalyus Updater/Global.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
MIT License
Copyright (c) Léo Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Xalyus_Updater
{
/// <summary>
/// A class that contains informations about the update status.
/// </summary>
public static class Global
{
/// <summary>
/// The progress of the update installation.
/// </summary>
public static int UpdateProgress { get; set; }

/// <summary>
/// The link of the file to be updated.
/// </summary>
public static string ZIPLink { get; set; }

/// <summary>
/// The directory where the file is downloaded.
/// </summary>
public static string Directory => AppDomain.CurrentDomain.BaseDirectory + @"\UpdatedInternetTestFiles.zip";

/// <summary>
/// The displayed message when the update is installed.
/// </summary>
public static string InstallMessage { get; set; }
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
213 changes: 213 additions & 0 deletions InternetTest/Xalyus Updater/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
<Window x:Class="Xalyus_Updater.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Xalyus_Updater"
mc:Ignorable="d"
Title="Xalyus Updater" Loaded="Window_Loaded" AllowsTransparency="True" Background="Transparent" Height="310" Width="549" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" WindowStyle="None">
<WindowChrome.WindowChrome>
<WindowChrome ResizeBorderThickness="10" CaptionHeight="25"/>
</WindowChrome.WindowChrome>

<Window.Resources>
<Style x:Key="TitleBarCloseButtonStyle" TargetType="Button">
<Setter Property="Foreground" Value="White" />
<Setter Property="Height" Value="32"/>
<Setter Property="Padding" Value="0" />
<Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border
x:Name="border"
Background="Transparent"
BorderThickness="0" CornerRadius="5"
SnapsToDevicePixels="true">
<ContentPresenter
x:Name="contentPresenter"
Margin="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Focusable="False"
RecognizesAccessKey="True" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="border" Property="Background" Value="Red" />
<Setter Property="Foreground" Value="DarkRed" />
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter TargetName="border" Property="Background" Value="Red" />
<Setter Property="Foreground" Value="DarkRed" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<SolidColorBrush x:Key="ProgressBar.Progress" Color="#FF06B025"/>
<SolidColorBrush x:Key="ProgressBar.Background" Color="#FFE6E6E6"/>
<SolidColorBrush x:Key="ProgressBar.Border" Color="#FFBCBCBC"/>
<Style x:Key="RoundedProgressBar" TargetType="{x:Type ProgressBar}">
<Setter Property="Foreground" Value="{StaticResource ProgressBar.Progress}"/>
<Setter Property="Background" Value="{StaticResource ProgressBar.Background}"/>
<Setter Property="BorderBrush" Value="{StaticResource ProgressBar.Border}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ProgressBar}">
<Grid x:Name="TemplateRoot">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Determinate"/>
<VisualState x:Name="Indeterminate">
<Storyboard RepeatBehavior="Forever">
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="Animation" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
<EasingDoubleKeyFrame KeyTime="0" Value="0.25"/>
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="0.25"/>
<EasingDoubleKeyFrame KeyTime="0:0:2" Value="0.25"/>
</DoubleAnimationUsingKeyFrames>
<PointAnimationUsingKeyFrames Storyboard.TargetName="Animation" Storyboard.TargetProperty="(UIElement.RenderTransformOrigin)">
<EasingPointKeyFrame KeyTime="0" Value="-0.5,0.5"/>
<EasingPointKeyFrame KeyTime="0:0:1" Value="0.5,0.5"/>
<EasingPointKeyFrame KeyTime="0:0:2" Value="1.5,0.5"/>
</PointAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border CornerRadius="5" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}"/>
<Rectangle x:Name="PART_Track"/>
<Grid x:Name="PART_Indicator" ClipToBounds="true" HorizontalAlignment="Left">
<Rectangle RadiusX="5" RadiusY="5" x:Name="Indicator" Fill="{TemplateBinding Foreground}"/>
<Rectangle RadiusX="5" RadiusY="5" x:Name="Animation" Fill="{TemplateBinding Foreground}" RenderTransformOrigin="0.5,0.5">
<Rectangle.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</Rectangle.RenderTransform>
</Rectangle>
</Grid>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="Orientation" Value="Vertical">
<Setter Property="LayoutTransform" TargetName="TemplateRoot">
<Setter.Value>
<RotateTransform Angle="-90"/>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsIndeterminate" Value="true">
<Setter Property="Visibility" TargetName="Indicator" Value="Collapsed"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>

<Border Margin="10" CornerRadius="10" Background="#FF000014">
<Border.Effect>
<DropShadowEffect Color="Gray" ShadowDepth="0" BlurRadius="15" Opacity="0.5"/>
</Border.Effect>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="35"/>
<RowDefinition/>
</Grid.RowDefinitions>

<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="10"/>
</Grid.ColumnDefinitions>

<Image Margin="7 0 -5 0" Name="AppLogo" Source="\Images\Xalyus Updater.png"/>
<TextBlock
Grid.Column="1"
Margin="10 0 0 0"
VerticalAlignment="Center"
FontSize="15"
Text="Xalyus Updater"
FontWeight="Bold"
Foreground="White">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding IsActive, RelativeSource={RelativeSource AncestorType=Window}}" Value="False">
<Setter Property="Foreground" Value="{DynamicResource WindowTitleBarInactiveText}" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<Button
Grid.Column="2"
Name="CloseBtn"
Click="CloseBtn_Click"
Style="{StaticResource TitleBarCloseButtonStyle}">
<Path
Width="46"
Height="32" Margin="0"
Data="M 18,11 27,20 M 18,20 27,11"
Stroke="{Binding Path=Foreground,
RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
StrokeThickness="1" />
</Button>

<Grid Grid.Row="1" Grid.ColumnSpan="4">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border Margin="10 5 10 5" Grid.Row="0" Height="103" Width="508" Background="#FF0A0A1E" CornerRadius="10">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>

<Image Grid.Column="0" Margin="15" Source="\Images\Xalyus Updater.png"/>
<StackPanel Margin="10 15 0 0" Grid.Column="1">
<TextBlock x:Name="TitleTxt" FontWeight="Bold" FontSize="20" Foreground="White" Text="InternetTest"/>
<TextBlock x:Name="DescriptionTxt" FontSize="15" TextWrapping="Wrap" Foreground="White" Text="InternetTest"/>
</StackPanel>
</Grid>
</Border>

<Border Margin="0" Grid.Row="1" Height="118" Width="508" Background="#FF0A0A1E" CornerRadius="10">
<Grid>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Margin="10 15 0 0" Grid.Column="1">
<TextBlock x:Name="DownloadTxt" TextAlignment="Center" FontWeight="Bold" FontSize="15" Foreground="White" Text="Download in progress"/>
<TextBlock x:Name="ProgressTxt" Margin="0 0 0 10" TextAlignment="Center" FontSize="15" Foreground="White" Text="0%"/>
<ProgressBar x:Name="Pgb" Style="{DynamicResource RoundedProgressBar}" BorderThickness="0" Height="10" Width="452" Background="#FF050519">
<ProgressBar.Foreground>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<LinearGradientBrush.RelativeTransform>
<TransformGroup>
<ScaleTransform CenterY="0.5" CenterX="0.5"/>
<SkewTransform CenterY="0.5" CenterX="0.5"/>
<RotateTransform Angle="-90" CenterY="0.5" CenterX="0.5"/>
<TranslateTransform/>
</TransformGroup>
</LinearGradientBrush.RelativeTransform>
<GradientStop Color="#C319FD" Offset="0"/>
<GradientStop Color="#4728FF" Offset="1"/>
</LinearGradientBrush>
</ProgressBar.Foreground>
</ProgressBar>
</StackPanel>
</Grid>
</Border>
</Grid>

</Grid>
</Border>
</Window>

0 comments on commit 0f77bb6

Please sign in to comment.