Skip to content

Commit

Permalink
fadein/out and firstusage message
Browse files Browse the repository at this point in the history
  • Loading branch information
DefKorns committed Sep 10, 2020
1 parent afde63c commit aa7d98b
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 5 deletions.
1 change: 1 addition & 0 deletions AppUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public static class AppUtils
public static readonly string decompilerPath = Path.Combine("modules", "decompiler");
public static readonly string decompilerScript = Path.Combine(decompilerPath, "main.py");
public static readonly string decodedHashFile = Path.Combine("lib", "hashes");
public static readonly string firstRun = Path.Combine("lib", "firstRun");
public static readonly string batFile = "encode.bat";

public static void CopyAssets(string sourceFolder, string destFolder)
Expand Down
10 changes: 10 additions & 0 deletions MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 39 additions & 4 deletions MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Text.RegularExpressions;
using System.Threading;
using System.Diagnostics;
using System.Threading.Tasks;

namespace SNESMiniLuaCompiler
{
Expand All @@ -17,7 +18,6 @@ public partial class MainForm : Form
private bool ActiveButton { get; set; }
delegate void SetButtonCallback(Button button);


public MainForm()
{

Expand All @@ -26,6 +26,12 @@ public MainForm()
DoubleBuffered = true;
picLoader.Visible = false;

if (File.Exists(AppUtils.firstRun))
{
MsgBox.Show("Make sure you have python 3.x installed!\n\nPlease download it from python.org", "Requirement", MsgBox.ButtonType.OK, MsgBox.Ico.Application, MsgBox.AnimateStyle.FadeIn);
File.Delete(AppUtils.firstRun);
}

SetStyle(ControlStyles.ResizeRedraw, true);

if (!ActiveButton)
Expand Down Expand Up @@ -65,15 +71,44 @@ private void Title_Header_MouseMove(object sender, MouseEventArgs e)
/// </summary>
private void App_Exit_MouseClick(object sender, MouseEventArgs e)
{
DialogResult dialog = MsgBox.Show("Are you sure you want to exit?", "Exit application", MsgBox.ButtonType.YesNo, MsgBox.Ico.Warning);
DialogResult dialog = MsgBox.Show("Are you sure you want to exit?", "Exit application", MsgBox.ButtonType.YesNo, MsgBox.Ico.Warning, MsgBox.AnimateStyle.FadeIn);

if (dialog == DialogResult.Yes)
{
Environment.ExitCode = 1;
Application.Exit();
fadeOutTimer.Start();
}

}

private void MainForm_Load(object sender, EventArgs e)
{
Opacity = 0;
fadeInTimer.Interval = 20;
fadeInTimer.Tick += new EventHandler(FadeIn);
fadeInTimer.Start();
}

void FadeIn(object sender, EventArgs e)
{
if (Opacity >= 1)
fadeInTimer.Stop();
else
Opacity += 0.05;
}

private void FadeOutTimer_Tick(object sender, EventArgs e)
{
fadeOutTimer.Interval = 20;
if (Opacity > 0.0)
{
Opacity -= 0.05;
}
else
{
fadeOutTimer.Stop();
Application.Exit();
}
}
/// <summary>
/// Acts as angular disable atribute
/// </summary>
Expand Down
6 changes: 6 additions & 0 deletions MainForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="fadeOutTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="fadeInTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>144, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
Expand Down
2 changes: 1 addition & 1 deletion Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.1.0")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: NeutralResourcesLanguage("en")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
Empty file added lib/firstRun
Empty file.

0 comments on commit aa7d98b

Please sign in to comment.