Skip to content

Nukepayload2/WpfSingletonAppBase

Repository files navigation

Nukepayload2.ApplicationServices.Wpf

Provides single instance application base for WPF.

How to use it:

  1. Use Nukepayload2.ApplicationServices.Wpf.WpfApplicationBase as the base class of your WPF application.
  2. Set IsSingleInstance="True"
<appsrv:WpfApplicationBase x:Class="Application"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:DemoApp"
             StartupUri="MainWindow.xaml"
             IsSingleInstance="True"
             xmlns:appsrv="clr-namespace:Nukepayload2.ApplicationServices.Wpf;assembly=Nukepayload2.ApplicationServices.Wpf">
    <Application.Resources>
         
    </Application.Resources>
</appsrv:WpfApplicationBase>
  1. Optionally handle the StartupNextInstance event.
Imports Nukepayload2.ApplicationServices.Wpf

Class Application

    ' Application-level events, such as Startup, Exit, and DispatcherUnhandledException
    ' can be handled in this file.

    Private Sub Application_StartupNextInstance(sender As Object, e As StartupNextInstanceEventArgs) Handles Me.StartupNextInstance
        MsgBox("Started a new instance.", vbInformation, "Singleton app")
    End Sub

End Class

About

Provides single instance application base for WPF

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published