示例#1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MeasureContext"/> class.
 /// </summary>
 protected MeasureContext(Typeface typeface, double fontSize, CultureInfo culture, System.Windows.FlowDirection flowDirection, IReadOnlyDictionary <BrushSettings, Brush> brushTable, IReadOnlyDictionary <PenSettings, Pen> penTable)
 {
     Typeface             = typeface;
     FontSize             = fontSize;
     Culture              = culture;
     FlowDirection        = flowDirection;
     SubscriptRatio       = 0.7;
     CommaSeparatorString = ", ";
     DotSeparatorString   = "·";
     BrushTable           = brushTable ?? DefaultBrushTable;
     PenTable             = penTable ?? DefaultPenTable;
 }
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value is System.Windows.FlowDirection)
            {
                System.Windows.FlowDirection direction = (System.Windows.FlowDirection)value;
                switch (direction)
                {
                case System.Windows.FlowDirection.LeftToRight:
                    return(1);

                case System.Windows.FlowDirection.RightToLeft:
                    return(-1);

                default:
                    throw new ArgumentException("Unexpected FlowDirection Value");
                }
            }
            throw new ArgumentException("Expected value of type System.Windows.FlowDirection");
        }
示例#3
0
        // Initialize the app's font and flow direction as defined in its localized resource strings.
        //
        // To ensure that the font of your application is aligned with its supported languages and that the
        // FlowDirection for each of those languages follows its traditional direction, ResourceLanguage
        // and ResourceFlowDirection should be initialized in each resx file to match these values with that
        // file's culture. For example:
        //
        // AppResources.es-ES.resx
        //    ResourceLanguage's value should be "es-ES"
        //    ResourceFlowDirection's value should be "LeftToRight"
        //
        // AppResources.ar-SA.resx
        //     ResourceLanguage's value should be "ar-SA"
        //     ResourceFlowDirection's value should be "RightToLeft"
        //
        // For more info on localizing Windows Phone apps see http://go.microsoft.com/fwlink/?LinkId=262072.
        //
        private void InitializeLanguage()
        {
#if false
            try
            {
                // Set the font to match the display language defined by the
                // ResourceLanguage resource string for each supported language.
                //
                // Fall back to the font of the neutral language if the Display
                // language of the phone is not supported.
                //
                // If a compiler error is hit then ResourceLanguage is missing from
                // the resource file.
                RootFrame.Language = System.Windows.Markup.XmlLanguage.GetLanguage(AppResources.ResourceLanguage);

                // Set the FlowDirection of all elements under the root frame based
                // on the ResourceFlowDirection resource string for each
                // supported language.
                //
                // If a compiler error is hit then ResourceFlowDirection is missing from
                // the resource file.
                System.Windows.FlowDirection flow = (System.Windows.FlowDirection)Enum.Parse(typeof(System.Windows.FlowDirection), AppResources.ResourceFlowDirection);
                RootFrame.FlowDirection = flow;
            }
            catch
            {
                // If an exception is caught here it is most likely due to either
                // ResourceLangauge not being correctly set to a supported language
                // code or ResourceFlowDirection is set to a value other than LeftToRight
                // or RightToLeft.

                if (System.Diagnostics.Debugger.IsAttached)
                {
                    System.Diagnostics.Debugger.Break();
                }

                throw;
            }
#endif
        }
示例#4
0
        /// <summary>
        /// Creates and initializes a new context.
        /// </summary>
        public static MeasureContext CreateMeasureContext(Typeface typeface, double fontSize, CultureInfo culture, System.Windows.FlowDirection flowDirection, IReadOnlyDictionary <BrushSettings, Brush> brushTable, IReadOnlyDictionary <PenSettings, Pen> penTable)
        {
            MeasureContext Result = new MeasureContext(typeface, fontSize, culture, flowDirection, brushTable, penTable);

            Result.Update();
            return(Result);
        }
 public AnnotationDocumentPaginator(System.Windows.Documents.DocumentPaginator originalPaginator, Stream annotationStore, System.Windows.FlowDirection flowDirection)
 {
     Contract.Requires(originalPaginator != null);
 }
示例#6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DrawContext"/> class.
        /// </summary>
        /// <param name="typeface">The font to use for text.</param>
        /// <param name="fontSize">The font size to use for text.</param>
        /// <param name="culture">The culture to use for text.</param>
        /// <param name="flowDirection">The flow direction to use for text.</param>
        /// <param name="brushTable">Brushes for each element to display.</param>
        /// <param name="penTable">Pens for each element to display.</param>
        /// <param name="hasCommentIcon">True if the comment icon must be displayed.</param>
        /// <param name="displayFocus">True if focused elements should be displayed as such.</param>
        protected DrawContext(Typeface typeface, double fontSize, CultureInfo culture, System.Windows.FlowDirection flowDirection, IReadOnlyDictionary <BrushSettings, Brush> brushTable, IReadOnlyDictionary <PenSettings, Pen> penTable, bool hasCommentIcon, bool displayFocus)
            : base(typeface, fontSize, culture, flowDirection, brushTable, penTable)
        {
            IsLastFocusedFullCell = false;
            DisplayFocus          = displayFocus;

            FlashAnimation = new DoubleAnimation(0, new System.Windows.Duration(TimeSpan.FromSeconds(1)));
            FlashAnimation.RepeatBehavior = RepeatBehavior.Forever;
            FlashAnimation.EasingFunction = new FlashEasingFunction();
            FlashClock = FlashAnimation.CreateClock();

            if (hasCommentIcon)
            {
                CommentIcon = LoadPngResource("Comment");
            }
        }
示例#7
0
        /// <summary>
        /// Creates and initializes a new context.
        /// </summary>
        /// <param name="typeface">The font to use for text.</param>
        /// <param name="fontSize">The font size to use for text.</param>
        /// <param name="culture">The culture to use for text.</param>
        /// <param name="flowDirection">The flow direction to use for text.</param>
        /// <param name="brushTable">Brushes for each element to display.</param>
        /// <param name="penTable">Pens for each element to display.</param>
        /// <param name="hasCommentIcon">True if the comment icon must be displayed.</param>
        /// <param name="displayFocus">True if focused elements should be displayed as such.</param>
        public static DrawContext CreateDrawContext(Typeface typeface, double fontSize, CultureInfo culture, System.Windows.FlowDirection flowDirection, IReadOnlyDictionary <BrushSettings, Brush> brushTable, IReadOnlyDictionary <PenSettings, Pen> penTable, bool hasCommentIcon, bool displayFocus)
        {
            DrawContext Result = new DrawContext(typeface, fontSize, culture, flowDirection, brushTable, penTable, hasCommentIcon, displayFocus);

            Result.Update();
            return(Result);
        }
 public FormattedText(string textToFormat, System.Globalization.CultureInfo culture, System.Windows.FlowDirection flowDirection, Typeface typeface, double emSize, Brush foreground, NumberSubstitution numberSubstitution, TextFormattingMode textFormattingMode)
 {
 }
 public FormattedText(string textToFormat, System.Globalization.CultureInfo culture, System.Windows.FlowDirection flowDirection, Typeface typeface, double emSize, Brush foreground)
 {
 }