Exemple #1
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);
             }
         });
     }
 }
Exemple #2
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;
            }
        }
Exemple #3
0
 public override void RemoveElement(FileSystemElement fileSystemElement)
 {
     if (fileSystemElement != null && Childrens.Contains(fileSystemElement))
     {
         Childrens.Remove(fileSystemElement);
     }
 }
Exemple #4
0
 public void KeyDownRemove()
 {
     for (int i = 0; i < StreamingComponents.Count; i++)
     {
         var streamingVis = StreamingComponents[i];
         if (streamingVis.IsSelect)
         {
             StreamingComponents.RemoveAt(i);
             i--;
             Childrens.Remove(streamingVis);
         }
     }
 }
 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);
         }
     });
 }
        protected override void StartAnimation()
        {
            GlyphResult = new Glyph7x5(' ', new Vector2(Delta * 4, -5), SimpleShader);
            Childrens.Add(GlyphResult);

            Bits[0].Animation("Translate", new Vector2(0, -5), 500, () =>
            {
                GlyphResult.Char = Bits.Count(x => x.Char == '1') % 2 == 1 ? '1' : '0';
                GlyphResult.Animation("Translate", GlyphResult.Translate, 400, () =>
                {
                    GlyphPlus.Char  = ' ';
                    GlyphEqual.Char = ' ';
                    for (int i = 0; i < Bits.Length; i++)
                    {
                        var localI = i;
                        Bits[localI].Animation("Translate", Bits[localI].Translate, 200, () =>
                        {
                            Childrens.Remove(Bits[localI]);
                            Bits[localI] = null;
                        });
                        Bits[i].Char = ' ';
                    }
                    GlyphResult.Animation("Translate", new Vector2(Delta * 4 + 2, Delta * 2 + 2), 200, () =>
                    {
                        EndAnimation(GlyphResult, 0);
                        GlyphResult = null;
                    });
                });
            });

            for (int i = 1; i < Bits.Length; i++)
            {
                int localI = i;
                Bits[localI].Animation("Translate", new Vector2(Delta * 2, -5), 500);
            }
            GlyphPlus.Char  = '+';
            GlyphEqual.Char = '=';
        }
        public StreamingRegister(SimpleShader simpleShader)
            : base(simpleShader, 1, 1)
        {
            Size = new Vector2(Delta * 6, Delta * 2);
            InstasingList.Add(new VisualUniforms(Color4.Black));
            var vertices = new List <Vector2>();

            vertices.AddRange(Rectangle(
                                  new Vector2(Delta, 0),
                                  new Vector2(Delta * 5, Delta * 2), 2));
            Shape = vertices.ToArray();

            CreateInput(0, ConnectorOrientation.Left, new Vector2(0, Delta));
            CreateOutput(0, ConnectorOrientation.Right, new Vector2(Delta * 6, Delta));

            GlyphWord.CollectionChanged += (s, e) =>
            {
                if (e.NewItems != null)
                {
                    foreach (Glyph7x5 glyph in e.NewItems)
                    {
                        Childrens.Add(glyph);
                    }
                }
                if (e.OldItems != null)
                {
                    foreach (Glyph7x5 glyph in e.OldItems)
                    {
                        Childrens.Remove(glyph);
                    }
                }
            };

            Word        = _word;
            MemoryGlyph = new Glyph7x5('0', new Vector2(Delta * 2.5f, Delta * 2 + 2), SimpleShader);
            Childrens.Add(MemoryGlyph);
        }
Exemple #8
0
        public override void Load()
        {
            EditorUtility.DisplayCancelableProgressBar("Hold on", "", 0);
            AssetDatabase.SaveAssets();
            string[]         allAsset     = AssetDatabase.GetAllAssetPaths();
            HashSet <string> removedPaths = new HashSet <string>(LastUpdateTimes.Keys);

            removedPaths.ExceptWith(allAsset);
            Debug.Log(removedPaths.Count);
            foreach (var path in removedPaths)
            {
                if (Childrens.ContainsKey(path))
                {
                    foreach (var p in Childrens[path])
                    {
                        if (Parents.ContainsKey(p))
                        {
                            Parents[p].Remove(path);
                        }
                    }
                    Childrens.Remove(path);
                }
                if (Parents.ContainsKey(path))
                {
                    foreach (var p in Parents[path])
                    {
                        if (Childrens.ContainsKey(p))
                        {
                            Childrens[p].Remove(path);
                        }
                    }
                    Parents.Remove(path);
                }
                LastUpdateTimes.Remove(path);
            }
            int count = allAsset.Length;

            for (int i = 0; i < count; i++)
            {
                if (i % 100 == 0)
                {
                    if (EditorUtility.DisplayCancelableProgressBar("Hold on", "GetDependencies " + i + "/" + count, (float)i / count))
                    {
                        EditorUtility.ClearProgressBar();
                        return;
                    }
                }
                string p    = allAsset[i];
                var    time = File.GetLastWriteTime(p);
                if (!LastUpdateTimes.ContainsKey(p) || LastUpdateTimes[p] < time)
                {
                    if (Childrens.ContainsKey(p))
                    {
                        foreach (var ps in Childrens[p])
                        {
                            if (Parents.ContainsKey(ps))
                            {
                                Parents[ps].Remove(p);
                            }
                        }
                    }
                    var dp = AssetDatabase.GetDependencies(p, false);
                    Childrens[p] = new UStringList();
                    Childrens[p].AddRange(dp);
                    Childrens[p].Remove(p);
                    foreach (var d in dp)
                    {
                        if (d == p)
                        {
                            continue;
                        }
                        if (!Parents.ContainsKey(d))
                        {
                            Parents.Add(d, new UStringList());
                        }
                        Parents[d].Remove(p);
                        Parents[d].Add(p);
                    }
                    LastUpdateTimes[p] = time;
                }
            }
            EditorUtility.SetDirty(this);
            AssetDatabase.SaveAssets();
            EditorUtility.ClearProgressBar();
        }
Exemple #9
0
 public void RemoveChild(IDataNode node)
 {
     Childrens.Remove(node);
 }