/// <summary> /// Locks the screen and all user I/O /// </summary> /// <returns>whether the operation that caused the program to lock has been canceled<\returns> public static bool Lock(string reason, string Feature) { ReAuthForm f = new ReAuthForm(reason, Feature); while (!f.auth) { f.ShowDialog(); } bool canceled = f.canceled; f.Dispose(); if (IdentityVerifier.TrustValue < 70) { IdentityVerifier.TrustValue = 70; } return canceled; }
/// <summary> /// Same as the lock, but sends the reauthentication information to the owner instead of the user /// </summary> /// <returns>whether the operation that caused the program to lock has been canceled public static bool OwnerLock(string reason, string Feature) { ReAuthForm f = new ReAuthForm(true, reason, Feature); while (!f.auth) { f.ShowDialog(); } bool canceled = f.canceled; f.Dispose(); IdentityVerifier.TrustValue = 100; return canceled; }
protected override void OnBeforeUninstall(IDictionary savedState) { if (File.Exists(System.Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\Louisiana Tech University\Active Authentication\Owner.xml")) { try { ReAuthForm f = new ReAuthForm(true, "Uninstall", ""); f.ShowDialog(); if (!f.auth) { throw new InstallException("Only an authenticated user can uninstall this application."); } if(f.canceled) { notsure(); } else base.OnBeforeInstall(savedState); f.Dispose(); } catch(Exception e) { throw new InstallException(e.Message); } } else { base.OnBeforeUninstall(savedState); } }