NanoByte.Common.Native.WindowsRestartManager.ShutdownApps C# (CSharp) Method

ShutdownApps() private method

private ShutdownApps ( [ handler ) : void
handler [
return void
        public void ShutdownApps([NotNull] ITaskHandler handler)
        {
            #region Sanity checks
            if (handler == null) throw new ArgumentNullException(nameof(handler));
            #endregion

            handler.RunTask(new SimplePercentTask(Resources.ShuttingDownApps, ShutdownAppsWork, CancellationCallback));
        }

Usage Example

        /// <summary>
        /// Uses the <see cref="WindowsRestartManager"/> to shut down applications holding references to files we want to update.
        /// </summary>
        private void RestartManagerShutdown()
        {
            if (!WindowsUtils.IsWindowsVista) return;

            _restartManager = new WindowsRestartManager();
            _restartManager.RegisterResources(GetFilesToWrite());
            _restartManager.RegisterResources(GetFilesToDelete());
            _restartManager.ShutdownApps(new SilentTaskHandler());
        }