Beispiel #1
0
 /// <summary>
 /// Чистка списка названных номеров Компьютером.
 /// </summary>
 private void ClearCompNumber()
 {
     if (CompNumber != null)
     {
         CompNumber.Clear();
     }
 }
Beispiel #2
0
        /// <summary>
        /// Проверка наличия числа в списке названных.
        /// </summary>
        private void CheckThePresenceOfANumberInTheListOfNamed()
        {
            // Если комп уже называл число
            if (CompNumber.Find(x => x == NumberUser) == NumberUser &&
                CompNumber.Count > 0)
            {
                IsNewNumber = true; // получить новое число.
            }
            else
            {
                IsNewNumber = false;

                CompNumber.Add(NumberUser);
            }
        }
Beispiel #3
0
        internal IDesigner GetDesigner(IComponent comp, ObjectInfo objInfo)
        {
            Console.WriteLine("Designer - GetDesigner - start  " + comp + " " + objInfo + " ");
            DesignerAttribute da = null;

            if (comp == null)
            {
                return(null);
            }

            // For sites that are not ours, we don't treat them, unless
            // we are adding controls, we use our site instead
            if (comp.Site != null && !(comp.Site is DesignerSite))
            {
                if (_addingControls)
                {
                    comp.Site = null;
                }
                else
                {
                    Console.WriteLine("Designer - GetDesigner - not ours " + comp.Site);
                    return(null);
                }
            }

            DesignerSite site = (DesignerSite)comp.Site;

            // Don't allow getting a designer for anything higher than the
            // design surface
            if (comp == _designSurfaceParent)
            {
                return(null);
            }

            if (site == null)
            {
                String name;
                if (objInfo != null)
                {
                    name = objInfo.ObjectName;
                }
                else
                {
                    name = CompNumber.GetCompName(comp.GetType());
                }
                Console.WriteLine("Comp.name: ", name);
                site = (DesignerSite)_container.CreateSite(comp, name);
            }

            if (site.Designer != null)
            {
                return(site.Designer);
            }

            IList attrs = Attribute.GetCustomAttributes(comp.GetType(), typeof(DesignerAttribute));
            bool  found = false;

            foreach (Attribute attr in attrs)
            {
                da = attr as DesignerAttribute;
                Console.WriteLine("Designer - GetDesigner da "
                                  + da.DesignerBaseTypeName
                                  + " " + da.DesignerTypeName);
                if (da.DesignerBaseTypeName.StartsWith("System.ComponentModel.Design.IRootDesigner"))
                {
                    found = true;
                    break;
                }
            }

            // Just take the first one if we did not find a root designer
            if (!found && attrs.Count > 0)
            {
                da = attrs[0] as DesignerAttribute;
            }

            if (da != null)
            {
                Type t = GetType(da.DesignerTypeName);
                Console.WriteLine("DesignerType: " + t.FullName);
                IDesigner d = (IDesigner)Activator.CreateInstance(t);
                if (_addingControls)
                {
                    d.Initialize(comp);
                }
                site.Designer = d;
                if (comp is Control)
                {
                    site.DesignWindowTarget = ((Control)comp).WindowTarget;
                }
                Console.WriteLine("Designer  - GetDesigner " + site + " " + d);
                return(d);
            }
            Console.WriteLine("Designer  - GetDesigner NOT FOUND " + comp);
            return(null);
        }
Beispiel #4
0
 public IComponent CreateComponent(Type type)
 {
     return(CreateComponent(type, CompNumber.GetCompName(type)));
 }