コード例 #1
0
        /// <summary>Called when the system is shutting down or the user is logging off.</summary>
        /// <param name="args">The arguments of the event.</param>
        protected override void OnSystemShutdown(Wix.SystemShutdownEventArgs args)
        {
            LogVerbose("Enter Method: OnSystemShutdown");
            WPFBootstrapperEventArgs <Wix.SystemShutdownEventArgs> cancelArgs = new WPFBootstrapperEventArgs <Wix.SystemShutdownEventArgs>(args);

            TryInvoke(new Action(() => { _mainWindow.OnSystemShutdown(cancelArgs); }));
            if (!cancelArgs.Cancel)
            {
                base.OnSystemShutdown(cancelArgs.Arguments);
            }
            LogVerbose("Leaving Method: OnSystemShutdown");
        }
コード例 #2
0
        /// <summary>Called when the system is shutting down or the user is logging off.</summary>
        /// <param name="args">The arguments of the event.</param>
        protected override void OnSystemShutdown(Wix.SystemShutdownEventArgs args)
        {
            this.LogBootstrapperEnterEvent(args, "SystemShutdown");
            WPFBootstrapperEventArgs <Wix.SystemShutdownEventArgs> cancelArgs = new WPFBootstrapperEventArgs <Wix.SystemShutdownEventArgs>(args);

            this.TryInvoke(new Action(() => { this.model?.OnSystemShutdown(cancelArgs); }));
            if (!cancelArgs.Cancel)
            {
                base.OnSystemShutdown(cancelArgs.Arguments);
            }
            this.LogBootstrapperLeaveEvent(null, "SystemShutdown");
        }
コード例 #3
0
ファイル: BootstrapperApplication.cs プロジェクト: zooba/wix3
        Result IBootstrapperApplication.OnSystemShutdown(EndSessionReasons dwEndSession, int nRecommendation)
        {
            SystemShutdownEventArgs args = new SystemShutdownEventArgs(dwEndSession, nRecommendation);
            this.OnSystemShutdown(args);

            return args.Result;
        }
コード例 #4
0
ファイル: BootstrapperApplication.cs プロジェクト: zooba/wix3
 /// <summary>
 /// Called when the system is shutting down or the user is logging off.
 /// </summary>
 /// <param name="args">Additional arguments for this event.</param>
 /// <remarks>
 /// <para>To prevent shutting down or logging off, set <see cref="ResultEventArgs.Result"/> to
 /// <see cref="Result.Cancel"/>; otherwise, set it to <see cref="Result.Ok"/>.</para>
 /// <para>By default setup will prevent shutting down or logging off between
 /// <see cref="BootstrapperApplication.ApplyBegin"/> and <see cref="BootstrapperApplication.ApplyComplete"/>.
 /// Derivatives can change this behavior by overriding <see cref="BootstrapperApplication.OnSystemShutdown"/>
 /// or handling <see cref="BootstrapperApplication.SystemShutdown"/>.</para>
 /// <para>If <see cref="SystemShutdownEventArgs.Reasons"/> contains <see cref="EndSessionReasons.Critical"/>
 /// the bootstrapper cannot prevent the shutdown and only has a few seconds to save state or perform any other
 /// critical operations before being closed by the operating system.</para>
 /// <para>This method may be called on a different thread.</para>
 /// </remarks>
 protected virtual void OnSystemShutdown(SystemShutdownEventArgs args)
 {
     EventHandler<SystemShutdownEventArgs> handler = this.SystemShutdown;
     if (null != handler)
     {
         handler(this, args);
     }
     else if (null != args)
     {
         // Allow requests to shut down when critical or not applying.
         bool critical = EndSessionReasons.Critical == (EndSessionReasons.Critical & args.Reasons);
         args.Result = (critical || !this.applying) ? Result.Ok : Result.Cancel;
     }
 }