Skip to content

Commit

Permalink
close button
Browse files Browse the repository at this point in the history
  • Loading branch information
okkdev committed Aug 3, 2021
1 parent a29a4b3 commit c12ec74
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
7 changes: 6 additions & 1 deletion MeltyInstaller/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,13 @@
</Border>

<ProgressBar x:Name="progressBar" Grid.Row="11" Height="20" />
<Button x:Name="install" Content="Install" Grid.Row="12" Height="25" Width="80" HorizontalAlignment="Right" Click="install_Click" />


<StackPanel Grid.Row="12" Orientation="Horizontal" HorizontalAlignment="Right">

<Button x:Name="install" Content="Install" Height="25" Width="80" Click="install_Click" Margin="0,0,10,0" />
<Button x:Name="close" Content="Close" Height="25" Width="80" Click="close_Click" />
</StackPanel>
</Grid>
</Grid>
</Window>
11 changes: 9 additions & 2 deletions MeltyInstaller/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ private async void Install()

progressBar.Value = 100;

PrintLog("---------------------");
PrintLog("DONE!");
close.Content = "Done";
}

// Modified code from https://www.tugberkugurlu.com/archive/efficiently-streaming-large-http-responses-with-httpclient
Expand Down Expand Up @@ -162,14 +164,14 @@ private Task UnzipFile(string fileName)
{
string completePath = Path.Join(path, fileName);

if (fileName.Contains(".exe"))
if (!fileName.Contains(".zip"))
{
return Task.CompletedTask;
}

PrintLog($"Starting Unzip of: {fileName}");

ZipFile.ExtractToDirectory(completePath, path);
ZipFile.ExtractToDirectory(completePath, path, true);

progressBar.Value += 10;

Expand All @@ -181,5 +183,10 @@ private Task UnzipFile(string fileName)

return Task.CompletedTask;
}

private void close_Click(object sender, RoutedEventArgs e)
{
Application.Current.MainWindow.Close();
}
}
}

0 comments on commit c12ec74

Please sign in to comment.