public void Init(PluginInitContext context)
 {
     _context = context;
     ClipboardMonitor.OnClipboardChange += CloudClipboardMonitor_OnClipboardChange;
     ClipboardMonitor.Start();
     _isMonitoring = true;
 }
        public List <Result> Query(Query query)
        {
            var           results = new List <Result>();
            List <string> displayData;

            // Keyword stop - stops the monitoring
            if (query.ActionParameters.Count > 0 &&
                query.GetAllRemainingParameter().ToLower() == "stop" &&
                _isMonitoring)
            {
                ClipboardMonitor.Stop();

                results.Add(new Result
                {
                    Title   = "Cloud clipmonitor stoped",
                    IcoPath = "Images\\cloudclipboard.png"
                });
                return(results);
            }

            // Keyword start - starts the monitoring
            if (query.ActionParameters.Count > 0 &&
                query.GetAllRemainingParameter().ToLower() == "start" &&
                !_isMonitoring)
            {
                ClipboardMonitor.Start();
                results.Add(new Result
                {
                    Title   = "Cloud clipmonitor started",
                    IcoPath = "Images\\cloudclipboard.png"
                });
                return(results);
            }

            // Search
            if (query.ActionParameters.Count == 0)
            {
                displayData = _dataList;
            }
            else
            {
                displayData = _dataList.Where(i => i.ToLower().Contains(query.GetAllRemainingParameter().ToLower()))
                              .ToList();
            }

            results.AddRange(displayData.Select(o => new Result
            {
                Title   = o.Trim(),
                IcoPath = "Images\\cloudclipboard.png",
                Action  = c =>
                {
                    try
                    {
                        Clipboard.SetText(o);
                        return(true);
                    }
                    catch (Exception e)
                    {
                        _context.API.ShowMsg("Error", e.Message, null);
                        return(false);
                    }
                }
            }).Reverse());
            return(results);
        }