Exemple #1
0
        /// <summary>
        /// Removes a tag from the collection
        /// </summary>
        internal void RemoveTag(EvernoteTagItem tag, bool cancelEvent = false)
        {
            if (this.ItemsSource != null)
            {
                ((IList)this.ItemsSource).Remove(tag); // assume IList for convenience
                SelectedTags.Clear();
                SelectedTags.AddRange(((List <EvernoteTagItem>) this.ItemsSource).Select(d => d.DataContext as ITag));
                this.Items.Refresh();

                if (TagRemoved != null && !cancelEvent)
                {
                    TagRemoved(this, new EvernoteTagEventArgs(tag));
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Adds a tag to the collection
        /// </summary>
        internal void AddTag(EvernoteTagItem tag)
        {
            if (this.ItemsSource == null)
            {
                this.ItemsSource = new List <EvernoteTagItem>();
            }

            ((IList)this.ItemsSource).Add(tag); // assume IList for convenience
            SelectedTags.Clear();
            SelectedTags.AddRange(((List <EvernoteTagItem>) this.ItemsSource).Select(d => d.DataContext as ITag));
            this.Items.Refresh();

            if (TagAdded != null)
            {
                TagAdded(this, new EvernoteTagEventArgs(tag));
            }
        }