Пример #1
0
        public Frame CreateChild <T>(T component) where T : IGraphicsProvider, INameable
        {
            var node = new Frame(component.Name, component);

            Childrens.Add(node);
            return(node);
        }
Пример #2
0
 public override void RemoveElement(FileSystemElement fileSystemElement)
 {
     if (fileSystemElement != null && Childrens.Contains(fileSystemElement))
     {
         Childrens.Remove(fileSystemElement);
     }
 }
Пример #3
0
 private void RemoveEntity(int id, bool isRemove = true)
 {
     if (uis.ContainsKey(id))
     {
         Entity e = uis[id];
         if (World.EntityManager.HasComponent <Childrens>(e))
         {
             Childrens childrens = World.EntityManager.GetComponentData <Childrens>(e);
             childrens.DestroyEntities(World.EntityManager);
         }
         if (World.EntityManager.HasComponent <RenderText>(e))
         {
             RenderText text = World.EntityManager.GetComponentData <RenderText>(e);
             text.DestroyLetters(World.EntityManager);
         }
         if (World.EntityManager.HasComponent <OutlineLink>(e))
         {
             var outline = World.EntityManager.GetComponentData <OutlineLink>(e);
             World.EntityManager.DestroyEntity(outline.outline);
         }
         World.EntityManager.DestroyEntity(e);
         if (isRemove)
         {
             uis.Remove(id);
         }
     }
 }
Пример #4
0
        public virtual String Render(List <CommunityRoleModulePermission> permissions, int IdLanguage, String Baseurl)
        {
            Boolean available = IsValid(permissions);

            if (available || ShowDisabledItems)
            {
                String renderMenuItem = "<li {0}>{1}{2}</li>\n\r";
                String renderSubItems = "";

                switch (Type)
                {
                case MenuItemType.IconManage:
                case MenuItemType.IconNewItem:
                case MenuItemType.IconStatistic:
                    return(RenderIcon(available, IdLanguage, Baseurl));

                case MenuItemType.Link:
                case MenuItemType.Text:

                    // if children>0 are only ICONS !!
                    foreach (_MenuItem item in Childrens.Where(m => m.Deleted == BaseStatusDeleted.None && m.IsEnabled).OrderByDescending(m => m.DisplayOrder))
                    {
                        renderSubItems += item.Render(permissions, IdLanguage, Baseurl);
                    }
                    if (renderSubItems == "" && Type == MenuItemType.Text)
                    {
                        return("");
                    }
                    else
                    {
                        return(String.Format(renderMenuItem, String.IsNullOrEmpty(CssClass) ? "" : " class=\"" + CssClass + "\"", RenderItem(available, IdLanguage, Baseurl),
                                             String.IsNullOrEmpty(renderSubItems) ? "" : " <span class=\"actions\">" + renderSubItems + "</span>"));
                    }

                case MenuItemType.Separator:
                    return(String.Format(renderMenuItem, String.IsNullOrEmpty(CssClass) ? "" : " class=\"" + CssClass + "\"", "<h2 class=\"separator\"> &nbsp; </h2>", ""));

                case MenuItemType.LinkContainer:
                case MenuItemType.TextContainer:

                    foreach (_MenuItem item in Childrens.Where(m => m.Deleted == BaseStatusDeleted.None && m.IsEnabled).OrderBy(m => m.DisplayOrder))
                    {
                        renderSubItems += item.Render(permissions, IdLanguage, Baseurl);
                    }
                    if (renderSubItems == "" && Type == MenuItemType.TextContainer)
                    {
                        return("");
                    }
                    else
                    {
                        return(String.Format(renderMenuItem, String.IsNullOrEmpty(CssClass) ? "" : " class=\"" + CssClass + "\"", RenderContainerItem(available, IdLanguage, Baseurl),
                                             String.IsNullOrEmpty(renderSubItems) ? "" : " <ul>" + renderSubItems + "</ul>"));
                    }

                default:
                    break;
                }
            }
            return("");
        }
Пример #5
0
 public override void AddElement(FileSystemElement fileSystemElement)
 {
     if (fileSystemElement != null)
     {
         Childrens.Add(fileSystemElement);
     }
 }
Пример #6
0
 public DirectoryNode this[string directory]
 {
     get
     {
         return(Childrens.ToList().First(node => node.Directory == directory));
     }
 }
Пример #7
0
        private void AddStreamingVisualToFiled(int index)
        {
            switch (index)
            {
            case 0:
                Field.AddingStreamingVisual(Register, Translate);
                Childrens.Remove(Register);
                CreateRegister();
                break;

            case 1:
                Field.AddingStreamingVisual(Summator, Translate);
                Childrens.Remove(Summator);
                CreateSummator();
                break;

            case 2:
                Field.AddingStreamingVisual(Splitter, Translate);
                Childrens.Remove(Splitter);
                CreateSplitter();
                break;

            case 3:
                break;
            }
        }
Пример #8
0
        public Field(int width, int height, SimpleShader simpleShader) : base(simpleShader)
        {
            Width            = width;
            Height           = height;
            EmploymentMatrix = new EmploymentMatrix(Width, Height);


            List <Vector2> vertices = new List <Vector2>();

            for (int i = 0; i <= Height; i += (int)Delta)
            {
                vertices.AddRange(Line(new Vector2(0, i), new Vector2(Width, i), 1f));
            }

            for (int i = 0; i <= Width; i += (int)Delta)
            {
                vertices.AddRange(Line(new Vector2(i, 0), new Vector2(i, Height), 1f));
            }
            Shape = vertices.ToArray();
            InstasingList.Add(new VisualUniforms(Color.LightGray));

            CrossCursor = new CrossCursor(simpleShader);



            SelectRectangle = new DrawingVisual(simpleShader);
            SelectRectangle.InstasingList.Add(new VisualUniforms(new Color4(0, 0, 0.5f, 0.2f)));
            SelectRectangle.IsVisible = false;
            Childrens.Add(SelectRectangle);
        }
Пример #9
0
        public RcpaComboBox(ComboBox cb, String key, T[] values, string[] displayValues, int defaultIndex, bool required = false, string description = "")
        {
            if (values.Length != displayValues.Length)
            {
                throw new ArgumentException(
                          MyConvert.Format("The length of values ({0}) is not equals to the length of displayValues ({1})", values.Length,
                                           displayValues.Length));
            }

            this.cb          = cb;
            this.required    = required;
            this.key         = key;
            this.description = string.IsNullOrWhiteSpace(description) ? key : description;

            ResetItems(values, displayValues);

            this.defaultIndex = defaultIndex;

            if (cb.Items.Count > defaultIndex)
            {
                cb.SelectedIndex = defaultIndex;
            }

            Adaptor = new OptionFileComboBoxAdaptor(cb, key, defaultIndex);

            Childrens.Add(cb);
        }
Пример #10
0
        public void MouseDown(Vector2 mouseFieldPos)
        {
            _mouseDownPos = ToDiscret(mouseFieldPos);
            foreach (var streamingVis in StreamingComponents)
            {
                if (streamingVis.Hit(mouseFieldPos))
                {
                    int pin;
                    if (streamingVis.MouseSelectInput(_mouseDownPos, out pin))
                    {
                        _wireCreator = new InputWireCreator(streamingVis, pin, EmploymentMatrix);
                        Childrens.Insert(0, _wireCreator.Wire);
                        return;
                    }
                    if (streamingVis.MouseSelectOutput(_mouseDownPos, out pin))
                    {
                        _wireCreator = new OutputWireCreator(streamingVis, pin, EmploymentMatrix);
                        Childrens.Insert(0, _wireCreator.Wire);
                        return;
                    }

                    _dragStreamingVisual  = new MouseDragVisualObject(streamingVis, _mouseDownPos);
                    streamingVis.IsSelect = !streamingVis.IsSelect;
                    return;
                }
            }
            SelectRectangle.Translate = ToDiscret(mouseFieldPos);
            SelectRectangle.IsVisible = true;
            SelectRectangle.Shape     = new Vector2[0];
        }
Пример #11
0
        public StreamingSource(int[] message, SimpleShader simpleShader)
            : base(simpleShader, 0, 1)
        {
            Message = message;

            Size = new Vector2(Delta * (Message.Length + 1), Delta * 2);

            InstasingList.Add(new VisualUniforms(Color4.Black));
            for (int i = 0; i < Message.Length; i++)
            {
                var bit   = message[i];
                var glyph = new Glyph7x5(bit == 0?'0':'1',
                                         new Vector2(Delta * i + 4, 2),
                                         SimpleShader);
                BitMessage.Add(glyph);
                Childrens.Add(glyph);
            }
            var vertices = new List <Vector2>();

            vertices.AddRange(Polyline(new[]
            {
                new Vector2(Delta * Message.Length, 0),
                new Vector2(-1, 0),
                new Vector2(-1, Delta * 2),
                new Vector2(Delta * Message.Length, Delta * 2)
            }, 2));

            CreateOutput(0, ConnectorOrientation.Right, new Vector2(Delta * (Message.Length + 1), 0));

            Shape = vertices.ToArray();
        }
Пример #12
0
        public override void LoadFromBinaryReader(System.IO.Stream binaryReader)
        {
            base.LoadFromBinaryReader(binaryReader);

            if (BinaryHelper.ConvertByteArrayToUTF8String(binaryReader.PeekBytes(4)) == "BOMP")
            {
                var BOMP = new ImageBomp(this);
                BOMP.LoadFromBinaryReader(binaryReader);
                Childrens.Add(BOMP);
            }
            else
            {
                var SMAP = new ImageStripTable(this, _imageSize);
                SMAP.LoadFromBinaryReader(binaryReader);
                Childrens.Add(SMAP);
            }

            var  nextBlockName = BinaryHelper.ConvertByteArrayToUTF8String(binaryReader.PeekBytes(4));
            byte planeNumber   = 0;

            while (nextBlockName.Substring(0, 2) == "ZP" && (int.Parse(nextBlockName.Substring(2)) < 99))
            {
                planeNumber++;

                var zPlane = new ZPlane(this, planeNumber, _imageSize);
                zPlane.LoadFromBinaryReader(binaryReader);
                Childrens.Add(zPlane);

                nextBlockName = BinaryHelper.ConvertByteArrayToUTF8String(binaryReader.PeekBytes(4));
            }
        }
Пример #13
0
 protected virtual void OnEventPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == nameof(IEvent.EventName))
     {
         NotifyPropertyChanged(e.PropertyName);
     }
     if (e.PropertyName == nameof(IEvent.SubEventsCount))
     {
         Application.Current.Dispatcher.BeginInvoke((Action) delegate
         {
             if (IsExpanded)
             {
                 return;
             }
             if (((IEvent)sender).SubEventsCount == 0)
             {
                 Childrens.Remove(DummyChild);
             }
             else if (!HasDummyChild)
             {
                 Childrens.Add(DummyChild);
             }
         });
     }
 }
        public void Remove()
        {
            if (this.ChildrenCount > 0)
            {
                Childrens.Clear();
            }

            this.Deleted = true;

            // CheckKeyChildrenCount(this);

            if (ParentKey != null)
            {
                ParentKey.Childrens.Remove(this);

                // CheckKeyChildrenCount(this);
            }
            else
            {
                RedisDb.Keys.Remove(this);
            }

            OnPropertyChanged(nameof(Childrens));
            OnPropertyChanged(nameof(Deleted));
        }
Пример #15
0
        public SiteMapNode CreateChildren()
        {
            var node = Empty;

            node.Parent = this;
            Childrens.Add(node);
            return(node);
        }
Пример #16
0
 public override List <string> GetChildren(string path)
 {
     if (Childrens.ContainsKey(path))
     {
         return(Childrens[path]);
     }
     return(AssetDatabase.GetDependencies(path, false).ToList());
 }
 public void insertChildren(IScreen children)
 {
     if (Childrens == null)
     {
         Childrens = new ObservableCollection <IScreen>();
     }
     Childrens.Add(children);
 }
Пример #18
0
        public Frame CreateChild(string name, IGraphicsProvider component, Vector3 localPosition, Matrix localRotation, Vector3 localScale)
        {
            var node = new Frame(name, component);

            node.ComputeLocalPose(localScale, localRotation, localPosition);
            node.CommitChanges();
            Childrens.Add(node);
            return(node);
        }
Пример #19
0
        public IfNode()
        {
            NodeType = OperationType.IF;
            //if comparaison operation
            Childrens.Add(new ComparaisonNode());

            //If content block
            AddChild(OperationType.BLOCK);
        }
Пример #20
0
        public override void LoadFromBinaryReader(System.IO.Stream binaryReader)
        {
            base.LoadFromBinaryReader(binaryReader);

            var WRAP = new PalettesWrapper(this);

            WRAP.LoadFromBinaryReader(binaryReader);
            Childrens.Add(WRAP);
        }
Пример #21
0
        public Frame CreateChild(string name, IGraphicsProvider component, Matrix localPose)
        {
            var node = new Frame(name, component);

            node.LocalPose = localPose;
            node.CommitChanges();
            Childrens.Add(node);
            return(node);
        }
Пример #22
0
        public RcpaRadioButton(RadioButton cbValue, String key, bool defaultValue)
        {
            this.cbValue         = cbValue;
            this.cbValue.Checked = defaultValue;

            Adaptor = new OptionFileRadioButtonAdaptor(cbValue, key, defaultValue);

            Childrens.Add(cbValue);
        }
Пример #23
0
        public virtual void CalculateBlockSize()
        {
            uint block = (uint)(BinaryHelper.ConvertUTF8StringToByteArray(BlockType).Length + 4);

            Childrens.ForEach(b => b.CalculateBlockSize());
            Childrens.ForEach(b => block += b.BlockSize);

            _blockSize = block;
        }
Пример #24
0
        public RcpaCheckBox(CheckBox cbValue, String key, bool defaultValue)
        {
            this.cbValue         = cbValue;
            this.cbValue.Checked = defaultValue;

            Adaptor = new OptionFileCheckBoxAdaptor(cbValue, key, defaultValue);

            Childrens.Add(cbValue);
        }
Пример #25
0
 public virtual bool HasChildrens()
 {
     if (IsDirty)
     {
         RebuildChildrens();
         IsDirty = false;
     }
     return(Childrens.Any());
 }
Пример #26
0
        private void CreateRegister()
        {
            Register = new StreamingRegister(SimpleShader);
            var cos = MiddleRadius * (float)Math.Cos(Math.PI / ItemsCount * 2);
            var sin = MiddleRadius * (float)Math.Sin(Math.PI / ItemsCount * 2);

            Register.Translate = new Vector2(cos - Delta * 3, sin - Delta * 1.5f);
            Childrens.Add(Register);
        }
Пример #27
0
 public BTNode AddChild(BTNode node)
 {
     if (MaxChildCount >= 0 && Childrens.Count >= MaxChildCount)
     {
         throw new Exception("BevTree超出最大子节点个数");
     }
     Childrens.Add(node);
     return(this);
 }
Пример #28
0
        public void AddingStreamingVisual(StreamingComponent visual, Vector2 translate)
        {
            StreamingComponents.Add(visual);
            Childrens.Add(visual);
            visual.Translate += translate;
            var discPosition = ToDiscret(translate);

            visual.Animation("Translate", discPosition, 250);
            EmploymentMatrix.MountingRectangle(discPosition, visual.Size);
        }
Пример #29
0
        private void CreateSplitter()
        {
            Splitter = new StreamingSplitter(SimpleShader);
            float arg = (float)(2 * Math.PI * 2 / ItemsCount + Math.PI / ItemsCount * 2);
            var   cos = MiddleRadius * (float)Math.Cos(arg);
            var   sin = MiddleRadius * (float)Math.Sin(arg);

            Splitter.Translate = new Vector2(cos, sin);
            Childrens.Add(Splitter);
        }
Пример #30
0
        private void CreateSummator()
        {
            Summator = new StreamingSummator(SimpleShader, 2);
            float arg = (float)(Math.PI * 2 / ItemsCount + Math.PI / ItemsCount * 2);
            var   cos = MiddleRadius * (float)Math.Cos(arg);
            var   sin = MiddleRadius * (float)Math.Sin(arg);

            Summator.Translate = new Vector2(cos - Delta * 2, sin - Delta * 2);
            Childrens.Add(Summator);
        }