示例#1
0
        public bool RemoveCommandSource(Type type)
        {
            var result = m_CommandSourceTypes.RemoveAll(d => d == type) > 0;

            OnCommandSourcesChanged?.Invoke();
            return(result);
        }
示例#2
0
        public void RemoveCommandSource(ICommandSource commandSource)
        {
            if (commandSource == null)
            {
                throw new ArgumentNullException(nameof(commandSource));
            }

            m_CommandSources.Remove(commandSource);
            OnCommandSourcesChanged?.Invoke();
        }
示例#3
0
        public bool RemoveCommandSource(Type type)
        {
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            var result = m_CommandSourceTypes.RemoveAll(d => d == type) > 0;

            OnCommandSourcesChanged?.Invoke();
            return(result);
        }
示例#4
0
        public void AddCommandSource(Type type)
        {
            if (!typeof(ICommandSource).IsAssignableFrom(type))
            {
                throw new Exception($"Type {type} must be an instance of ICommandSource!");
            }

            if (m_CommandSourceTypes.Contains(type))
            {
                return;
            }

            m_CommandSourceTypes.Add(type);
            m_CommandSourceTypes.Sort((a, b) => m_PriorityComparer.Compare(a.GetPriority(), b.GetPriority()));
            OnCommandSourcesChanged?.Invoke();
        }
示例#5
0
 public void RemoveCommandSource(ICommandSource commandSource)
 {
     m_CommandSources.Remove(commandSource);
     OnCommandSourcesChanged?.Invoke();
 }
示例#6
0
 public void AddCommandSource(ICommandSource commandSource)
 {
     m_CommandSources.Add(commandSource);
     OnCommandSourcesChanged?.Invoke();
 }