public void Remove(object value)
        {
            var index = IndexOf(value);

            if (value is Script)
            {
                var script = value as Script;
                if (Scripts.Contains(script))
                {
                    Scripts.Remove(script);

                    OnScriptRemoved(script, index);
                }
            }
            else if (value is Brick)
            {
                foreach (var script in Scripts)
                {
                    if (script.Bricks.Contains(value as Brick))
                    {
                        script.Bricks.Remove(value as Brick);
                        OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, value, index));
                    }
                }
            }
        }
示例#2
0
 public void AddScript(string scriptTag)
 {
     if (!Scripts.Contains(scriptTag))
     {
         Scripts.Add(scriptTag);
     }
     SetToRequest(this);
 }
示例#3
0
 //_____________________________________________________________________________________________________________________________________________________________
 private void AddScript(string name)
 {
     if (!File.Exists(name) || Scripts.Contains(name))
     {
         return;
     }
     Scripts.Add(name);
     File.WriteAllLines(fullProjectFileName, Scripts.ToArray());
 }
        public bool Contains(object value)
        {
            if (Scripts.Contains(value as Script))
            {
                return(true);
            }
            else
            {
                foreach (var script in Scripts)
                {
                    if (script.Bricks.Contains(value as Brick))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }