Esempio n. 1
0
        public Frame CreateChild <T>(T component) where T : IGraphicsProvider, INameable
        {
            var node = new Frame(component.Name, component);

            Childrens.Add(node);
            return(node);
        }
Esempio n. 2
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();
        }
Esempio n. 3
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);
        }
Esempio n. 4
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);
        }
Esempio n. 5
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));
            }
        }
Esempio n. 6
0
 public override void AddElement(FileSystemElement fileSystemElement)
 {
     if (fileSystemElement != null)
     {
         Childrens.Add(fileSystemElement);
     }
 }
Esempio n. 7
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);
             }
         });
     }
 }
Esempio n. 8
0
        public SiteMapNode CreateChildren()
        {
            var node = Empty;

            node.Parent = this;
            Childrens.Add(node);
            return(node);
        }
 public void insertChildren(IScreen children)
 {
     if (Childrens == null)
     {
         Childrens = new ObservableCollection <IScreen>();
     }
     Childrens.Add(children);
 }
Esempio n. 10
0
 public BTNode AddChild(BTNode node)
 {
     if (MaxChildCount >= 0 && Childrens.Count >= MaxChildCount)
     {
         throw new Exception("BevTree超出最大子节点个数");
     }
     Childrens.Add(node);
     return(this);
 }
Esempio n. 11
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);
        }
Esempio n. 12
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);
        }
Esempio n. 13
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);
        }
Esempio n. 14
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);
        }
Esempio n. 15
0
        public IfNode()
        {
            NodeType = OperationType.IF;
            //if comparaison operation
            Childrens.Add(new ComparaisonNode());

            //If content block
            AddChild(OperationType.BLOCK);
        }
Esempio n. 16
0
        public override void LoadFromBinaryReader(System.IO.Stream binaryReader)
        {
            base.LoadFromBinaryReader(binaryReader);

            var WRAP = new PalettesWrapper(this);

            WRAP.LoadFromBinaryReader(binaryReader);
            Childrens.Add(WRAP);
        }
Esempio n. 17
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);
        }
Esempio n. 18
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);
        }
Esempio n. 19
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);
        }
Esempio n. 20
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);
        }
        public RcpaListViewField(Button btnRemove, Button btnLoad, Button btnSave, Button btnUp, Button btnDown,
                                 ListView lvItems, string key, string description)
        {
            this.description = description;

            this.lvItems = lvItems;

            ListViewEventHandlers handlers = new ListViewEventHandlers(lvItems);

            infoAdaptor = new ItemInfosListViewAdaptor(lvItems);

            if (lvItems.MultiSelect)
            {
                lvItems.KeyDown += new KeyEventHandler(lvItems_KeyDown);
            }

            Childrens.Add(lvItems);

            if (btnRemove != null)
            {
                btnRemove.Text   = "Remove";
                btnRemove.Click += handlers.RemoveEvent;
                Childrens.Add(btnRemove);
            }

            if (btnLoad != null)
            {
                btnLoad.Text   = "Load";
                btnLoad.Click += handlers.LoadEvent;
                Childrens.Add(btnLoad);
            }

            if (btnSave != null)
            {
                btnSave.Text   = "Save";
                btnSave.Click += handlers.SaveEvent;
                Childrens.Add(btnSave);
            }

            if (btnUp != null)
            {
                btnUp.Text   = "Up";
                btnUp.Click += handlers.UpEvent;
                Childrens.Add(btnUp);
            }

            if (btnDown != null)
            {
                btnDown.Text   = "Down";
                btnDown.Click += handlers.DownEvent;
                Childrens.Add(btnDown);
            }

            Adaptor = new OptionFileItemInfosAdaptor(infoAdaptor, key);
        }
Esempio n. 22
0
        public RcpaStringComboBox(ComboBox cb, String key, string[] values, string defaultValue)
        {
            this.cb = cb;
            cb.Items.Clear();
            cb.Items.AddRange(values);
            cb.SelectedText = defaultValue;

            Adaptor = new OptionFileStringComboBoxAdaptor(cb, key, defaultValue);

            Childrens.Add(cb);
        }
Esempio n. 23
0
        public RadialMenu(Field field, SimpleShader simpleShader) : base(simpleShader)
        {
            Field = field;
            Scale = new Vector2(0, 0);

            RoundGrid = new DrawingVisual(SimpleShader);
            RoundGrid.InstasingList.Add(new VisualUniforms(Color4.Black));
            var vertices = new List <Vector2>();

            vertices.AddRange(Round(new Vector2(0, 0), RadiusMenu, 2, 120));
            vertices.AddRange(Round(new Vector2(0, 0), RadiusHole, 2, 120));
            for (double i = 0; i < Math.PI * 2; i += Math.PI * 2 / ItemsCount)
            {
                var   arg = i + Math.PI / ItemsCount;
                float sin = (float)Math.Sin(arg);
                float cos = (float)Math.Cos(arg);

                vertices.AddRange(Line(
                                      new Vector2(cos, sin) * RadiusHole,
                                      new Vector2(cos, sin) * RadiusMenu,
                                      2));
            }
            RoundGrid.Shape = vertices.ToArray();
            Childrens.Add(RoundGrid);

            Arrow = new DrawingVisual(SimpleShader);
            Arrow.InstasingList.Add(new VisualUniforms(Color4.Black));
            ArrowUpdate(RadiusHole);
            Childrens.Add(Arrow);

            Sectors = new DrawingVisual[ItemsCount];
            for (int i = 0; i < ItemsCount; i++)
            {
                Sectors[i] = new DrawingVisual(SimpleShader);
                Sectors[i].InstasingList.Add(new VisualUniforms(Color4.AliceBlue));
                vertices = new List <Vector2>();
                float arg = (float)(i * Math.PI * 2 / ItemsCount + Math.PI / ItemsCount);
                vertices.AddRange(Sector(new Vector2(0, 0), MiddleRadius, arg,
                                         arg + (float)Math.PI * 2 / ItemsCount, RadiusMenu - RadiusHole, 20));

                Sectors[i].Shape = vertices.ToArray();
                Childrens.Add(Sectors[i]);
            }

            CreateRegister();

            CreateSummator();
            CreateSplitter();

            // Register = new StreamingRegister(simpleShader, Visuals);
            // Register.Delta = Delta;
            // Register.Position = Translate + new Vector2(0, MiddleRadius);
        }
Esempio n. 24
0
        protected void CreateOutput(int outputNumber,
                                    ConnectorOrientation orientation, Vector2 position)
        {
            if (outputNumber >= OutCount)
            {
                throw new IndexOutOfRangeException();
            }
            var connector = new Connector(SimpleShader, orientation, ConnectorType.Output);

            connector.Translate            = position;
            OutputConnectors[outputNumber] = connector;
            Childrens.Add(connector);
        }
Esempio n. 25
0
 public StreamingVisual(SimpleShader simpleShader, int inCount, int outCount)
     : base(simpleShader)
 {
     _frame = new DrawingVisual(simpleShader);
     _frame.InstasingList.Add(new VisualUniforms(new Color4(0, 0, 1f, 0.3f)));
     _frame.IsVisible = false;
     Childrens.Add(_frame);
     InCount  = inCount;
     OutCount = outCount;
     Inputs   = new Edge[inCount];
     Outputs  = new Edge[outCount];
     Bits     = new Glyph7x5[inCount];
 }
Esempio n. 26
0
 protected void LoadChildrens()
 {
     UiServices.SetBusyState();
     foreach (IEvent se in Event.SubEvents)
     {
         Childrens.Add(CreateChildEventPanelViewmodelForEvent(se));
         IEvent ne = se.Next;
         while (ne != null)
         {
             Childrens.Add(CreateChildEventPanelViewmodelForEvent(ne));
             ne = ne.Next;
         }
     }
 }
Esempio n. 27
0
        public override void LoadFromBinaryReader(System.IO.Stream binaryReader)
        {
            base.LoadFromBinaryReader(binaryReader);

            var RMIH = new RoomImageHeader(this);

            RMIH.LoadFromBinaryReader(binaryReader);
            Childrens.Add(RMIH);

            var IM00 = new ImageData(this, 0, _roomBlock.GetRMHD());

            IM00.LoadFromBinaryReader(binaryReader);
            Childrens.Add(IM00);
        }
Esempio n. 28
0
        public RcpaTextField2(T txtValue, string key, string title, string defaultValue, bool required, Func <T, string> getFunc, Action <T, string> setFunc)
        {
            this.txtValue     = txtValue;
            this.title        = title;
            this.defaultValue = defaultValue;
            this.Required     = required;
            this.getFunc      = getFunc;
            this.setFunc      = setFunc;
            setFunc(txtValue, defaultValue);

            Adaptor = new OptionFileTextAdaptor <T>(txtValue, key, defaultValue, getFunc, setFunc);

            Childrens.Add(txtValue);
        }
 protected virtual void OnSubeventChanged(object o, CollectionOperationEventArgs <IEvent> e)
 {
     Debug.WriteLine(e.Item, $"OnSubEventChanged {e.Operation}");
     Application.Current.Dispatcher.BeginInvoke((Action) delegate()
     {
         if (e.Operation == TCollectionOperation.Remove && !IsExpanded && HasDummyChild && _event.SubEventsCount == 0)
         {
             Childrens.Remove(DummyChild);
         }
         if (e.Operation == TCollectionOperation.Insert && !IsExpanded && !HasDummyChild && _event.SubEventsCount > 0)
         {
             Childrens.Add(DummyChild);
         }
     });
 }
Esempio n. 30
0
        public void ConnectWire(StreamingVisual from, int outNum, StreamingVisual to, int inNum)
        {
            StreamingWire wire = new StreamingWire(from.SimpleShader);

            Childrens.Add(wire);
            List <Vector2> points = new List <Vector2>
            {
                from.OutputPosition(outNum),
                to.InputPosition(inNum)
            };

            wire.Path = points;
            from.ConnectTo(outNum, wire, 0);
            wire.ConnectTo(0, to, inNum);
        }