示例#1
0
        //--------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="Panel"/> class.
        /// </summary>
        protected Panel()
        {
            Style = "Panel";

              Children = new NotifyingCollection<UIControl>(false, false);
              Children.CollectionChanged += OnChildrenChanged;
        }
示例#2
0
        public TreeView()
        {
            Style = "TreeView";

            Items = new NotifyingCollection <TreeViewItem>(false, false);
            Items.CollectionChanged += (s, e) => OnItemsChanged();
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DropDownButton"/> class.
        /// </summary>
        public DropDownButton()
        {
            Style = "DropDownButton";

            Items = new NotifyingCollection <object>(false, true);
            Items.CollectionChanged += OnItemsChanged;

            // Connect OnSelectedIndexChanged() to SelectedIndex property.
            var selectedIndex = Properties.Get <int>(SelectedIndexPropertyId);

            selectedIndex.Changed += OnSelectedIndexChanged;

            // We have a DropDown. It is opened or closed, when this DropDownButton is clicked.
            var click = Events.Get <EventArgs>("Click");

            click.Event += (s, e) =>
            {
                if (_dropDown == null)
                {
                    return;
                }

                // We must check the drop down state of the last frame. Because
                // it might have already been closed in this frame...
                if (!_wasOpened)
                {
                    _dropDown.Open();
                }
                else
                {
                    _dropDown.Close();
                }
            };
        }
        public CQTextLoginCredentialManager(
            NotifyingCollection <CustomSetting> settings)
        {
            UserName      = null;
            Password      = null;
            AdminUserName = string.Empty;   // admin session login is optional
            AdminPassword = string.Empty;   // admin session login is optional
            foreach (var setting in settings)
            {
                if (setting.SettingKey.Equals(ClearQuestConstants.UserNameKey))
                {
                    UserName = setting.SettingValue;
                }
                else if (setting.SettingKey.Equals(ClearQuestConstants.PasswordKey))
                {
                    Password = setting.SettingValue;
                }
                else if (setting.SettingKey.Equals(ClearQuestConstants.AdminUserNameKey))
                {
                    AdminUserName = setting.SettingValue;
                }
                else if (setting.SettingKey.Equals(ClearQuestConstants.AdminPasswordKey))
                {
                    AdminPassword = setting.SettingValue;
                }
            }

            if (UserName == null || Password == null)
            {
                throw new ClearQuestInvalidConfigurationException(ClearQuestResource.ClearQuest_Config_IncompleteLoginCredentialSetting);
            }
        }
示例#5
0
        public void Test1()
        {
            _list = new List <string>();

            var collection = new NotifyingCollection <string>(false, false);

            collection.CollectionChanged += OnCollectionChanged;

            CompareCollections(_list, collection);

            collection.Add("a");
            Assert.AreEqual(1, collection.Count);
            CompareCollections(_list, collection);

            collection.Add("b");
            collection.Add("c");
            Assert.AreEqual(3, collection.Count);
            CompareCollections(_list, collection);

            collection[1] = "d";
            Assert.AreEqual(3, collection.Count);
            CompareCollections(_list, collection);

            collection[1] = collection[1];
            Assert.AreEqual(3, collection.Count);
            CompareCollections(_list, collection);

            collection.RemoveAt(0);
            Assert.AreEqual(2, collection.Count);
            CompareCollections(_list, collection);

            collection.Clear();
            CompareCollections(_list, collection);
            Assert.AreEqual(0, collection.Count);
        }
示例#6
0
    public TreeView()
    {
      Style = "TreeView";

      Items = new NotifyingCollection<TreeViewItem>(false, false);
      Items.CollectionChanged += (s, e) => OnItemsChanged();
    }
示例#7
0
        public void TestDuplicateElements()
        {
            NotifyingCollection <string> collection = new NotifyingCollection <string>(true, false);

            collection.Add("a");
            collection.Add(collection[0]);
        }
示例#8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Panel"/> class.
        /// </summary>
        protected Panel()
        {
            Style = "Panel";

            Children = new NotifyingCollection <UIControl>(false, false);
            Children.CollectionChanged += OnChildrenChanged;
        }
示例#9
0
 public SerializableSource(MigrationSource source, NotifyingCollection <MigrationSource> sources, NotifyingCollection <Session> sessions, ConfigurationViewModel configuration)
     : base(source)
 {
     m_configuration = configuration;
     m_sources       = sources;
     m_sessions      = sessions;
 }
示例#10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UIScreen"/> class.
        /// </summary>
        /// <param name="name">The name of the screen.</param>
        /// <param name="renderer">
        /// The renderer that defines the styles and visual appearance for controls in this screen.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="name"/> or <paramref name="renderer"/> is <see langword="null"/>.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// <paramref name="name"/> is an empty string.
        /// </exception>
        public UIScreen(string name, IUIRenderer renderer)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (name.Length == 0)
            {
                throw new ArgumentException("String is empty.", "name");
            }
            if (renderer == null)
            {
                throw new ArgumentNullException("renderer");
            }

            Name     = name;
            Renderer = renderer;

            Style = "UIScreen";

            Children = new NotifyingCollection <UIControl>(false, false);
            Children.CollectionChanged += OnChildrenChanged;

            _focusManager  = new FocusManager(this);
            ToolTipManager = new ToolTipManager(this);

#if !SILVERLIGHT
            // Call OnVisibleChanged when IsVisible changes.
            var isVisible = Properties.Get <bool>(IsVisiblePropertyId);
            isVisible.Changed += (s, e) => OnVisibleChanged(EventArgs.Empty);
#endif

            InputEnabled = true;
        }
示例#11
0
        public static void Main()
        {
            NotifyingCollection watchable = new NotifyingCollection(10);

            watchable.CollectionChanged += new  NotifyCollectionChangedEventHandler(watchable_CollectionChanged);

            watchable.Add(5);
            watchable.Add(8);
            watchable.Insert(0, 9);
            watchable.Remove(8);
            watchable.Add(11);

            Console.WriteLine("Current values:");
            foreach (object i in watchable)
            {
                Console.WriteLine(i.ToString());
            }

            Console.WriteLine(string.Empty);

            watchable.Clear();
            //And the event handler…

            Thread.Sleep(Timeout.Infinite);
        }
示例#12
0
        public void TestNullElements3()
        {
            var collection = new NotifyingCollection <string>(false, true);

            collection.Add("a");
            collection[0] = null;
        }
 public void DuplicateNullValues()
 {
     // Duplicate null values should be allowed, even if allowDuplicates is false.
       var collection = new NotifyingCollection<string>(true, false);
       collection.Add(null);
       collection.Add(null);
 }
 protected ManagerViewModelBase(MainWindowViewModel mainWindowViewModel, Func <GameSave, IEnumerable <TItem> > itemsProjection)
 {
     this.MainWindowViewModel       = mainWindowViewModel;
     this._itemsProjection          = itemsProjection;
     this._filteredItems            = this._items = new NotifyingCollection <TItem>();
     this.ItemFilters.FilterChange += this.ItemFilters_FilterChange;
     this.RepopulateItems();
 }
示例#15
0
        public void TestDuplicateElements2()
        {
            var collection = new NotifyingCollection <string>(true, false);

            collection.Add("a");
            collection.Add("b");
            collection.Insert(1, collection[0]);
        }
示例#16
0
        public void TestDuplicateElements3()
        {
            var collection = new NotifyingCollection <string>(true, false);

            collection.Add("a");
            collection.Add("b");
            collection[0] = collection[1];
        }
示例#17
0
 public ItemModel(Item item)
     : base(item)
 {
     this._itemBuffs = new NotifyingCollection <Buff>(item.ItemBuffs.List);
     this._itemBuffs.CollectionChanged += this.Buffs_CollectionChanged;
     this._playerBuffs = new NotifyingCollection <Buff>(item.PlayerBuffs);
     this._playerBuffs.CollectionChanged += this.Buffs_CollectionChanged;
 }
示例#18
0
 public WrappedType(Type type)
 {
     this.type              = type;
     this.fieldName         = "_" + type.Name;
     this.wrappedMethods    = new NotifyingCollection <WrappedMethod> ();
     this.wrappedProperties = new NotifyingCollection <WrappedProperty> ();
     this.wrappedEvents     = new NotifyingCollection <WrappedEvent> ();
 }
示例#19
0
        public void DuplicateNullValues()
        {
            // Duplicate null values should be allowed, even if allowDuplicates is false.
            var collection = new NotifyingCollection <string>(true, false);

            collection.Add(null);
            collection.Add(null);
        }
 public WrapperClass()
 {
     this.className    = "MyWrapperClass";
     this._namespace   = "MyNamespace";
     this.partial      = false;
     this._sealed      = false;
     this.wrappedTypes = new NotifyingCollection <WrappedType> ();
 }
示例#21
0
        public AssemblyBrowser()
        {
            InitializeComponent();

            this.assemblies            = new NotifyingCollection <string> ();
            this.assemblies.ItemAdded += this.OnAssemblyAdded;

            AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += this.OnReflectionOnlyAssemblyResolve;
        }
示例#22
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ContextMenu"/> class.
        /// </summary>
        public ContextMenu()
        {
            Style = "ContextMenu";

            Items = new NotifyingCollection <UIControl>(false, false);
            Items.CollectionChanged += OnItemsChanged;


            TouchPanel.EnabledGestures |= GestureType.Hold;
        }
示例#23
0
        public void TestAllowedNullsAndDuplicates()
        {
            var collection = new NotifyingCollection <string>(true, true);

            collection.Add(null);
            collection.Add("a");
            collection.Add(collection[1]);

            Assert.AreEqual(3, collection.Count);
        }
示例#24
0
        public void TestDuplicateElements4()
        {
            var collection = new NotifyingCollection <string>(true, false);

            collection.Add("a");
            collection.Add("b");

            Assert.That(() => collection[1] = "a", Throws.ArgumentException);

            // But replacing the same item should work!
            collection[0] = "a";
        }
        private void Initialize(NotifyingCollection <UserMappings> userMappings)
        {
            foreach (UserMappings userMappingCollection in userMappings)
            {
                if (!m_perDirectionUserMappings.ContainsKey(userMappingCollection.DirectionOfMapping))
                {
                    m_perDirectionUserMappings.Add(userMappingCollection.DirectionOfMapping, new NotifyingCollection <UserMapping>());
                }

                m_perDirectionUserMappings[userMappingCollection.DirectionOfMapping].AddRange(userMappingCollection.UserMapping.ToArray());
            }
        }
        public IdentityLookupContextManager(
            NotifyingCollection <Session> sessions)
        {
            foreach (Session s in sessions)
            {
                Guid leftMigrSrcId  = new Guid(s.LeftMigrationSourceUniqueId);
                Guid rightMigrSrcId = new Guid(s.RightMigrationSourceUniqueId);
                Debug.Assert(!m_leftToRightMigrationSourcePairs.ContainsKey(leftMigrSrcId), "Duplicate left Migration Source Ids");

                m_leftToRightMigrationSourcePairs.Add(leftMigrSrcId, rightMigrSrcId);
            }
        }
        private void Initialize(NotifyingCollection <DomainMappings> domainMappings)
        {
            foreach (DomainMappings mappingCollection in domainMappings)
            {
                if (!m_perDirectionMappings.ContainsKey(mappingCollection.DirectionOfMapping))
                {
                    m_perDirectionMappings.Add(mappingCollection.DirectionOfMapping, new NotifyingCollection <DomainMapping>());
                }

                m_perDirectionMappings[mappingCollection.DirectionOfMapping].AddRange(mappingCollection.DomainMapping.ToArray());
            }
        }
        public void GetEnumerator()
        {
            var collection = new NotifyingCollection<string>(true, false);
              collection.Add("a");
              collection.Add("b");

              var enumerator = collection.GetEnumerator();
              enumerator.MoveNext();
              Assert.AreEqual("a", enumerator.Current);
              enumerator.MoveNext();
              Assert.AreEqual("b", enumerator.Current);
        }
        public void ValidateRegisteredAddins(NotifyingCollection <AddinElement> addinElemCollection)
        {
            List <Guid> configuredAndLoadedAddins = new List <Guid>(addinElemCollection.Count);
            Dictionary <Guid, AddinElement> configuredButNotLoadedAddins = new Dictionary <Guid, AddinElement>();

            foreach (var addinElem in addinElemCollection)
            {
                Guid addinRefName = new Guid(addinElem.ReferenceName);

                if (!m_addIns.ContainsKey(addinRefName))
                {
                    // this configured add-in is not loaded
                    if (!configuredButNotLoadedAddins.ContainsKey(addinRefName))
                    {
                        configuredButNotLoadedAddins.Add(addinRefName, addinElem);
                    }
                }
                else if (!configuredAndLoadedAddins.Contains(addinRefName))
                {
                    // this add-in is configured and loaded
                    configuredAndLoadedAddins.Add(addinRefName);
                }
            }

            List <Guid> loadedButNotConfiguredAddins = new List <Guid>(m_addIns.Count);

            foreach (Guid loadedAddin in m_addIns.Keys)
            {
                if (!configuredAndLoadedAddins.Contains(loadedAddin))
                {
                    // this loaded add-in is not configured for use
                    if (!loadedButNotConfiguredAddins.Contains(loadedAddin))
                    {
                        loadedButNotConfiguredAddins.Add(loadedAddin);
                    }
                }
            }

            if (configuredButNotLoadedAddins.Count > 0)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("Some Add-ins are configured for use but not loaded.");
                foreach (var configButNotLoadedAddin in configuredButNotLoadedAddins)
                {
                    sb.AppendFormat("{0} ({1})\n",
                                    configButNotLoadedAddin.Value.FriendlyName,
                                    configButNotLoadedAddin.Key.ToString());
                }

                throw new MigrationException(sb.ToString());
            }
        }
        public void RemoveEventRelayed()
        {
            Product first = new Product();
            Product second = new Product();
            NotifyingCollection<Product> source = new NotifyingCollection<Product>() { first, second };
            PagedEntityCollectionView<Product> view = new PagedEntityCollectionView<Product>(source);

            this.AssertCollectionChanged(
                () => source.Remove(first),
                view,
                new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, first, 0),
                "when removing the first item.");
        }
示例#31
0
        //--------------------------------------------------------------
        #region Creation & Cleanup
        //--------------------------------------------------------------

        /// <summary>
        /// Initializes a new instance of the <see cref="TabControl"/> class.
        /// </summary>
        public TabControl()
        {
            Style = "TabControl";

            Items = new NotifyingCollection <TabItem>(false, false);
            Items.CollectionChanged += OnItemsChanged;

            // When selected index changes, call Select. The user might have changed SelectedIndex
            // directly without using Select().
            var selectedIndex = Properties.Get <int>(SelectedIndexPropertyId);

            selectedIndex.Changed += (s, e) => Select(e.NewValue);
        }
        public MutantDetailsViewModel(IMutantDetailsView view)
            : base(view)
        {
            TestNamespaces = new NotifyingCollection <TestNodeNamespace>();

            CodeLanguages = new NotifyingCollection <CodeLanguage> {
                CodeLanguage.CSharp, CodeLanguage.IL
            };

            SelectedLanguage = CodeLanguage.CSharp;

            SelectedIndex = 1;
        }
示例#33
0
 public void TriggerChanged(NotifyingCollection <TItem> oldValue, NotifyingCollection <TItem> newValue)
 {
     if (this.Changed == null)
     {
         return;
     }
     ChangTransaction.Perform(delegate(ChangTransaction t)
     {
         ValueChangingEventArgs <NotifyingCollection <TItem> > e =
             new ValueChangingEventArgs <NotifyingCollection <TItem> >(oldValue, newValue, t);
         this.Changed(this, e);
     });
 }
示例#34
0
        public void GetEnumerator()
        {
            var collection = new NotifyingCollection <string>(true, false);

            collection.Add("a");
            collection.Add("b");

            var enumerator = collection.GetEnumerator();

            enumerator.MoveNext();
            Assert.AreEqual("a", enumerator.Current);
            enumerator.MoveNext();
            Assert.AreEqual("b", enumerator.Current);
        }
示例#35
0
        //--------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="Vehicle"/> class.
        /// </summary>
        /// <param name="simulation">The simulation.</param>
        /// <param name="chassis">The rigid body for the chassis.</param>
        /// <remarks>
        /// The car will NOT be automatically enabled! The property <see cref="Enabled"/> needs to be 
        /// set.
        /// </remarks>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="simulation"/> or <paramref name="chassis"/> is <see langword="null"/>.
        /// </exception>
        public Vehicle(Simulation simulation, RigidBody chassis)
        {
            if (simulation == null)
            throw new ArgumentNullException("simulation");
              if (chassis == null)
            throw new ArgumentNullException("chassis");

              Simulation = simulation;
              _chassis = chassis;
              _forceEffect = new VehicleForceEffect(this);

              Wheels = new NotifyingCollection<Wheel>(false, false);
              Wheels.CollectionChanged += OnWheelsChanged;
        }
示例#36
0
 public bool TriggerChanging(NotifyingCollection <TItem> oldValue, NotifyingCollection <TItem> newValue)
 {
     if (this.Changing == null)
     {
         return(true);
     }
     return(ChangTransaction.Perform(delegate(ChangTransaction t)
     {
         ValueChangingEventArgs <NotifyingCollection <TItem> > e =
             new ValueChangingEventArgs <NotifyingCollection <TItem> >(oldValue, newValue, t);
         this.Changing(this, e);
         return !e.Cancel;
     }));
 }
        public void AddEventRelayed()
        {
            Product first = new Product();
            Product second = new Product();
            NotifyingCollection<Product> source = new NotifyingCollection<Product>() { first, second };
            PagedEntityCollectionView<Product> view = new PagedEntityCollectionView<Product>(source);

            Product third = new Product();

            this.AssertCollectionChanged(
                () => source.Add(third),
                view,
                new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, third, 2),
                "when adding the third item.");
        }
        public void ResetEventRelayed()
        {
            Product first = new Product();
            Product second = new Product();
            NotifyingCollection<Product> source = new NotifyingCollection<Product>() { first, second };
            PagedEntityCollectionView<Product> view = new PagedEntityCollectionView<Product>(source);

            this.AssertCollectionChanged(
                () => source.Reset(),
                view,
                new NotifyCollectionChangedEventArgs[]
                {
                    new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset),
                    new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset), // Bug 706239
                },
                "when resetting the collection.");
        }
        public void MoveTest()
        {
            var c = new NotifyingCollection<int>();
              c.Add(1);
              c.Add(2);
              c.Add(3);
              c.Add(4);
              c.Add(5);

              c.CollectionChanged += OnMove;

              c.Move(0, 0);   // Ok, does nothing.
              c.Move(1, 4);

              Assert.AreEqual(1, c[0]);
              Assert.AreEqual(3, c[1]);
              Assert.AreEqual(4, c[2]);
              Assert.AreEqual(5, c[3]);
              Assert.AreEqual(2, c[4]);

              Assert.AreEqual(5, c.Count);
        }
 public void InsertRangeShouldThrowWhenNull()
 {
     var collection = new NotifyingCollection<string>();
       collection.InsertRange(0, null);
 }
示例#41
0
 private ShapeCollection GetShape(NotifyingCollection<ShapeBase> Coll)
 {
     if (Coll == null)
         return null;
     return this.CollsDic[Coll];
 }
 public void RemoveRangeShouldThrowWhenInvalidRange()
 {
     var collection = new NotifyingCollection<string>();
       collection.RemoveRange(0, 1);
 }
 public void InsertRangeShouldThrowWhenIndexIsWrong2()
 {
     var collection = new NotifyingCollection<string>();
       collection.InsertRange(1, new[] { "a" });
 }
        public void TestRangeMethods()
        {
            _list = new List<string>();

              var collection = new NotifyingCollection<string>(false, false);
              collection.CollectionChanged += OnCollectionChanged;

              CompareCollections(_list, collection);

              collection.AddRange(new[] { "a", "b", "c" });
              Assert.AreEqual(3, collection.Count);
              Assert.AreEqual("a", collection[0]);
              Assert.AreEqual("b", collection[1]);
              Assert.AreEqual("c", collection[2]);
              CompareCollections(_list, collection);

              collection.AddRange(new[] { "d", "e" });
              Assert.AreEqual(5, collection.Count);
              Assert.AreEqual("d", collection[3]);
              Assert.AreEqual("e", collection[4]);
              CompareCollections(_list, collection);

              collection.InsertRange(0, new string[0]);
              Assert.AreEqual(5, collection.Count);
              CompareCollections(_list, collection);

              collection.InsertRange(1, new[] { "i" });
              Assert.AreEqual(6, collection.Count);
              Assert.AreEqual("i", collection[1]);
              CompareCollections(_list, collection);

              collection.RemoveRange(2, 4);
              Assert.AreEqual(2, collection.Count);
              CompareCollections(_list, collection);
        }
 public void RemoveRangeWithEmptyRange()
 {
     var collection = new NotifyingCollection<string>();
       collection.RemoveRange(0, 0);
 }
 public void TestNullElements2()
 {
     var collection = new NotifyingCollection<string>(false, true);
       collection.Insert(0, null);
 }
 public void TestNullElements3()
 {
     var collection = new NotifyingCollection<string>(false, true);
       collection.Add("a");
       collection[0] = null;
 }
        public void MoveThrowsArgumentOutOfRangeException()
        {
            var c = new NotifyingCollection<int>();
              c.Add(1);
              c.Add(2);
              c.Add(3);
              c.Add(4);
              c.Add(5);

              Assert.Throws<ArgumentOutOfRangeException>(() => c.Move(-1, 1));
              Assert.Throws<ArgumentOutOfRangeException>(() => c.Move(5, 1));
              Assert.Throws<ArgumentOutOfRangeException>(() => c.Move(1, -1));
              Assert.Throws<ArgumentOutOfRangeException>(() => c.Move(-1, 5));
        }
 public void RemoveRangeShouldThrowWhenIndexIsWrong()
 {
     var collection = new NotifyingCollection<string>();
       collection.RemoveRange(-1, 0);
 }
        public void Test1()
        {
            _list = new List<string>();

              var collection = new NotifyingCollection<string>(false, false);
              collection.CollectionChanged += OnCollectionChanged;

              CompareCollections(_list, collection);

              collection.Add("a");
              Assert.AreEqual(1, collection.Count);
              CompareCollections(_list, collection);

              collection.Add("b");
              collection.Add("c");
              Assert.AreEqual(3, collection.Count);
              CompareCollections(_list, collection);

              collection[1] = "d";
              Assert.AreEqual(3, collection.Count);
              CompareCollections(_list, collection);

              collection[1] = collection[1];
              Assert.AreEqual(3, collection.Count);
              CompareCollections(_list, collection);

              collection.RemoveAt(0);
              Assert.AreEqual(2, collection.Count);
              CompareCollections(_list, collection);

              collection.Clear();
              CompareCollections(_list, collection);
              Assert.AreEqual(0, collection.Count);
        }
 public void TestDuplicateElements2()
 {
     var collection = new NotifyingCollection<string>(true, false);
       collection.Add("a");
       collection.Add("b");
       collection.Insert(1, collection[0]);
 }
 public void TestDuplicateElements()
 {
     NotifyingCollection<string> collection = new NotifyingCollection<string>(true, false);
       collection.Add("a");
       collection.Add(collection[0]);
 }
 public void AddRangeShouldThrowWhenNull()
 {
     var collection = new NotifyingCollection<string>();
       collection.AddRange(null);
 }
        public void TestAllowedNullsAndDuplicates()
        {
            var collection = new NotifyingCollection<string>(true, true);
              collection.Add(null);
              collection.Add("a");
              collection.Add(collection[1]);

              Assert.AreEqual(3, collection.Count);
        }
示例#55
0
    /// <summary>
    /// Initializes a new instance of the <see cref="UIScreen"/> class.
    /// </summary>
    /// <param name="name">The name of the screen.</param>
    /// <param name="renderer">
    /// The renderer that defines the styles and visual appearance for controls in this screen. 
    /// </param>
    /// <exception cref="ArgumentNullException">
    /// <paramref name="name"/> or <paramref name="renderer"/> is <see langword="null"/>.
    /// </exception>
    /// <exception cref="ArgumentException">
    /// <paramref name="name"/> is an empty string.
    /// </exception>
    public UIScreen(string name, IUIRenderer renderer)
    {
      if (name == null)
        throw new ArgumentNullException("name");
      if (name.Length == 0)
        throw new ArgumentException("String is empty.", "name");
      if (renderer == null)
        throw new ArgumentNullException("renderer");

      Name = name;
      Renderer = renderer;

      Style = "UIScreen";

      Children = new NotifyingCollection<UIControl>(false, false);
      Children.CollectionChanged += OnChildrenChanged;

      _focusManager = new FocusManager(this);
      ToolTipManager = new ToolTipManager(this);

#if !SILVERLIGHT
      // Call OnVisibleChanged when IsVisible changes.
      var isVisible = Properties.Get<bool>(IsVisiblePropertyId);
      isVisible.Changed += (s, e) => OnVisibleChanged(EventArgs.Empty);
#endif

      InputEnabled = true;
    }
 public void RemoveRangeShouldThrowWhenCountIsWrong2()
 {
     var collection = new NotifyingCollection<string>();
       collection.RemoveRange(0, -1);
 }
        public void TestDuplicateElements4()
        {
            var collection = new NotifyingCollection<string>(true, false);
              collection.Add("a");
              collection.Add("b");

              Assert.That(() => collection[1] = "a", Throws.ArgumentException);

              // But replacing the same item should work!
              collection[0] = "a";
        }
 public void TestNullElements()
 {
     var collection = new NotifyingCollection<string>(false, true);
       collection.Add(null);
 }
 public void TestDuplicateElements3()
 {
     var collection = new NotifyingCollection<string>(true, false);
       collection.Add("a");
       collection.Add("b");
       collection[0] = collection[1];
 }
示例#60
0
    //--------------------------------------------------------------
    #region Creation and Cleanup
    //--------------------------------------------------------------

    /// <summary>
    /// Initializes a new instance of the <see cref="CompositeShape"/> class.
    /// </summary>
    public ConvexHullOfShapes()
    {
      Children = new NotifyingCollection<IGeometricObject>(false, false);
      Children.CollectionChanged += OnChildrenChanged;
    }