Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="d"></param>
        /// <param name="e"></param>
        private static void OnDataChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            HexView ths = d as HexView;

            IEnumerable <byte> data = ths.Data;

            if (data == null)
            {
                ths.byteCount = 0;
            }
            else
            {
                ICollection <byte> coll = data as ICollection <byte>;
                if (coll != null)
                {
                    ths.byteCount = coll.Count;
                }
                else
                {
                    IEnumerator <byte> en = data.GetEnumerator();
                    ths.byteCount = 0;
                    while (en.MoveNext())
                    {
                        ++ths.byteCount;
                    }
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="d"></param>
        /// <param name="baseValue"></param>
        /// <returns></returns>
        private static object OnFontFamilyCoerce(DependencyObject d, Object baseValue)
        {
            HexView    hv = d as HexView;
            FontFamily ff = baseValue as FontFamily;

            if (hv.IsFixedPitch(ff))
            {
                return(baseValue);
            }
            else
            {
                return(new FontFamily(fontFamilyName));
            }
        }