Exemplo n.º 1
0
        // Ao sair do windows, manda todas as informações do usuário para o servidor.
        private void App_SessionEnding(object sender, SessionEndingCancelEventArgs e)
        {
            DataAccess db = new DataAccess();

            LogTime.logouttime = DateTime.Now.ToString();
            db.SendLog();
        }
Exemplo n.º 2
0
        protected override void OnSessionEnding(SessionEndingCancelEventArgs e)
        {
            base.OnSessionEnding(e);

            // Auto save
            // ...
        }
        protected override void OnSessionEnding(SessionEndingCancelEventArgs e)
        {
            base.OnSessionEnding(e);

            this.isSessionEnding = true;
            this.Shutdown();
        }
Exemplo n.º 4
0
 protected override void OnSessionEnding(SessionEndingCancelEventArgs e)
 {
     base.OnSessionEnding(e);
     MessageBoxResult result = MessageBox.Show("Do you want to save your data?", MainWindow.Title,
                                               MessageBoxButton.YesNoCancel, MessageBoxImage.Question,
                                               MessageBoxResult.Yes);
 }
Exemplo n.º 5
0
        private void Application_SessionEnding(object sender, SessionEndingCancelEventArgs e)
        {
            Logger logger = logHolder.Logger;

            logger.Info("User Session Ending");
            CleanShutdown();
        }
Exemplo n.º 6
0
 private void Application_SessionEnding(object sender, SessionEndingCancelEventArgs e)
 {
     Log.ErrorLog("程序非正常退出!");
     Log.ErrorLog("原因:" + e.ReasonSessionEnding.ToString());
     ((MainWindow)Current.MainWindow).SaveTagInfo();
     Log.CloseErrorLog();
 }
Exemplo n.º 7
0
        protected override void OnSessionEnding(SessionEndingCancelEventArgs e)
        {
            base.OnSessionEnding(e);

            e.Cancel = true;
            MessageBox.Show("无法关闭程序");
        }
Exemplo n.º 8
0
        /// <inheritdoc/>
        protected override void OnSessionEnding(SessionEndingCancelEventArgs e)
        {
            // Save client settings on logout.
            Client.Properties.Settings.Default.Save();

            base.OnSessionEnding(e);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Check if end of application session should be canceled or not
        /// (we may have gotten here through unhandled exceptions - so we
        /// display it and attempt CONTINUE so user can save his data.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnSessionEnding(SessionEndingCancelEventArgs e)
        {
            base.OnSessionEnding(e);

            try
            {
                if (this.mMainWin != null && this.mOKToClose == true)
                {
                    if (this.mMainWin.DataContext != null)
                    {
                        e.Cancel = true;

                        logger.Error("The {0} application received an fatal error: {1}.\n\nPlease save your data and re-start manually.",
                                     Application.ResourceAssembly.GetName(), e.ReasonSessionEnding.ToString());

                        Msg.Box.Show(string.Format(CultureInfo.CurrentCulture, "The application received a request to shutdown.\n\n" +
                                                   "Please save your data and exit manually (click on the link below to report this problem if it persists)."), "Attempt to exit",
                                     MsgBoxButtons.OK, MsgBoxImage.Warning,
                                     MsgBoxResult.Ok,
                                     App.IssueTrackerLink, App.IssueTrackerLink,
                                     null, null, true);
                    }
                }
            }
            catch (Exception exp)
            {
                logger.Error(exp);
            }
        }
Exemplo n.º 10
0
        private void Application_SessionEnding(object sender, SessionEndingCancelEventArgs e)
        {
            this.log.Info("SessionEnding");

            // triggered on windows shutdown or user logoff
            ShutdownApplication();
        }
Exemplo n.º 11
0
        private async void Current_SessionEnding(object sender, SessionEndingCancelEventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(Config.LightSettings.Hue.HueApiKey) && !string.IsNullOrEmpty(Config.LightSettings.Hue.HueIpAddress) && !string.IsNullOrEmpty(Config.LightSettings.Hue.SelectedHueLightId))
                {
                    await _hueService.SetColor("Off", Config.LightSettings.Hue.SelectedHueLightId).ConfigureAwait(true);
                }

                if (Config.LightSettings.LIFX.IsLIFXEnabled && !string.IsNullOrEmpty(Config.LightSettings.LIFX.LIFXApiKey))
                {
                    await _lifxService.SetColor("Off", (Selector)Config.LightSettings.LIFX.SelectedLIFXItemId).ConfigureAwait(true);
                }

                if (Config.LightSettings.Custom.IsCustomApiEnabled && !string.IsNullOrEmpty(Config.LightSettings.Custom.CustomApiOffMethod) && !string.IsNullOrEmpty(Config.LightSettings.Custom.CustomApiOffUri))
                {
                    await _customApiService.SetColor("Off", "Off").ConfigureAwait(true);
                }

                await _settingsService.SaveSettings(Config).ConfigureAwait(true);
            }
            catch (Exception ex)
            {
                _diagClient.TrackException(ex);
            }
        }
        private void Application_SessionEnding(object sender, SessionEndingCancelEventArgs e)
        {
            LogWriter.Write(string.Format(
                                "Due to pending Windows {0}, application will try to save the current settings and presets",
                                e.ReasonSessionEnding.ToString()));

            GlobalSettings.TrySaveToFile();

            try
            {
                PresetDataManager.WritePresetDataToFile();
                LogWriter.Write("Presets successfully saved");
            }
            catch (Exception ex)
            {
                LogWriter.Write("Presets saving failed:");
                LogWriter.Write(ex.ToString());
            }

            var splitter = Helpers.SplitterHelper.TryFindSplitter();

            if (splitter != null)
            {
                splitter.Destroy();
            }
        }
Exemplo n.º 13
0
        protected override void OnSessionEnding(SessionEndingCancelEventArgs e)
        {
            base.OnSessionEnding(e);

            // Aync: Auto save
            SaveData();
        }
Exemplo n.º 14
0
        protected override void OnSessionEnding(SessionEndingCancelEventArgs e)
        {
            base.OnSessionEnding(e);

            _timer.Dispose();
            _timer = null;
        }
Exemplo n.º 15
0
        private void Application_SessionEnding(object sender, SessionEndingCancelEventArgs e)
        {
            long startTicks = Log.APPLICATION_END("Enter", Common.LOG_CATEGORY);


            Log.APPLICATION_END("Exit", Common.LOG_CATEGORY, startTicks);
        }
Exemplo n.º 16
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Application.SessionEnding" /> event.
        /// Occurs when the user ends the Windows session by logging off or shutting down the operating system.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.SessionEndingCancelEventArgs" /> that contains the event data.</param>
        protected override void OnSessionEnding(SessionEndingCancelEventArgs e)
        {
            base.OnSessionEnding(e);

            //TODO: Handle OS shutdown here.
            ;
        }
Exemplo n.º 17
0
 protected override void OnSessionEnding(SessionEndingCancelEventArgs e)
 {
     // Cancelling because we can't guarantee proper cleanup of automated LF's
     // unless the automating application is closed directly.
     e.Cancel = true;
     base.OnSessionEnding(e);
 }
Exemplo n.º 18
0
        private async void Current_SessionEnding(object sender, SessionEndingCancelEventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(Config.LightSettings.Hue.HueApiKey) && !string.IsNullOrEmpty(Config.LightSettings.Hue.HueIpAddress) && !string.IsNullOrEmpty(Config.LightSettings.Hue.SelectedHueLightId))
                {
                    if (Config.LightSettings.Hue.UseRemoteApi)
                    {
                        await _remoteHueService.SetColor("Off", Config.LightSettings.Hue.SelectedHueLightId, Config.LightSettings.Hue.RemoteBridgeId).ConfigureAwait(true);
                    }
                    else
                    {
                        await _hueService.SetColor("Off", Config.LightSettings.Hue.SelectedHueLightId).ConfigureAwait(true);
                    }
                }

                if (Config.LightSettings.LIFX.IsLIFXEnabled && !string.IsNullOrEmpty(Config.LightSettings.LIFX.LIFXApiKey))
                {
                    await _lifxService.SetColor("Off", Config.LightSettings.LIFX.SelectedLIFXItemId).ConfigureAwait(true);
                }

                if (Config.LightSettings.Custom.IsCustomApiEnabled && !string.IsNullOrEmpty(Config.LightSettings.Custom.CustomApiOffMethod) && !string.IsNullOrEmpty(Config.LightSettings.Custom.CustomApiOffUri))
                {
                    await _customApiService.SetColor("Off", "Off").ConfigureAwait(true);
                }

                await _settingsService.SaveSettings(Config).ConfigureAwait(true);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Error Occured in Current_SessionEnding MainWindow");
                _diagClient.TrackException(ex);
            }
        }
Exemplo n.º 19
0
 private void Current_SessionEnding(object sender, SessionEndingCancelEventArgs args)
 {
     if (!this.services.GetService <IProjectManager>().CloseSolution(true))
     {
         args.Cancel = true;
     }
 }
Exemplo n.º 20
0
        /// <inheritdoc/>
        protected override void OnSessionEnding(SessionEndingCancelEventArgs e)
        {
            var activeSession = ((ViewModels.Windows.ConnectWizard)(MainWindow as Windows.ConnectWizard)?.DataContext).ConnectionPage.ActiveSession;

            if (activeSession != null)
            {
                // Prevent active session thread from dispatching events to our thread.
                // Otherwise, Dispatcher.Invoke() and Join() below deadlocks each other.
                Dispatcher.InvokeShutdown();

                // Wait for the active session to terminate gracefully.
                // We must not return from this method, or allow base.OnSessionEnding() call
                // *before* the active session is done. Otherwise, the framework would get a
                // chance (and use it) to kill other threads including active session.
                activeSession.Thread?.Join();
            }

            base.OnSessionEnding(e);

            // Save view settings on logout.
            Views.Properties.Settings.Default.Save();

            // Save view model settings on logout.
            eduVPN.Properties.Settings.Default.Save();
        }
Exemplo n.º 21
0
        protected override void OnSessionEnding(SessionEndingCancelEventArgs e)
        {
            base.OnSessionEnding(e);

            e.Cancel = true;

            Shutdown();
        }
Exemplo n.º 22
0
        protected override void OnSessionEnding(SessionEndingCancelEventArgs e)
        {
            // Always call method in base class, so that the event gets raised.
            base.OnSessionEnding(e);

            // Place your own SessionEnding logic here
            OnShutdown(this, null);
        }
Exemplo n.º 23
0
 protected override void OnSessionEnding(SessionEndingCancelEventArgs e)
 {
     if (global != null)
     {
         global.Application_SessionEnding(e);
     }
     base.OnSessionEnding(e);
 }
Exemplo n.º 24
0
 private void App_OnSessionEnding(Object sender, SessionEndingCancelEventArgs e)
 {
     e.Cancel = CancelSessionEnding();
     if (!e.Cancel)
     {
         Globals.Telemetry.TrackEvent("Exit");
     }
 }
Exemplo n.º 25
0
 protected override void OnSessionEnding(SessionEndingCancelEventArgs e)
 {
     if (MessageBox.Show(Common.Properties.Resources._query_ExitApplication, Common.Properties.Resources._caption_Confirmation, MessageBoxButton.YesNo) == MessageBoxResult.Yes)
         IsShutdown = true;
     else
         e.Cancel = true;
     base.OnSessionEnding(e);
 }
Exemplo n.º 26
0
 protected override void OnSessionEnding(SessionEndingCancelEventArgs e)
 {
     if (MockSettings.OnSessionEnding != null)
     {
         MockSettings.OnSessionEnding(this, e);
     }
     base.OnSessionEnding(e);
 }
Exemplo n.º 27
0
        private void Application_SessionEnding(object sender, SessionEndingCancelEventArgs e)
        {
            // セッション終了時にのみ呼ばれる

            App.Log("Application_SessionEnding1");
            Thread.Sleep(3000);
            App.Log("Application_SessionEnding2");
        }
Exemplo n.º 28
0
 private void Application_SessionEnding(object sender, SessionEndingCancelEventArgs e)
 {
     if (e != null)
     {
         e.Cancel = true;
     }
     (Current.MainWindow as NewMainWindow)?.CloseWithoutConfirmAction();
 }
Exemplo n.º 29
0
        /// <summary />
        protected override void OnSessionEnding(SessionEndingCancelEventArgs e)
        {
            base.OnSessionEnding(e);

            DiagnosticsHelper.LogMessage(DiagSeverity.Information,
                                         string.Format(CultureInfo.InvariantCulture,
                                                       "Session Ending: {0}",
                                                       e.ReasonSessionEnding));
        }
Exemplo n.º 30
0
        private void App_SessionEnding(object sender, SessionEndingCancelEventArgs e)
        {
            String temp = this.tag;

            this.tag = APPLICATION;
            this.CurrentFolder("App_SessionEnding", "lifecyclelogs");
            this.Console("App_SessionEnding");
            this.tag = temp;
        }
Exemplo n.º 31
0
        /// <summary>
        ///     OnSessionEnding is called to raise the SessionEnding event. The developer will
        ///     typically override this method if they want to take action when the OS is ending
        ///     a session ( or they may choose to attach an event). This method will be called when
        ///     the user has chosen to either logoff or shutdown. These events are equivalent
        ///     to receiving a WM_QUERYSESSION window event. Windows will send it when user is
        ///     logging out/shutting down. ( See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/wm_queryendsession.asp ).
        ///     By default if this event is not cancelled - Avalon will then call Application.Shutdown.
        /// </summary>
        /// <remarks>
        ///     This method follows the .Net programming guideline of having a protected virtual
        ///     method that raises an event, to provide a convenience for developers that subclass
        ///     the event.
        /// </remarks>
        /// <param name="e"></param>
        protected virtual void OnSessionEnding(SessionEndingCancelEventArgs e)
        {
            VerifyAccess();

            SessionEndingCancelEventHandler handler = (SessionEndingCancelEventHandler)Events[EVENT_SESSIONENDING];
            if (handler != null)
            {
                handler(this, e);
            }
        }