示例#1
0
        /// <summary>
        /// Closes the current application. The actual implementation depends on the final target framework.
        /// </summary>
        /// <returns><c>true</c> if the application is closed; otherwise <c>false</c>.</returns>
        public bool CloseApplication()
        {
            var eventArgs = new ApplicationClosingEventArgs();

            ApplicationClosing?.Invoke(this, eventArgs);
            if (eventArgs.Cancel)
            {
                Log.Info("Closing of application is canceled");
                return(false);
            }

            CloseMainWindow();

#pragma warning disable 162
            ApplicationClosed?.Invoke(this, EventArgs.Empty);
            return(true);

#pragma warning restore 162
        }
示例#2
0
 public void OnApplicationClosed()
 {
     ApplicationClosed?.Invoke(null, null);
 }