Exemplo n.º 1
0
        /// <summary>
        ///     Initializes a new instance of the Chart class.
        /// </summary>
        public Chart()
        {
#if SILVERLIGHT
            DefaultStyleKey = typeof(Chart);
#endif
            // Create the backing collection for Series
            var series = new UniqueObservableCollection <ISeries>();
            series.CollectionChanged += SeriesCollectionChanged;
            _series = series;

            // Create the backing collection for Axes
            var axes = new UniqueObservableCollection <IAxis>();
            _axes = axes;

            ObservableCollection <IAxis> actualAxes = new SeriesHostAxesCollection(this, axes);
            actualAxes.CollectionChanged += ActualAxesCollectionChanged;
            InternalActualAxes            = actualAxes;
            ActualAxes = new ReadOnlyCollection <IAxis>(InternalActualAxes);

            // Create collection for LegendItems
            LegendItems = new AggregatedObservableCollection <object>();

            ChartAreaChildren = new AggregatedObservableCollection <UIElement>();
            ChartAreaChildren.ChildCollections.Add(_edgeAxes);
            ChartAreaChildren.ChildCollections.Add(_backgroundElements);
            ChartAreaChildren.ChildCollections.Add(Series);
            ChartAreaChildren.ChildCollections.Add(_foregroundElements);

            _chartAreaChildrenListAdapter.Collection = ChartAreaChildren;

            // Create a dispenser
            ResourceDictionaryDispenser = new ResourceDictionaryDispenser();
            ResourceDictionaryDispenser.ResourceDictionariesChanged +=
                delegate { OnResourceDictionariesChanged(EventArgs.Empty); };
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Initializes a new instance of the PieSeries class.
        /// </summary>
        public PieSeries()
        {
#if SILVERLIGHT
            this.DefaultStyleKey = typeof(PieSeries);
#endif
            ResourceDictionaryDispenser = new ResourceDictionaryDispenser();
            ResourceDictionaryDispenser.ResourceDictionariesChanged +=
                delegate { OnResourceDictionariesChanged(EventArgs.Empty); };
        }
        /// <summary>
        ///     Stops listening to the dispenser.
        /// </summary>
        public void Dispose()
        {
            if (_parentEnumerator != null)
            {
                _parentEnumerator.Dispose();
            }

            ResourceDictionaryDispenser.Unregister(this);
            GC.SuppressFinalize(this);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the Chart class.
        /// </summary>
        public Chart()
        {
            // Create the backing collection for Series
            UniqueObservableCollection <ISeries> series = new UniqueObservableCollection <ISeries>();

            series.CollectionChanged += new NotifyCollectionChangedEventHandler(SeriesCollectionChanged);
            _series = series;

            // Create the backing collection for Axes
            UniqueObservableCollection <IAxis> axes = new UniqueObservableCollection <IAxis>();

            _axes = axes;

            ObservableCollection <IAxis> actualAxes = new SeriesHostAxesCollection(this, axes);

            actualAxes.CollectionChanged += ActualAxesCollectionChanged;
            this.InternalActualAxes       = actualAxes;
            this.ActualAxes = new ReadOnlyCollection <IAxis>(InternalActualAxes);

            // Create collection for LegendItems
            LegendItems = new AggregatedObservableCollection <object>();

            ChartAreaChildren = new AggregatedObservableCollection <UIElement>();
            ChartAreaChildren.ChildCollections.Add(_edgeAxes);
            ChartAreaChildren.ChildCollections.Add(_backgroundElements);
            ChartAreaChildren.ChildCollections.Add(Series);
            ChartAreaChildren.ChildCollections.Add(_foregroundElements);

            _chartAreaChildrenListAdapter.Collection = ChartAreaChildren;

            // Create a dispenser
            ResourceDictionaryDispenser = new ResourceDictionaryDispenser();
            ResourceDictionaryDispenser.ResourceDictionariesChanged += delegate
            {
                OnResourceDictionariesChanged(EventArgs.Empty);
            };
        }
Exemplo n.º 5
0
 /// <summary>
 /// Returns a rotating enumerator of ResourceDictionary objects that coordinates
 /// with the dispenser object to ensure that no two enumerators are on the same
 /// item. If the dispenser is reset or its collection is changed then the
 /// enumerators are also reset.
 /// </summary>
 /// <param name="predicate">A predicate that returns a value indicating
 /// whether to return an item.</param>
 /// <returns>An enumerator of ResourceDictionaries.</returns>
 public IEnumerator <ResourceDictionary> GetResourceDictionariesWhere(Func <ResourceDictionary, bool> predicate)
 {
     return(ResourceDictionaryDispenser.GetResourceDictionariesWhere(predicate));
 }
Exemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the Chart class.
        /// </summary>
        public Chart()
        {
#if SILVERLIGHT
            DefaultStyleKey = typeof(Chart);
#endif
            // Create the backing collection for Series
            UniqueObservableCollection<ISeries> series = new UniqueObservableCollection<ISeries>();
            series.CollectionChanged += new NotifyCollectionChangedEventHandler(SeriesCollectionChanged);
            _series = series;

            // Create the backing collection for Axes
            UniqueObservableCollection<IAxis> axes = new UniqueObservableCollection<IAxis>();
            _axes = axes;

            ObservableCollection<IAxis> actualAxes = new SeriesHostAxesCollection(this, axes);
            actualAxes.CollectionChanged += ActualAxesCollectionChanged;
            this.InternalActualAxes = actualAxes;
            this.ActualAxes = new ReadOnlyCollection<IAxis>(InternalActualAxes);

            // Create collection for LegendItems
            LegendItems = new AggregatedObservableCollection<object>();

            ChartAreaChildren = new AggregatedObservableCollection<UIElement>();
            ChartAreaChildren.ChildCollections.Add(_edgeAxes);
            ChartAreaChildren.ChildCollections.Add(_backgroundElements);
            ChartAreaChildren.ChildCollections.Add(Series);
            ChartAreaChildren.ChildCollections.Add(_foregroundElements);

            _chartAreaChildrenListAdapter.Collection = ChartAreaChildren;

            // Create a dispenser
            ResourceDictionaryDispenser = new ResourceDictionaryDispenser();
            ResourceDictionaryDispenser.ResourceDictionariesChanged += delegate
            {
                OnResourceDictionariesChanged(EventArgs.Empty);
            };
        }
 /// <summary>
 ///     Initializes a new instance of a ResourceDictionaryEnumerator.
 /// </summary>
 /// <param name="dispenser">
 ///     The dispenser that dispensed this
 ///     ResourceDictionaryEnumerator.
 /// </param>
 /// <param name="predicate">
 ///     A predicate used to determine which
 ///     ResourceDictionaries to return.
 /// </param>
 public ResourceDictionaryEnumerator(ResourceDictionaryDispenser dispenser,
                                     Func <ResourceDictionary, bool> predicate)
 {
     ResourceDictionaryDispenser = dispenser;
     Predicate = predicate;
 }
 /// <summary>
 ///     Raises the EnumeratorResourceDictionaryDispensed.
 /// </summary>
 /// <param name="args">Information about the ResourceDictionary dispensed.</param>
 protected virtual void OnStyleDispensed(ResourceDictionaryDispensedEventArgs args)
 {
     ResourceDictionaryDispenser.EnumeratorResourceDictionaryDispensed(this, args);
 }