public override void LoadMethod()
        {
            ActionGroupDesignerHolder holder = DesignerHolder as ActionGroupDesignerHolder;
            bool b = holder.DisableUndo;

            holder.DisableUndo = true;
            //
            this.Name      = VPLUtil.NameToCodeName(VPLUtil.FormCodeNameFromname(holder.Actions.Name));
            this.Site.Name = Name;
            Description    = holder.Actions.Description;
            //
            ReloadActions();
            //
            RemoveDisconnectedPorts();
            //
            holder.DisableUndo = b;
            //
        }
Пример #2
0
        public void LoadActionGroup(AB_Group group)
        {
            bool b = this.DesignerHolder.DisableUndo;

            DesignerHolder.DisableUndo = true;
            DesignerHolder.SetLoading(true);
            _group         = group;
            this.Name      = VPLUtil.FormCodeNameFromname(_group.Name);
            this.Site.Name = Name;
            Description    = _group.Description;
            //
            LoadActions(_group.ActionList);
            //
            RemoveDisconnectedPorts();
            InitializeInputTypes();
            //
            DesignerHolder.DisableUndo = b;
            DesignerHolder.SetLoading(false);
        }
        string INameCreationService.CreateName(IContainer container, Type type)
        {
            if (container == null || type == null)
            {
                return("name1");
            }
            string baseName        = VPLUtil.FormCodeNameFromname(VPLUtil.GetTypeDisplay(type));
            ComponentCollection cc = container.Components;
            int min   = Int32.MaxValue;
            int max   = Int32.MinValue;
            int count = 0;

            for (int i = 0; i < cc.Count; i++)
            {
                IComponent comp = cc[i] as IComponent;

                if (comp.GetType() == type)
                {
                    count++;

                    string name = comp.Site.Name;
                    if (name.StartsWith(baseName))
                    {
                        try
                        {
                            int value = Int32.Parse(name.Substring(baseName.Length));

                            if (value < min)
                            {
                                min = value;
                            }

                            if (value > max)
                            {
                                max = value;
                            }
                        }
                        catch (Exception ex)
                        {
                            Trace.WriteLine(ex.ToString());
                        }
                    }
                }
            }            // for

            if (count == 0)
            {
                return(string.Format(CultureInfo.InvariantCulture, "{0}1", baseName));
            }
            else if (min > 1)
            {
                int j = min - 1;

                return(string.Format(CultureInfo.InvariantCulture, "{0}{1}", baseName, j));
            }
            else
            {
                int j = max + 1;

                return(string.Format(CultureInfo.InvariantCulture, "{0}{1}", baseName, j));
            }
        }