Beispiel #1
0
        public TBasicAction GetAction(Component self)
        {
            TBasicActionLink actionLink = GetActionLink(self);

            if (actionLink != null)
            {
                return(actionLink.Action);
            }
            return(null);
        }
 internal void UnRegisterChanges(TBasicActionLink client)
 {
     for (int i = 0; i < clients.Count; i++)
     {
         if (clients[i] == client)
         {
             client.SetActionInternal(null);
             clients.RemoveAt(i);
             break;
         }
     }
 }
Beispiel #3
0
        public void SetAction(Component self, TBasicAction value)
        {
            TBasicActionLink actionLink = GetActionLink(self);

            if (actionLink != null && actionLink.Action == value)
            {
                return;
            }

            if (value == null)
            {
                actionLink.Dispose();
                lock (compToActionLinks) compToActionLinks.Remove(self);
            }
            else
            {
                if (actionLink == null)
                {
                    actionLink = CreateActionLink(self);
                    lock (compToActionLinks) compToActionLinks.Add(self, actionLink);
                    actionLink.Change += (sender, e) => DoActionChange(self, sender, e);
                }
                actionLink.Action = value;

                bool  isloading = false;
                ISite site      = value.Site ?? self.Site;
                if (site != null)
                {
                    IDesignerHost designHost = site.GetService(typeof(IDesignerHost)) as IDesignerHost;
                    if (designHost != null)
                    {
                        isloading = designHost.Loading;
                    }
                }
                ActionChange(self, value, isloading);
            }
        }
 internal void RegisterChanges(TBasicActionLink client)
 {
     client.SetActionInternal(this);
     clients.Add(client);
 }