Hello,
I've been looking through the SDK and I can't get LaunchSearch to work without opening another instance of Laserfiche Client. I've used the sample code below with minor modifications to run a search on the repo but every time regardless if there is already a LF Client instance already active it still opens up another one.
Is there something that I'm doing wrong here?
using (ClientManager lfclient = new ClientManager())
{
// Check to see if there is already at least one visible open instance of the Client.
if (!lfclient.IsClientOpen())
{
// If there is none, open the client and log in to the specified repository
// with Windows authentication.
LaunchOptions options = new LaunchOptions();
options.ServerName = "SampleServer";
options.RepositoryName = "SampleRepository";
ClientInstance singleLFexe = lfclient.LaunchClient(options);
// Since we create this new instance of the client and log in,
// there is only one open window, the Folder Browser. Set the
// current folder to the specified entry ID.
IEnumerable<ClientWindow> OpenWindows = singleLFexe.GetAllClientWindows();
foreach (MainWindow FolderBrowser in OpenWindows)
{
FolderBrowser.SetCurrentFolder(123456);
}
}
else
{
// If there is already an existing visible open instance of the Client,
// get a list of the existing Clients.
IList<ClientInstance> OpenLFClients = lfclient.GetAllClientInstances();
// Use the first one CAT finds and log in to the desired repository.
ClientInstance singleLFexe = OpenLFClients[0];
LaunchOptions options = new LaunchOptions();
options.ServerName = "SampleServer";
options.RepositoryName = "SampleRepository";
MainWindow FolderBrowser;
singleLFexe = lfclient.LogIn(options, out FolderBrowser);
// Set the current folder in the Folder Browser to the
// specified entry ID.
FolderBrowser.SetCurrentFolder(123456);
}
}