ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > FARR Plugins and Aliases

FARR C# SDK and Documentation V2 (19/10/2008)

<< < (10/11) > >>

skajfes:
Sorry, my mistake, I said that you need to fill SourceList to get the results but you need to to fill "this" (your class is derived from a list so this.add() works just fine), and SourceList is used like a temporary storage for your data. So if you need to load your data just once do it in the constructor, and load the SourceList, and than in GetActionsCount you fill "this" so the items get displayed. I need my data to be fresh every time so i call the reloadClippings() method that loads the clips from a file and filter the results in regard of parameters passed (typed after plugin regex ). Here's the code:

--- --- public override int GetActionsCount(string KeyKeywords)
{
                       reloadClippings();     // loads the SourceList
KeyKeywords = GetSearch(KeyKeywords);  // strips plugin regex from the input sting

this.ClearTemporaryItems();
foreach (Actions.ClipboardAction Item in SourceList)
{
if (Item.Caption.ToLower().Contains(KeyKeywords))
this.Add(Item);
}

return this.Count;
}

joshuawood:
Still no luck. I understand what you're saying, it makes sense to have the results on the this Object, but I don't see why I should also need to populate SourceList. Anyways, whether I do or don't, it still doesn't work; again, this.Count returns the correct number of items, so it is populated correctly (I had a msgbox in there):


--- ---        public override int GetActionsCount(string KeyKeywords)
        {           
            string[] Files = Directory.GetFiles(m_TempPath);     // remove temp icon files       
            foreach (string FileName in Files)                       
                File.Delete(FileName);           

            SourceList.Clear();
            EnumTray.GetTrayData(out buttonData);       // populate tray data
            if (buttonData != null)
            {
                foreach (TrayIconData trayData in buttonData)   // fill SourceList
                {

                    if (trayData.button.fsState != 8)   // only add if button is not invisible
                        SourceList.Add(new Actions.FARRTrayAction(trayData, m_TempPath));
                    if (SourceList.Count > 10)
                        break;
                }
                this.ClearTemporaryItems();
                foreach (Actions.FARRTrayAction item in SourceList)     // Copy SourceList to thisList
                    this.Add(item);               
                return this.Count;
            }
            else return 0;           
        }

It seems the same as your code, except I do nothing with the search keywords as I don't need to (I think). I also need to reset the SL using SourceList.Clear()

joshuawood:
Ok I've got it working. Something else if a different place prevented the plugin from working correctly. Not sure why, but it's fixed.

Is there a way to register a Keyword rather than a RegEx to activate the plugin? I want FARR to use terms after my plugin word to filter results.

Eg, "tray" will list all items. "tray win" will list only tray  items containing "win". Mouser said that FARR will do this itself if tray is a keyword, but if it's a RegEx then I need to code it.

mouser:
To expound on the issue:

There are two different ways that plugins can get triggered, one is by matching a plugin specified keyword on the left hand side of string.  The other is by matching a regex pattern supplied by the plugin.

The former should be used whenever appropriate since it allows FARR to be smarter about subsequent filtering;  regex should only be used when a plugin has a more advanced pattern to match.

skajfes:
i don't know about keyword registering, but it is not such a problem to filter out the results. :)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version