Skip to content

Commit

Permalink
Remove end sleep
Browse files Browse the repository at this point in the history
* Remove the unnecessary sleep at the end of the update sequence
* UI formatting
  • Loading branch information
rex706 committed Jun 30, 2023
1 parent a79cc5c commit a89ce14
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Updater/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<Label x:Name="labelPerc" Content="" Margin="10,10,10,0" VerticalAlignment="Top" HorizontalContentAlignment="Center" Height="23" />
</Grid>
<Grid Margin="0,59,0,0">
<TextBox x:Name="ConsoleBox" IsReadOnly="True" TextWrapping="Wrap" ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.CanContentScroll="True" ScrollViewer.HorizontalScrollBarVisibility="Auto" Background="#FF191919" Foreground="#FFF1F1F1" Text="" Margin="10,10,10,10" TextChanged="ConsoleBox_TextChanged"/>
<TextBox x:Name="ConsoleBox" IsReadOnly="True" ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.CanContentScroll="True" ScrollViewer.HorizontalScrollBarVisibility="Auto" Background="#FF191919" Foreground="#FFF1F1F1" Text="" Margin="10,10,10,10" TextChanged="ConsoleBox_TextChanged" FontSize="11"/>
</Grid>
</Grid>
</Window>
15 changes: 5 additions & 10 deletions Updater/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ private async void Update(string executable, List<Download> downloads)
}

Dispatcher.Invoke(() => { ConsoleBox.AppendText("Update complete!\n"); });
//MessageBox.Show("Update complete!");

// First argument is the program to be opened when the update is complete.
if (executable != null && executable.Length > 1 && executable.Contains(".exe"))
Expand All @@ -188,11 +187,10 @@ private async void Update(string executable, List<Download> downloads)
}
}

Dispatcher.Invoke(() => { ConsoleBox.AppendText("Closing updater . . . \n"); });

Thread.Sleep(sleep);

Dispatcher.Invoke(() => { Close(); });
Dispatcher.Invoke(() => {
ConsoleBox.AppendText("Closing updater . . . \n");
Close();
});
}

public async Task DownloadFile(string urlAddress, string fileName)
Expand Down Expand Up @@ -234,10 +232,7 @@ public async Task DownloadFile(string urlAddress, string fileName)
// Start the stopwatch which will be used to calculate the download speed.
sw.Start();

Dispatcher.Invoke(() =>
{
ConsoleBox.AppendText("Downloading '" + fileName + "' . . .\n");
});
Dispatcher.Invoke(() => { ConsoleBox.AppendText("Downloading '" + fileName + "' . . .\n"); });

// Start downloading the file.
await webClient.DownloadFileTaskAsync(URL, path);
Expand Down

0 comments on commit a89ce14

Please sign in to comment.