Beispiel #1
0
        public bool AddSnippet(object sender, AbstractSnippet snippet)
        {
            // Prevents duplicate sources
            if (Snippets.Contains(snippet))
            {
                return(false);
            }

            Snippets.Add(snippet);

            // Update settings to include newly added snippet
            var snippetsOfType = Snippets.Where(s => s.GetType() == snippet.GetType());

            AppSettings.PutAndSave(GetKey(snippet), snippetsOfType);

            // Notify listeners that a new snippet was added
            Listeners.ForEach(listener => listener.SnippetAdded(sender, this, snippet));

            return(true);
        }