Ejemplo n.º 1
0
 /// <summary>
 /// Threadsafe Application Shutdown.
 /// </summary>
 /// <param name="value">The <see cref="System.Windows.Application">Application Instance</see> to End.</param>
 /// <exception cref="System.NullReferenceException">Can occur when either the The <see cref="System.Windows.Application">Application Instance</see> or its The <see cref="System.Windows.Application">Application Instance</see> Dispatcher object is null.</exception>
 public static void Close(this System.Windows.Application value)
 {
     value.Invoke(delegate
     {
         value?.Shutdown();
     });
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Threadsafe Close the Window and Optionally End the Application.
 /// </summary>
 /// <param name="value">The <see cref="System.Windows.Application">Application Instance</see>.</param>
 /// <param name="window"><see cref="System.Windows.Window">Window</see> The <see cref="System.Windows.Window">Window</see> to Close.</param>
 /// <param name="endApplication">bool; If True, Shutdown the Application. Default is False.</param>
 /// <exception cref="System.NullReferenceException">Can occur when either the Application or its Dispatcher object is Null.</exception>
 public static void DisposeOf(this System.Windows.Application value, System.Windows.Window window, bool endApplication = false)
 {
     value.Invoke(delegate
     {
         window?.Close();
         if (endApplication)
         {
             value?.Shutdown();
         }
     });
 }