示例#1
0
 /// <summary>
 /// Change the name of this EditInterface.
 /// </summary>
 /// <param name="name"></param>
 public void setName(String name)
 {
     if (this.name != name)
     {
         this.name = name;
         if (OnNameChanged != null)
         {
             OnNameChanged.Invoke(this);
         }
     }
 }
示例#2
0
        public void Init()
        {
            if (!_isInitted)
            {
                _provider    = GetComponent <IProvider <T> >();
                _pickHandler = GetComponent <IPickHandler <T> >();

                RegisterDynamicProvider();
                OnNameChanged?.Invoke(this);

                _isInitted = true;

                if (_provider != null)
                {
                    SetPickables(_provider.Get());
                }
            }
        }
示例#3
0
        public void ChangeName(string name)
        {
            var conf = configProvider.GetConfig();

            if (conf is null)
            {
                throw new ConfigException(Resources.ConfigNotFound);
            }
            if (conf.Info is null)
            {
                throw new ConfigException(Resources.ConfigInfoIsNull);
            }
            var shared = configProvider.GetSharedConfig();
            var tmp    = conf.Info.Name;

            conf.Info.Name = name;
            if (shared != null && shared.Config != null && shared.Config.Info != null)
            {
                shared.Config.Info.Name = name;
            }
            try
            {
                OnConfigNameChanged?.Invoke(this, conf, name);
            }
            catch
            {
                conf.Info.Name = tmp;
                if (shared != null && shared.Config != null && shared.Config.Info != null)
                {
                    shared.Config.Info.Name = tmp;
                }
                throw;
            }
            configProvider.Commit();
            OnNameChanged?.Invoke(this, name);
        }
示例#4
0
 private void RaiseOnNameChangedEvent()
 {
     OnNameChanged?.Invoke(this, EventArgs.Empty);
 }
示例#5
0
 public virtual void SetPickables(IEnumerable <T> pickables)
 {
     _pickables = pickables.ToList();
     UpdateButtons();
     OnNameChanged?.Invoke(this);
 }
示例#6
0
 public virtual void RemovePickables(IEnumerable <T> pickables)
 {
     _pickables.RemoveAll(x => pickables.Contains(x));
     UpdateButtons();
     OnNameChanged?.Invoke(this);
 }
示例#7
0
 public virtual void AddPickables(IEnumerable <T> pickables)
 {
     _pickables.AddRange(pickables);
     UpdateButtons();
     OnNameChanged?.Invoke(this);
 }