asked on December 31, 2014
using (ClientManager cm = new ClientManager())
{
bool loginFlag = false;
MainWindow mainWindow = null;
List<ClientWindow> clientWindows = (List<ClientWindow>)cm.GetAllClientWindows(ClientWindowType.Main);
if (clientWindows.Count > 0)
{
var clientWindowsEnum = clientWindows.GetEnumerator();
clientWindowsEnum.MoveNext();
mainWindow = (MainWindow)clientWindowsEnum.Current; // current client window
if (mainWindow.GetCurrentRepository() == null)
{
mainWindow.Close();
cm.Refresh();
}
}
LaunchOptions options = new LaunchOptions();
options.RepositoryName = "Performance";
options.ServerName = serverName;
if (cm.IsClientOpen())
{
IEnumerable<RepositoryConnection> lfRepoConnections = cm.GetAllRepositoryConnections();
var lfRepoConnectionsEnum = lfRepoConnections.GetEnumerator();
lfRepoConnectionsEnum.MoveNext();
RepositoryConnection currentRepo = lfRepoConnectionsEnum.Current;
IList<ClientInstance> lfClientInstances = cm.GetAllClientInstances();
var a = lfClientInstances[0].IsLoggedIn();
if (!lfClientInstances[0].IsLoggedIn())
{
loginFlag = true;
}
else if (currentRepo != null)
{
if (String.IsNullOrEmpty(currentRepo.RepositoryName))
{
loginFlag = true;
}
else if (!String.IsNullOrEmpty(userName) && currentRepo.UserName != userName)
{
currentRepo.LogOut();
loginFlag = true;
}
else if (currentRepo.RepositoryName != databaseName)
{
currentRepo.LogOut();
loginFlag = true;
}
}
}
else loginFlag = true;
if (loginFlag)
{
try
{
cm.LogIn(options, out mainWindow);
}
catch (LaserficheRepositoryException ex)
{
MessageBox.Show(this, ErrorMessages.CATError.Replace("\\n", "\n"), "Laserfiche Bridge - Search", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
SearchOptions searchOptions = new SearchOptions();
searchOptions.NewWindow = false;
searchOptions.EagerlyRetrieveResults = false;
searchOptions.Query = " ";
mainWindow.LaunchSearch(searchOptions);
}
I use the above code to manage opening a new search window based on what windows are open. How do I launch the search window with no Query property to launch the search window without an error message? I want to launch the search window without searching.
0
0