コード例 #1
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);
 }
コード例 #2
0
ファイル: Application.cs プロジェクト: stanasse/olive
 protected virtual void OnSessionEnding(SessionEndingCancelEventArgs args)
 {
     if (SessionEnding != null)
     {
         SessionEnding(this, args);
     }
 }
コード例 #3
0
        protected override void OnSessionEnding(SessionEndingCancelEventArgs e)
        {
            base.OnSessionEnding(e);

            MessageBoxResult result = MessageBox.Show("您想要保存数据吗?", MainWindow.Title, MessageBoxButton.YesNoCancel, MessageBoxImage.Question, defaultResult: MessageBoxResult.Cancel);
            e.Cancel = (result == MessageBoxResult.Cancel);
        }
コード例 #4
0
ファイル: App.xaml.cs プロジェクト: ychost/uest-pcs
 private void Application_SessionEnding(object sender, SessionEndingCancelEventArgs e) {
     string msg = string.Format("{0}.End sessinon?", e.ReasonSessionEnding);
     MessageBoxResult rs = MessageBox.Show(msg, "Seesion Ending", MessageBoxButton.YesNo);
     if (rs == MessageBoxResult.No) {
         e.Cancel = true;
     }
 }
コード例 #5
0
 private void Application_SessionEnding(object sender, SessionEndingCancelEventArgs e)
 {
     if(MainWindow != null)
     {
         (MainWindow as MainWindow).Application_SessionEnding(sender, e);
     }
 }
コード例 #6
0
ファイル: App.xaml.cs プロジェクト: CarverLab/Appcast.root
		private void Application_SessionEnding(object sender, SessionEndingCancelEventArgs e)
		{
			if (!ServiceLocator.I.GetInstance<IApplicationService>().IsWorking) return;
			if (UIHelper.Confirm(e.ReasonSessionEnding + " while application is casting?", "Appcasting"))
			{
				e.Cancel = true;
			}
		}
コード例 #7
0
ファイル: App.cs プロジェクト: DP458/Clipboard_Watcher
 private void ApplicationSessionEnding(object sender,SessionEndingCancelEventArgs e)
 {
     MainWindow wnd;
     if(this.MainWindow!=null)
     {
     wnd=this.MainWindow as MainWindow;
     wnd.SessionEnd=true;
     }
 }
コード例 #8
0
ファイル: App.xaml.cs プロジェクト: ittray/LocalDemo
        protected override void OnSessionEnding(SessionEndingCancelEventArgs e)
        {
            base.OnSessionEnding(e);

            if (UnsavedData)
            {
                e.Cancel = true;
                MessageBox.Show("The application attempted to close as a result of " +
                    e.ReasonSessionEnding.ToString() +
                    ". This is not allowed, as you have unsaved data.");
            }
        }
コード例 #9
0
 /// <summary>
 /// Event handler. Called by App for session ending events.
 /// </summary>
 /// <param name="sender">Source of the event.</param>
 /// <param name="e">Session ending cancel event information.</param>
 private void App_SessionEnding(object sender, SessionEndingCancelEventArgs e)
 {
     // Ask the user if they want to allow the session to end
     string msg =
         string.Format(
             "{0}. Are you sure you wish to log off/shutdown? This will stop the (interactive) Jenkins Slave on this machine and you will need to log in again to restart it.",
             e.ReasonSessionEnding);
     if (Interaction.ConfirmStopJenkinsSlave(msg) == false)
     {
         e.Cancel = true;
     }
 }
コード例 #10
0
ファイル: App.xaml.cs プロジェクト: StyleSilviu/TimeCounter
         //Occurs when the user ends the Windows session by logging off or shutting down the operating system
        void App_SessionEnding(object sender, SessionEndingCancelEventArgs e)
        {
            // Ask the user if they want to allow the session to end 
            string msg = string.Format("{0}. End session?", e.ReasonSessionEnding);
            MessageBoxResult result = MessageBox.Show(msg, "Session Ending", MessageBoxButton.YesNo);

            // End session, if specified 
            if (result == MessageBoxResult.No)
            {
               // e.Cancel = true;
            }
            //writte all data to the mysql

        }
コード例 #11
0
        // UNDONE: Check exit from ImageViewer ?
        private void ApplicationOnSessionEnding(object sender, SessionEndingCancelEventArgs e)
        {
            var result = MessageBoxResult.Yes;

            // Если мы что-то делаем
            if (_fileSystem.IsOperationActive)
            {
                result = MessageBox.Show(
                    "Внимание, активны несколько фоновых процессов.\n\nВы настаиваете на завершении?",
                    "Unreality Commander - Подсистема защиты",
                    MessageBoxButton.YesNoCancel,
                    MessageBoxImage.Question,
                    result
                    );

                //if (result == MessageBoxResult.OK)
                //    _fileSystem.TerminateAllJobs();
            }

            e.Cancel = (result == MessageBoxResult.Yes);
        }
コード例 #12
0
ファイル: App.xaml.cs プロジェクト: Provence/MiniTwitter-Mod
 private void App_SessionEnding(object sender, SessionEndingCancelEventArgs e)
 {
     if (!_isSaved)
     {
         lock (_syncLock)
         {
             if (!_isSaved)
             {
                 Settings.Save();
                 _isSaved = true;
             }
         }
     }
 }
コード例 #13
0
ファイル: App.xaml.cs プロジェクト: gbahns/Tennis
		protected override void OnSessionEnding(SessionEndingCancelEventArgs e)
		{
			base.OnSessionEnding(e);
			log.Info("App.OnSessionEnding");
		}
コード例 #14
0
ファイル: Application.cs プロジェクト: JianwenSun/cc
        private bool WmQueryEndSession(IntPtr lParam, ref IntPtr refInt)
        {
            int reason = NativeMethods.IntPtrToInt32(lParam);
            bool retVal = false;

            // Event handler exception continuality: if exception occurs in SessionEnding event handlers, our state would not
            // be corrupted because no internal state are affected by SessionEnding. Please check Event handler exception continuality
            // if a state depending on this event is added.
            SessionEndingCancelEventArgs secEventArgs = new SessionEndingCancelEventArgs( (reason & NativeMethods.ENDSESSION_LOGOFF) != 0? ReasonSessionEnding.Logoff : ReasonSessionEnding.Shutdown );
            OnSessionEnding( secEventArgs );

            // shut down the app if not cancelled
            if ( secEventArgs.Cancel == false )
            {
                Shutdown();
                // return true to the wnd proc to signal that we can terminate properly
                refInt = new IntPtr(1);
                retVal = false;
            }
            else
            {
                // <SecurityNote>
                // This'll stop a user from Logging off and hence is a high trust operation.
                // Demand high level of trust.
                // </SecurityNote>
                SecurityHelper.DemandUnmanagedCode();
                refInt = IntPtr.Zero;

                // we have handled the event DefWndProc will not be called for this msg
                retVal = true;
            }

            return retVal;
        }
コード例 #15
0
ファイル: Application.cs プロジェクト: JianwenSun/cc
        /// <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);
            }
        }
コード例 #16
0
ファイル: App.cs プロジェクト: unbearab1e/FlattyTweet
 private void App_SessionEnding(object sender, SessionEndingCancelEventArgs e)
 {
     this.OnExit((ExitEventArgs)null);
 }
コード例 #17
0
ファイル: MainWindow.xaml.cs プロジェクト: punker76/sjupdater
 //called when windows shuts down or user logs out
 private void Current_SessionEnding(object sender, SessionEndingCancelEventArgs e)
 {
     Terminate(null);
 }
コード例 #18
0
ファイル: App.xaml.cs プロジェクト: sealuzh/PersonalAnalytics
 /// <summary>
 /// Ads a firewall exception
 /// </summary>
 //private static void AddFirewallException()
 //{
 //    try
 //    {
 //        var type = Type.GetTypeFromCLSID(new Guid("{304CE942-6E39-40D8-943A-B913C40C9CD4}"));
 //        var firewallManager = (INetFwMgr)Activator.CreateInstance(type);
 //        type = Type.GetTypeFromProgID("HNetCfg.FwAuthorizedApplication");
 //        var authapp = (INetFwAuthorizedApplication)Activator.CreateInstance(type);
 //        authapp.Name = "PersonalAnalytics";
 //        authapp.ProcessImageFileName = Assembly.GetExecutingAssembly().Location; // location of application
 //        authapp.Scope = NET_FW_SCOPE_.NET_FW_SCOPE_ALL;
 //        authapp.IpVersion = NET_FW_IP_VERSION_.NET_FW_IP_VERSION_ANY;
 //        authapp.Enabled = true;
 //        firewallManager.LocalPolicy.CurrentProfile.AuthorizedApplications.Add(authapp);
 //    }
 //    catch (Exception e)
 //    {
 //        // Known exception if user doesn't run the application as an admin
 //        Logger.WriteToLogFile(e);
 //    }
 //}
 /// <summary>
 /// Application is closed
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private static void App_SessionEnding(object sender, SessionEndingCancelEventArgs e)
 {
     TrackerManager.GetInstance().Stop();
 }
コード例 #19
0
ファイル: App.xaml.cs プロジェクト: BdGL3/CXPortal
 void App_SessionEnding(object sender, SessionEndingCancelEventArgs e)
 {
     MainWindow.Close();
 }
コード例 #20
0
 private static void App_SessionEnding(object sender, System.Windows.SessionEndingCancelEventArgs e)
 {
     Disconnect();
     HideNotifyIcon();
 }
コード例 #21
0
 private void Application_SessionEnding(object sender, SessionEndingCancelEventArgs e)
 {
     Settings.Default.Save();
 }
コード例 #22
0
 protected virtual new void OnSessionEnding(SessionEndingCancelEventArgs e)
 {
 }
コード例 #23
0
 protected virtual new void OnSessionEnding(SessionEndingCancelEventArgs e)
 {
 }
コード例 #24
0
ファイル: App.xaml.cs プロジェクト: pvandervelde/Apollo
 /// <summary>
 /// Called when the windows session is about to end.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">
 ///     The <see cref="System.Windows.SessionEndingCancelEventArgs"/> instance containing the event data.
 /// </param>
 private void HandleSessionEnding(object sender, SessionEndingCancelEventArgs e)
 {
     // Check if there is unsaved data
     // Check if anything is running
     // throw new NotImplementedException();
 }
コード例 #25
0
ファイル: App.xaml.cs プロジェクト: Daendaralus/PoESkillTree
        // Invoked when Windows is being shutdown or user is being logged off.
        protected override void OnSessionEnding(SessionEndingCancelEventArgs e)
        {
            base.OnSessionEnding(e);

            // Cancel session ending unless it's safe to exit.
            e.Cancel = !IsSafeToExit;

            // If Exit event wasn't raised yet, perform explicit shutdown (Windows 7 bug workaround).
            if (!IsExiting) Shutdown();
        }
コード例 #26
0
ファイル: GMapControl.cs プロジェクト: MatejHrlec/OculusView
 void Current_SessionEnding(object sender, SessionEndingCancelEventArgs e)
 {
    GMaps.Instance.CancelTileCaching();
 }
コード例 #27
0
ファイル: Acoes.cs プロジェクト: TrYPPF/SIAAN
 void Current_SessionEnding(object sender, SessionEndingCancelEventArgs e)
 {
     if (e.ReasonSessionEnding == ReasonSessionEnding.Shutdown)
     {
         if (MessageBoxResult.No == MessageBox.Show("Deseja mesmo fechar o SIAAN?","Fechar o SIAAN",MessageBoxButton.YesNo,MessageBoxImage.Question))
         {
             e.Cancel = true;
         }
         else
         {
             e.Cancel = false;
             Application.Current.Shutdown();
         }
     }
 }
コード例 #28
0
 private void Application_SessionEnding( object sender, SessionEndingCancelEventArgs ev )
 {
     Debug.Print( "App.Application_SessionEnding: ReasonSessionEnding is {0}", ev.ReasonSessionEnding );
 }
コード例 #29
0
ファイル: App.xaml.cs プロジェクト: Gainedge/BetterExplorer
 /// <summary>
 /// On finishing session
 /// </summary>
 /// <param name="e">SessionEndingCancel EventArgs</param>
 protected override void OnSessionEnding(SessionEndingCancelEventArgs e) {
   Current.Shutdown();
   base.OnSessionEnding(e);
 }
コード例 #30
0
ファイル: Application.cs プロジェクト: alesliehughes/olive
		protected virtual void OnSessionEnding (SessionEndingCancelEventArgs args)
		{
			if (SessionEnding != null)
				SessionEnding (this, args);
		}
コード例 #31
0
 /// <summary>
 /// Raises the SessionEnding event.
 /// </summary>
 /// <param name="e">The arguments that describe this event.</param>
 protected virtual void OnSessionEnding(SessionEndingCancelEventArgs e)
 {
     if (SessionEnding != null)
     {
         SessionEnding(this, e);
     }
 }
コード例 #32
0
ファイル: App.xaml.cs プロジェクト: JiahuiGuo/openPDC
 private void Application_SessionEnding(object sender, SessionEndingCancelEventArgs e)
 {
     global::openPDCManager.Properties.Settings.Default.Save();
 }
コード例 #33
0
ファイル: App.xaml.cs プロジェクト: kevinferno/Open
		private void Application_SessionEnding(object sender, SessionEndingCancelEventArgs e)
		{

		}