public void LoadApplications()
{
ApplicationToManageCB.Items.Clear();
// add the recent files.
foreach (string filePath in Utils.GetRecentFileList(m_groupName))
{
AddApplicationToManage(new FileInfo(filePath));
}
// load the config files for any OPC applications.
string configDir = Utils.GetAbsoluteDirectoryPath("%LocalApplicationData%\\OPC Foundation\\Applications", false, false, true);
if (configDir != null)
{
foreach (FileInfo fileInfo in new DirectoryInfo(configDir).GetFiles("*.xml"))
{
AddApplicationToManage(fileInfo);
}
}
// add the standard applications.
foreach (string fileName in s_StandardApplications)
{
string filePath = Utils.FindInstalledFile(fileName);
if (!String.IsNullOrEmpty(filePath))
{
ManagedApplication application = new ManagedApplication();
application.SetExecutableFile(filePath);
bool found = false;
foreach (ManagedApplication item in ApplicationToManageCB.Items)
{
if (item.ExecutablePath != null)
{
if (String.Compare(item.ExecutablePath, application.ExecutablePath, StringComparison.OrdinalIgnoreCase) == 0)
{
found = true;
break;
}
}
}
if (!found)
{
application.Save(configDir + "\\" + application.DisplayName + ".xml");
AddApplicationToManage(application);
}
}
}
// select the first item.
if (ApplicationToManageCB.Items.Count > 0)
{
ApplicationToManageCB.SelectedIndex = 0;
}
}