Thanks skajfes, you're right about the PathItem needing to be set. It also appears that it needs to be unique. I just it to the same fixed string for each result, and it would only display 1 result. Change it to a result unique string and it lists all results.
Could you please explain what GetActionsCount does more? Do I need to use it? I currently do nothing with it, and don't appear to need to.
Further, I'm trying to remove all files in a set folder when my plugin is called. I have this code in a few places, but it only appears to be called when FARR is first loaded (and hence the plugin). I would have thought having it in the ActionList constructor would mean it got called everytime to the plugin got called, but doesn't appear to do so:
static string m_TempPath = null;
public FARRTrayList(FARRCSharpPluginBase pluginBase)
: base(pluginBase, "^tray")
{
m_TempPath = Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetCallingAssembly().Location), "Temp");
Directory.CreateDirectory(m_TempPath);
string[] Files = Directory.GetFiles(m_TempPath);
foreach (string FileName in Files)
{
File.Delete(FileName);
}
EnumTray.GetTrayData(out buttonData); // populate tray data
foreach (TrayIconData trayData in buttonData)
{
if (trayData.button.fsState != 8) // only add if button is not invisible
SourceList.Add(new Actions.FARRTrayAction(trayData, m_TempPath));
//if (this.Count > 10)
// break;
}
}
Edit: On further testing, it appears that FARR creates an instance of this plugin at runtime only. So using the above code, it is only called once, and hence my results list is not dynamic. How do I make the results list update each time the plugin is executed by it's regex? Is that what I need to use GetActionsCount for?
Edit again: I'm not sure if the above edit comment is actually correct. In some strange cases my first plugin call will not pickup the FARR tray icon, but sometimes after a while it does. But not another program loaded after FARR has started. It's a bit strange.
What I want to do is call
EnumTray.GetTrayData(out buttonData);
foreach (TrayIconData trayData in buttonData)
{
if (trayData.button.fsState != 8) // only add if button is not invisible
SourceList.Add(new Actions.FARRTrayAction(trayData, m_TempPath));
//if (this.Count > 10)
// break;
}
each time I execute the plugin by typing in it's regex.