Skip to content
This repository has been archived by the owner on Dec 31, 2024. It is now read-only.

Commit

Permalink
Closing alert
Browse files Browse the repository at this point in the history
  • Loading branch information
EndermanPC committed Jul 9, 2024
1 parent 1f8bc14 commit c021e2a
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 3 deletions.
14 changes: 14 additions & 0 deletions Create.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

using Microsoft.ML.Runtime;
using System.ComponentModel;
using System.Diagnostics;
using System.IO.Compression;
using System.Management;
Expand All @@ -24,6 +25,7 @@ public Create()
private async void button1_Click(object sender, EventArgs e)
{
button1.Enabled = false;
this.Closing += OnClosing;
try
{
Directory.CreateDirectory($"projects\\{textBox1.Text}");
Expand Down Expand Up @@ -242,5 +244,17 @@ private Task UpdateProgressBarAsync(int value)
}
});
}

private void OnClosing(object sender, CancelEventArgs cancelEventArgs)
{
string msg = "Do you want to exit Trainer Studio?";
DialogResult result = MessageBox.Show(msg, "Close Confirmation",
MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
Application.Exit();
else if (result == DialogResult.No)
cancelEventArgs.Cancel = false;

}
}
}
16 changes: 16 additions & 0 deletions Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* Author: Bui Nguyen Tan Sang <[email protected]>
*/

using System.ComponentModel;

namespace Lithicsoft_Trainer
{
public partial class Main : Form
Expand All @@ -16,6 +18,8 @@ public Main(string projectName, string projectLanguage, string ProjectType)
{
InitializeComponent();

this.Closing += OnClosing;

try
{
if (projectLanguage == "C#")
Expand Down Expand Up @@ -61,5 +65,17 @@ public Main(string projectName, string projectLanguage, string ProjectType)

}
}

private void OnClosing(object sender, CancelEventArgs cancelEventArgs)
{
string msg = "Do you want to exit Trainer Studio?";
DialogResult result = MessageBox.Show(msg, "Close Confirmation",
MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
Application.Exit();
else if (result == DialogResult.No)
cancelEventArgs.Cancel = false;

}
}
}
2 changes: 1 addition & 1 deletion Properties/PublishProfiles/FolderProfile.pubxml.user
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<History>True|2024-07-09T04:16:04.8352682Z||;True|2024-07-09T10:19:37.3610289+07:00||;True|2024-07-03T08:52:06.0791707+07:00||;True|2024-07-03T08:36:48.0337116+07:00||;True|2024-07-03T08:36:29.1380094+07:00||;True|2024-07-03T08:02:18.9511310+07:00||;True|2024-07-03T08:01:22.9038707+07:00||;True|2024-07-02T17:35:09.8225888+07:00||;True|2024-07-02T17:32:48.0607939+07:00||;True|2024-07-02T16:34:30.8649130+07:00||;True|2024-07-02T16:33:17.8244660+07:00||;True|2024-07-02T14:08:52.1255404+07:00||;True|2024-07-02T07:05:34.1669329+07:00||;</History>
<History>True|2024-07-09T06:15:58.5882820Z||;True|2024-07-09T11:16:04.8352682+07:00||;True|2024-07-09T10:19:37.3610289+07:00||;True|2024-07-03T08:52:06.0791707+07:00||;True|2024-07-03T08:36:48.0337116+07:00||;True|2024-07-03T08:36:29.1380094+07:00||;True|2024-07-03T08:02:18.9511310+07:00||;True|2024-07-03T08:01:22.9038707+07:00||;True|2024-07-02T17:35:09.8225888+07:00||;True|2024-07-02T17:32:48.0607939+07:00||;True|2024-07-02T16:34:30.8649130+07:00||;True|2024-07-02T16:33:17.8244660+07:00||;True|2024-07-02T14:08:52.1255404+07:00||;True|2024-07-02T07:05:34.1669329+07:00||;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
[assembly: System.Reflection.AssemblyCompanyAttribute("Lithicsoft Trainer Studio")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2c7ff433f7f0f33c64a195683371afe5a7a5d517")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1f8bc14045c36b91557f3d1db41c82faa1a345b2")]
[assembly: System.Reflection.AssemblyProductAttribute("Lithicsoft Trainer Studio")]
[assembly: System.Reflection.AssemblyTitleAttribute("Lithicsoft Trainer Studio")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5ac171f6af6751c0c881d2fe4af366fc82ee1a2a81b282c2bd048554e7257b0d
d5f1a474ef3c0b3f3743c1cd60ea904b0c89bebd301cb8b9d2205e73a36b9334

0 comments on commit c021e2a

Please sign in to comment.