コード例 #1
0
        /// <summary>
        /// Renames a filter in this collection.
        /// </summary>
        /// <param name="oldName">The old (current) name of the filter.</param>
        /// <param name="newName">The new name to give the filter.</param>
        /// <returns>True if the renaming was successful; otherwise false.</returns>
        public bool RenameFilter(string oldName, string newName)
        {
            // Make sure the filter exists
            var filter = TryGetFilter(oldName);

            if (filter == null)
            {
                return(false);
            }

            // Check if we are even changing the name at all
            if (_filterNameComparer.Equals(oldName, newName))
            {
                return(false);
            }

            // Make sure the new name is not in use
            if (TryGetFilter(newName) != null)
            {
                return(false);
            }

            // Remove the filter
            _filters.Remove(oldName);

            // Add back in with the ne wname
            _filters.Add(newName, filter);

            // Raise events
            if (Renamed != null)
            {
                Renamed.Raise(this, new MapDrawFilterHelperCollectionRenameEventArgs(newName, filter, oldName));
            }

            return(true);
        }
コード例 #2
0
 private void FileSystemWatcherOnRenamed(object sender, RenamedEventArgs e)
 {
     Renamed.Raise(sender, e);
 }
コード例 #3
0
 /// <summary>
 /// Raises the Renamed event.
 /// </summary>
 /// <param name="e"></param>
 protected virtual void RaiseRenamed(NodeRenamedEventArgs e)
 {
     Renamed.Raise(this, e);
 }