//This will flash the console window, notify the user, then then (either after 5 minutes or the next autoevent from access closing) //it will close all instances of Access currently running. private void lockUserOut() { Console.Clear(); FrontEndUpdater.UpdateOnNextLaunch(); FlashWindow(Process.GetCurrentProcess().MainWindowHandle, true); Console.WriteLine("Access has been locked for maintenance. Please save your work and exit. Access will be automatically closed in 5 minutes."); this._autoEvent.WaitOne(new TimeSpan(0, 5, 0)); closeAllInstancesOfAccess(); }
public static void CompareLauncherVersions() { int launcherVersion = GetInfo.GetFrontEndLauncherVersion(); int currentLauncherVersion = GetInfo.GetCurrentLauncherVersion(); if (currentLauncherVersion != launcherVersion) { Console.WriteLine("Updating launcher version..."); FrontEndUpdater.UpdateLauncher(); } }
/*This will: * 1. Flash the console window * 2. Notify the user that Access has become outdated and will relaunch in 5 minutes to update if they do not close it. * ---Either after 5 minutes or the next autoevent from access closing it will then... * 3. It will close all instances of Access currently running * 4. It will run the updater * 5. It will launch Access again * 6. It will stop the console window from flashing * 7. It will execute the watcher once more. */ private void updateUser() { Console.Clear(); FlashWindow(Process.GetCurrentProcess().MainWindowHandle, true); Console.WriteLine("It appears your access version has become outdated. Please save your work and relaunch Access. " + "Access will automatically close and relaunch in 5 minutes. You can shortcut this process by closing Access " + "and then relaunching it. The update will be made when you relaunch."); this._autoEvent.WaitOne(new TimeSpan(0, 5, 0)); closeAllInstancesOfAccess(); FrontEndUpdater.UpdateFrontEnd(_user.UserType); this._needsUpdate = false; Process.Start(Domain.FrontEnd.GetInfo.GetLaunchFilePath()); FlashWindow(Process.GetCurrentProcess().MainWindowHandle, false); this.Excecute(); }