Пример #1
0
        public object AddNewComponent(string fileName)
        {
            object ob        = ProjectBackend.AddNewComponent(fileName);
            object component = App.GetComponent(ob, null, null);

            if (component is WidgetComponent)
            {
                var        wc = (WidgetComponent)component;
                WidgetInfo wi = GetWidget(wc.Name);
                if (wi == null)
                {
                    wi = new WidgetInfo(this, wc);
                    widgets.Add(wi);
                }
                return(wi);
            }

            if (component is ActionGroupComponent)
            {
                var ac = (ActionGroupComponent)component;
                // Don't wait for the group added event to come to update the groups list since
                // it may be too late.
                ActionGroupInfo gi = GetActionGroup(ac.Name);
                if (gi == null)
                {
                    gi = new ActionGroupInfo(this, ac.Name);
                    groups.Add(gi);
                }
                return(gi);
            }

            return(null);
        }