Exemplo n.º 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);
         }
     }
 }
Exemplo n.º 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());
                }
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
0
 private void RaiseOnNameChangedEvent()
 {
     OnNameChanged?.Invoke(this, EventArgs.Empty);
 }
Exemplo n.º 5
0
 public virtual void SetPickables(IEnumerable <T> pickables)
 {
     _pickables = pickables.ToList();
     UpdateButtons();
     OnNameChanged?.Invoke(this);
 }
Exemplo n.º 6
0
 public virtual void RemovePickables(IEnumerable <T> pickables)
 {
     _pickables.RemoveAll(x => pickables.Contains(x));
     UpdateButtons();
     OnNameChanged?.Invoke(this);
 }
Exemplo n.º 7
0
 public virtual void AddPickables(IEnumerable <T> pickables)
 {
     _pickables.AddRange(pickables);
     UpdateButtons();
     OnNameChanged?.Invoke(this);
 }