Show / Hide Table of Contents

Class Application

Implements base functionality for a SAF WPF application.

Inheritance
System.Object
System.Windows.Threading.DispatcherObject
System.Windows.Application
Application
Implements
System.Windows.Markup.IQueryAmbient
IProgressNotification
System.IDisposable
System.Windows.Application.FindResource(System.Object)
System.Windows.Application.GetContentStream(System.Uri)
System.Windows.Application.GetCookie(System.Uri)
System.Windows.Application.GetRemoteStream(System.Uri)
System.Windows.Application.GetResourceStream(System.Uri)
System.Windows.Application.LoadComponent(System.Object, System.Uri)
System.Windows.Application.LoadComponent(System.Uri)
System.Windows.Application.OnActivated(System.EventArgs)
System.Windows.Application.OnDeactivated(System.EventArgs)
System.Windows.Application.OnFragmentNavigation(System.Windows.Navigation.FragmentNavigationEventArgs)
System.Windows.Application.OnLoadCompleted(System.Windows.Navigation.NavigationEventArgs)
System.Windows.Application.OnNavigated(System.Windows.Navigation.NavigationEventArgs)
System.Windows.Application.OnNavigating(System.Windows.Navigation.NavigatingCancelEventArgs)
System.Windows.Application.OnNavigationFailed(System.Windows.Navigation.NavigationFailedEventArgs)
System.Windows.Application.OnNavigationProgress(System.Windows.Navigation.NavigationProgressEventArgs)
System.Windows.Application.OnNavigationStopped(System.Windows.Navigation.NavigationEventArgs)
System.Windows.Application.Run()
System.Windows.Application.Run(System.Windows.Window)
System.Windows.Application.SetCookie(System.Uri, System.String)
System.Windows.Application.Shutdown()
System.Windows.Application.Shutdown(System.Int32)
System.Windows.Application.System.Windows.Markup.IQueryAmbient.IsAmbientPropertyAvailable(System.String)
System.Windows.Application.TryFindResource(System.Object)
System.Windows.Application.Current
System.Windows.Application.MainWindow
System.Windows.Application.Properties
System.Windows.Application.ResourceAssembly
System.Windows.Application.Resources
System.Windows.Application.ShutdownMode
System.Windows.Application.StartupUri
System.Windows.Application.Windows
System.Windows.Application.Activated
System.Windows.Application.Deactivated
System.Windows.Application.DispatcherUnhandledException
System.Windows.Application.Exit
System.Windows.Application.FragmentNavigation
System.Windows.Application.LoadCompleted
System.Windows.Application.Navigated
System.Windows.Application.Navigating
System.Windows.Application.NavigationFailed
System.Windows.Application.NavigationProgress
System.Windows.Application.NavigationStopped
System.Windows.Application.SessionEnding
System.Windows.Application.Startup
System.Windows.Threading.DispatcherObject.Dispatcher
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Sartorius.SAF.Presentation
Assembly: Sartorius.SAF.Presentation.Application.dll
Syntax
public abstract class Application : Application, IQueryAmbient, IProgressNotification, IDisposable
Remarks

Base functionality are:

  • Bootstrapping the application.
  • Managing single / multiple instances of the application (process).
  • Managing application behavior on windows user switches.
  • Managing the application shutdown mode.
  • Managing application restart processed by a user.
  • Saving UI settings when application exits.

Properties

View Source

ConfigurationRoot

Gets the Microsoft.Extensions.Configuration.IConfigurationRoot.

Declaration
protected IConfigurationRoot ConfigurationRoot { get; }
Property Value
Type Description
Microsoft.Extensions.Configuration.IConfigurationRoot
View Source

ExceptionHandlingFacade

Gets the IExceptionHandlingFacade of the application.

Declaration
protected IExceptionHandlingFacade ExceptionHandlingFacade { get; set; }
Property Value
Type Description
IExceptionHandlingFacade
View Source

LockConfiguration

Gets the LockConfiguration.

Declaration
protected LockConfiguration LockConfiguration { get; }
Property Value
Type Description
LockConfiguration
View Source

UseLoginDialog

Indicates whether to use an implementation of the ILoginDialog for user login.

Declaration
protected bool UseLoginDialog { get; set; }
Property Value
Type Description
System.Boolean

Methods

View Source

AllWindowsClosed()

Tries to close all windows.

Declaration
[Obsolete("Use TryCloseWindows")]
protected virtual bool AllWindowsClosed()
Returns
Type Description
System.Boolean

True if all windows have been closed, otherwise false.

View Source

CanStartShell()

Check whether a Shell can be started. A SAF Application can be defined as a single instance.

Declaration
protected virtual bool CanStartShell()
Returns
Type Description
System.Boolean

TRUE if a application can be started, otherwise FALSE

View Source

CloseSplashScreen()

Close the async splash screen.

Declaration
public void CloseSplashScreen()
View Source

CreateBootstrapper()

Creates the ApplicationBootstrapper.

Declaration
protected virtual ApplicationBootstrapper CreateBootstrapper()
Returns
Type Description
ApplicationBootstrapper

The created instance.

View Source

CreateSplashScreen()

Creates the splash screen.

Declaration
protected virtual Window CreateSplashScreen()
Returns
Type Description
System.Windows.Window

A new instance of the splash screen.

Remarks

Override the GetNumberOfAdditionalProgressSteps() method to extend the splash screen with additional progress steps

Examples

This example illustrates how to activate the 'splash screen' functionality by overriding the CreateSplashScreen() method. Thereby 'splash screen' functionality means to show an application specific window during application startup and initialization process informing on actually processed steps.

    protected override Window CreateSplashScreen()
    {
        var mySplashScreen = new Window {Title = "SplashScreen"};
        return mySplashScreen;
    }
View Source

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Declaration
public void Dispose()
View Source

Dispose(Boolean)

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type Name Description
System.Boolean disposing

Indicates disposing.

View Source

GetNumberOfAdditionalProgressSteps()

Gets the number of additional progress steps that occurs during application initialization.

Declaration
protected virtual int GetNumberOfAdditionalProgressSteps()
Returns
Type Description
System.Int32

The number of additional progress steps; default 0

Examples

This example illustrates how increase the number of additional progress steps shown in the splash screen during application initialization

    protected override Int32 GetNumberOfAdditionalProgressSteps()
    {
        return 3;
    }
View Source

InitializeApplication(StartupEventArgs)

Initializes the application.

Declaration
protected virtual void InitializeApplication(StartupEventArgs e)
Parameters
Type Name Description
System.Windows.StartupEventArgs e

Contain the startup arguments for an application.

View Source

OnCompositionCompleted(CompositionContainer)

Occurs when the composition of the System.ComponentModel.Composition.Hosting.CompositionContainer has been completed.

Declaration
protected virtual void OnCompositionCompleted(CompositionContainer compositionContainer)
Parameters
Type Name Description
System.ComponentModel.Composition.Hosting.CompositionContainer compositionContainer

The System.ComponentModel.Composition.Hosting.CompositionContainer.

View Source

OnEventsThreadShutdown(Object, EventArgs)

Occurs before the thread that listens for system events is terminated.

Declaration
protected virtual void OnEventsThreadShutdown(object sender, EventArgs args)
Parameters
Type Name Description
System.Object sender

A sender of this event.

System.EventArgs args

Provide data for this event.

View Source

OnExit(ExitEventArgs)

Clean up the resources.

Declaration
protected override void OnExit(ExitEventArgs e)
Parameters
Type Name Description
System.Windows.ExitEventArgs e

Event arguments for Exit event.

Overrides
System.Windows.Application.OnExit(System.Windows.ExitEventArgs)
View Source

OnRestartingApplication()

Restarts the entire application.

Declaration
protected virtual void OnRestartingApplication()
Remarks
  • The current main window is closed.
  • A dummy window is set to the current main window to have a dispatcher.
  • All private members are reset.
  • All EventHandlers are detached
  • The OnStartup method is called for a clean restated.
View Source

OnSendException(Object, SendExceptionEventArgs)

Occurs when the SendException event is invoked.

Declaration
protected virtual void OnSendException(object sender, SendExceptionEventArgs sendExceptionEventArgs)
Parameters
Type Name Description
System.Object sender

The sender.

SendExceptionEventArgs sendExceptionEventArgs

The SendExceptionEventArgs

Remarks

If overridden in a derived class, the send button of the Sartorius.SAF.Presentation.Controls.ExceptionDialog.ExceptionDialog becomes visible.

Examples

This example illustrates how to activate the 'Send' functionality of the exception dialog by overriding the OnSendException(Object, SendExceptionEventArgs) method, using the Sartorius.SAF.MAPI implementation to send the email with the default email client.

    protected override void OnSendException(Object sender, SendExceptionEventArgs sendExceptionEventArgs)
    {
        if (sendExceptionEventArgs == null)
        {
            throw new ArgumentNullException(nameof(sendExceptionEventArgs));
        }

        IMAPI mapi = new MAPI.MAPI();
        var textExceptionFormatter = new TextExceptionFormatter();

        var body = textExceptionFormatter.Format(sendExceptionEventArgs.Exception);

        mapi.OpenMail("someone@example.com", body);
    }
View Source

OnSessionEnding(SessionEndingCancelEventArgs)

Occurs when the user ends the Windows session by logging off or shutting down the operating system.

Declaration
protected override void OnSessionEnding(SessionEndingCancelEventArgs e)
Parameters
Type Name Description
System.Windows.SessionEndingCancelEventArgs e
Overrides
System.Windows.Application.OnSessionEnding(System.Windows.SessionEndingCancelEventArgs)
View Source

OnSessionSwitch(Object, SessionSwitchEventArgs)

Occurs when the currently logged-in user has changed.

Declaration
protected virtual void OnSessionSwitch(object sender, SessionSwitchEventArgs args)
Parameters
Type Name Description
System.Object sender

A sender of this event.

Microsoft.Win32.SessionSwitchEventArgs args

Provide data for this event.

View Source

OnStartup(StartupEventArgs)

Starts the application.

Declaration
protected override void OnStartup(StartupEventArgs e)
Parameters
Type Name Description
System.Windows.StartupEventArgs e

Contain the startup arguments for an application.

Overrides
System.Windows.Application.OnStartup(System.Windows.StartupEventArgs)
Remarks

Do NOT override this method. Override InitializeApplication(StartupEventArgs).

View Source

ProgressChanged(ProgressNotificationArgs)

Handler for async notification about progress changes.

Declaration
public void ProgressChanged(ProgressNotificationArgs args)
Parameters
Type Name Description
ProgressNotificationArgs args
View Source

ProgressChanged(String)

Handler for async notification about progress changes.

Declaration
public void ProgressChanged(string text)
Parameters
Type Name Description
System.String text
View Source

RegisterSystemEventHandler()

Register a SystemEvents.

Declaration
protected virtual void RegisterSystemEventHandler()
View Source

RunBootstrapper()

Runs the bootstrapping process of the application.

Declaration
protected virtual void RunBootstrapper()
View Source

SetDefaultSkin()

Sets the default skin of the application.

Declaration
protected virtual void SetDefaultSkin()
Remarks

If not overridden in a derived class, the default skin is set in the following order:

  1. The skin defined in the app.config is set.
  2. If no default skin is defined in the app.config, the HID skin is applied if the file 'Sartorius.SAF.Skins.Hid.dll' exists in the output directory.
  3. If no HID skin is found, no skin is applied.
View Source

SetShutdownMode()

Sets the shut-down mode for the application.

Declaration
protected virtual void SetShutdownMode()
View Source

TryCloseWindows()

Tries to close all windows.

Declaration
protected virtual bool TryCloseWindows()
Returns
Type Description
System.Boolean

True if all windows have been closed, otherwise false.

View Source

UnregisterSystemEventHandler()

Remove SystemEvents.

Declaration
protected virtual void UnregisterSystemEventHandler()

Events

View Source

LoadingCompleted

not functionality here.

Declaration
public event Action LoadingCompleted
Event Type
Type Description
System.Action

Implements

System.Windows.Markup.IQueryAmbient
IProgressNotification
System.IDisposable

Extension Methods

CollectionExtensions.AddRange<T, TCollection>(TCollection, IEnumerable<T>)
SerializableObjectCloneExtension.Clone<T>(T)
  • View Source
Back to top Generated by DocFX