コード例 #1
0
        //where we put event listeners
        #region event listeneres

        /// <summary>
        /// Will be called whenever someone makes a change to the "ProcessUnit" property
        /// </summary>
        /// <param name="d"></param>
        /// <param name="e"></param>
        private static void OnStreamPropertyChange(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            //cast the new value as a ProcessUnitType enum
            StreamType type = (StreamType)e.NewValue;

            //turn the DependencyObject into a ProcessUnitPaletteItem
            StreamPaletteItem item = (StreamPaletteItem)d;

            //get the associated process unit type
            IStream stream = StreamFactory.StreamFromStreamType(type);

            item.LocalStream = stream;

            //should use data binding, but meh
            item.IconSource  = StreamFactory.IconFromStreamType(type);
            item.Description = item.Description;
        }