Add your plugin to Pointsharp ID
You have to import the plugin to each Pointsharp ID environment that should be using the plugin.
To import the plugin, follow these steps:
-
Place the DLL files of your plugin class library and its dependencies (PSIDAPI.dll is not required, it exists already) in the plugin folder: C:/Program Files/PointSharp/Pointsharp ID/bin/plugins.
-
Start the Pointsharp ID Admin GUI (if already started; then close and restart).
-
Verify the import: Go to Tools > Pointsharp SDK. You should see your plugin in the list, if not; look in the log file of the Pointsharp ID Admin GUI to see if any issue occurred during import.
-
Test your plugin by configuring Pointsharp ID to use it.
Notification example
Here is an example implementation of the INotificationPlugin interface to demonstrate of how to create a custom notification method that prints the message to a file instead of sending it with email or other.
Test Notification Plugin (Click to show)
using Psid.API.Notification;
using System.IO;
namespace Pointsharp.Api.Examples
{
/// <summary>
/// An example implementation of the Psid.API.Notification.INotificationPlugin
/// </summary>
public class TestNotification : INotificationPlugin
{
private string _notificationFolder;
public TestNotification()
{
// The folder to write the messages into
this._notificationFolder = @"C:\Program Files\Pointsharp\Pointsharp ID\notifications";
}
public string Description
{
get { return "My Test Notification"; }
}
public string Name
{
get { return "TestNotification"; }
}
public bool Notify(string text, string recipient)
{
var isNotified = false;
try
{
// TODO: Handle more than one message to the same recipient
// The full path to the file to write the message to
var notificationTextFile = Path.Combine(
this._notificationFolder,
recipient + ".txt"
);
// Write to file
File.WriteAllText(notificationTextFile, text);
isNotified = true;
}
catch
{
// TODO: Write exception to log...
}
return isNotified;
}
}
}
| Add a folder called notification in the Pointsharp ID folder, since we — in the example code — hard-coded that it should write all its messages to this folder. |
Test Notification example
To test our notification example, we have to copy it to the plugin folder.
Then do the following:
-
In Pointsharp ID Admin GUI, go to Notification and select Add.
-
Mark our notification (it will be prefixed with Pointsharp SDK).
-
Set the name to MyNotification.
-
Click OK.
-
Mark MyNotification in the list of notifications, and select Test.
-
Enter a destination address in the recipient field, and a message in the message box.
-
Click send.
-
Look in our notification folder created earlier, and verify that the file was created and that the message was written.