Skip to content

Commit f747a32

Browse files
authored
Update README.md
1 parent 634876b commit f747a32

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
# SingleInstanceCore
2-
Single instance application - For WPF on .NET Core
2+
For single instance applications on .NET Core
33

44
NuGet Package: https://www.nuget.org/packages/SingleInstanceCore/
55
# Usage
6-
The App class (on App.xaml.cs) should inherit ISingleInstance and implement OnInstanceInvoked method:
6+
7+
Note: Usage examples are for WPF desktop applications. For other platforms/frameworks, inheritance and initialization should be done accordingly, not exactly like the examples.
8+
9+
The class that handles instance invokation should inherit ISingleInstance and implement OnInstanceInvoked method.
10+
11+
E.g. in App class (App.xaml.cs):
712
```csharp
813
public partial class App : Application, ISingleInstance
914
{
@@ -14,14 +19,14 @@ public partial class App : Application, ISingleInstance
1419
...
1520
}
1621
```
17-
The initialization of the instance should be done on application startup or main window's startup
22+
Initialization of instance should be done when application is starting, and cleanup method should be called on the exit point of the application.
1823

19-
Cleanup method should be called on the exit point of the application.
24+
E.g. in App class (App.xaml.cs):
2025
```csharp
2126

2227
private void Application_Startup(object sender, StartupEventArgs e)
2328
{
24-
bool isFirstInstance = SingleInstance<App>.InitializeAsFirstInstance("soheilkd_ExampleIPC");
29+
bool isFirstInstance = this.InitializeAsFirstInstance("soheilkd_ExampleIPC");
2530
if (!isFirstInstance)
2631
{
2732
//If it's not the first instance, arguments are automatically passed to the first instance
@@ -34,6 +39,6 @@ Cleanup method should be called on the exit point of the application.
3439
private void Application_Exit(object sender, ExitEventArgs e)
3540
{
3641
//Do not forget to cleanup
37-
SingleInstance<App>.Cleanup();
42+
SingleInstance.Cleanup();
3843
}
3944
```

0 commit comments

Comments
 (0)