Skip to content

Commit

Permalink
Splash screen during WZ loading
Browse files Browse the repository at this point in the history
  • Loading branch information
lastbattle committed Dec 8, 2019
1 parent 84e46d5 commit 402ee24
Show file tree
Hide file tree
Showing 12 changed files with 387 additions and 177 deletions.
2 changes: 1 addition & 1 deletion HaRepacker/GUI/AboutForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ Copyright (C) 2009-2015 haha01haha01</value>
<value>5</value>
</data>
<data name="label5.Text" xml:space="preserve">
<value>Forked by LastBattle. https://github.com/eaxvac</value>
<value>Forked. https://github.com/lastbattle</value>
</data>
<data name="label5.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleCenter</value>
Expand Down
38 changes: 21 additions & 17 deletions HaRepacker/GUI/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,12 @@
using System.Drawing;
using System.Windows.Forms;
using System.IO;
using System.Text.RegularExpressions;
using Footholds;
using MapleLib.WzLib;
using MapleLib.WzLib.WzProperties;
using MapleLib.WzLib.Serialization;
using System.Threading;
using HaRepacker.GUI.Interaction;
using MapleLib.WzLib.Util;
using System.Runtime.InteropServices;
using MapleLib.WzLib.WzStructure;
using System.Net;
using System.Text;
using System.Diagnostics;
Expand All @@ -29,7 +25,6 @@
using Win32;
using HaRepacker.GUI.Panels;
using HaRepacker.GUI.Input;
using HaRepacker.Configuration;

namespace HaRepacker.GUI
{
Expand Down Expand Up @@ -484,7 +479,7 @@ private void encryptionBox_SelectedIndexChanged(object sender, EventArgs e)
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void openToolStripMenuItem_Click(object sender, EventArgs e)
private async void openToolStripMenuItem_Click(object sender, EventArgs e)
{
using (OpenFileDialog dialog = new OpenFileDialog()
{
Expand Down Expand Up @@ -562,23 +557,32 @@ private void openToolStripMenuItem_Click(object sender, EventArgs e)
}
}

Dispatcher currentDispatcher = Dispatcher.CurrentDispatcher;
// Show splash screen
MainPanel.OnSetPanelLoading();

//
Dispatcher currentDispatcher = Dispatcher.CurrentDispatcher;
// Load all original WZ files
Parallel.ForEach(wzfilePathsToLoad, filePath =>
await Task.Run(() =>
{
WzFile f = Program.WzMan.LoadWzFile(filePath, MapleVersionEncryptionSelected, MainPanel, currentDispatcher);
if (f == null)
Parallel.ForEach(wzfilePathsToLoad, filePath =>
{
WzFile f = Program.WzMan.LoadWzFile(filePath, MapleVersionEncryptionSelected, MainPanel, currentDispatcher);
if (f == null)
{
errorOpeningFile_Admin = true;
}
});
// error opening one of the files
if (errorOpeningFile_Admin)
{
errorOpeningFile_Admin = true;
MessageBox.Show(HaRepacker.Properties.Resources.MainFileOpenFail, HaRepacker.Properties.Resources.Error);
}
});
}); // load complete

// error opening one of the files
if (errorOpeningFile_Admin)
{
MessageBox.Show(HaRepacker.Properties.Resources.MainFileOpenFail, HaRepacker.Properties.Resources.Error);
}
// Hide panel splash sdcreen
MainPanel.OnSetPanelLoadingCompleted();
}
}

Expand Down
Loading

0 comments on commit 402ee24

Please sign in to comment.