forked from vatSys/AuroraLabelItemsPlugin
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pop-up about activation on first launch (#9)
- Loading branch information
Showing
3 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System.IO; | ||
using System.Reflection; | ||
using System.Threading.Tasks; | ||
using System.Windows.Forms; | ||
|
||
namespace AtopPlugin.UI; | ||
|
||
public static class TempActivationMessagePopup | ||
{ | ||
private const string AcknowledgeFileName = ".atop_activation_ack"; | ||
|
||
public static void PopUpActivationMessageIfFirstTime() | ||
{ | ||
if (ActivationAckFileExists()) return; | ||
Task.Run(() => MessageBox.Show( | ||
"""Starting with this version of the ATOP vatSys plugin, you will have to activate your session by clicking the "Activate" button under the "ATOP" menu in order to use the full controlling functionalities.""", | ||
@"vatSys ATOP Plugin" | ||
)); | ||
WriteActivationAckFile(); | ||
} | ||
|
||
private static bool ActivationAckFileExists() | ||
{ | ||
return File.Exists(GetAckFilePath()); | ||
} | ||
|
||
private static void WriteActivationAckFile() | ||
{ | ||
File.WriteAllBytes(GetAckFilePath(), new byte[] { }); | ||
} | ||
|
||
private static string GetAckFilePath() | ||
{ | ||
return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, | ||
AcknowledgeFileName); | ||
} | ||
} |