1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using System.Windows;
|
---|
6 |
|
---|
7 | namespace Microsoft.Research.DynamicDataDisplay.Charts
|
---|
8 | {
|
---|
9 | public static class BackgroundRenderer
|
---|
10 | {
|
---|
11 | #region RenderingFinished event
|
---|
12 |
|
---|
13 | public static readonly RoutedEvent RenderingFinished = EventManager.RegisterRoutedEvent(
|
---|
14 | "RenderingFinished",
|
---|
15 | RoutingStrategy.Bubble,
|
---|
16 | typeof(RoutedEventHandler),
|
---|
17 | typeof(BackgroundRenderer));
|
---|
18 |
|
---|
19 | public static void RaiseRenderingFinished(FrameworkElement eventSource)
|
---|
20 | {
|
---|
21 | eventSource.RaiseEvent(new RoutedEventArgs(RenderingFinished));
|
---|
22 | }
|
---|
23 |
|
---|
24 | #endregion
|
---|
25 |
|
---|
26 | #region RenderingState property
|
---|
27 |
|
---|
28 | public static RenderingState GetRenderingState(DependencyObject obj)
|
---|
29 | {
|
---|
30 | return (RenderingState)obj.GetValue(RenderingStateProperty);
|
---|
31 | }
|
---|
32 |
|
---|
33 | public static void SetRenderingState(DependencyObject obj, RenderingState value)
|
---|
34 | {
|
---|
35 | obj.SetValue(RenderingStateProperty, value);
|
---|
36 | }
|
---|
37 |
|
---|
38 | public static readonly DependencyProperty RenderingStateProperty = DependencyProperty.RegisterAttached(
|
---|
39 | "RenderingState",
|
---|
40 | typeof(RenderingState),
|
---|
41 | typeof(BackgroundRenderer),
|
---|
42 | new FrameworkPropertyMetadata(RenderingState.DuringRendering));
|
---|
43 |
|
---|
44 | #endregion RenderingState property
|
---|
45 |
|
---|
46 | #region UpdateRequestedEvent
|
---|
47 |
|
---|
48 | public static readonly RoutedEvent UpdateRequested = EventManager.RegisterRoutedEvent(
|
---|
49 | "UpdateRequested",
|
---|
50 | RoutingStrategy.Bubble,
|
---|
51 | typeof(RoutedEventHandler),
|
---|
52 | typeof(BackgroundRenderer));
|
---|
53 |
|
---|
54 | public static void RaiseUpdateRequested(FrameworkElement eventSource)
|
---|
55 | {
|
---|
56 | eventSource.RaiseEvent(new RoutedEventArgs(UpdateRequested));
|
---|
57 | }
|
---|
58 |
|
---|
59 | #endregion
|
---|
60 |
|
---|
61 | #region UsesBackgroundRendering
|
---|
62 |
|
---|
63 | public static bool GetUsesBackgroundRendering(DependencyObject obj)
|
---|
64 | {
|
---|
65 | return (bool)obj.GetValue(UsesBackgroundRenderingProperty);
|
---|
66 | }
|
---|
67 |
|
---|
68 | public static void SetUsesBackgroundRendering(DependencyObject obj, bool value)
|
---|
69 | {
|
---|
70 | obj.SetValue(UsesBackgroundRenderingProperty, value);
|
---|
71 | }
|
---|
72 |
|
---|
73 | public static readonly DependencyProperty UsesBackgroundRenderingProperty = DependencyProperty.RegisterAttached(
|
---|
74 | "UsesBackgroundRendering",
|
---|
75 | typeof(bool),
|
---|
76 | typeof(BackgroundRenderer),
|
---|
77 | new FrameworkPropertyMetadata(false));
|
---|
78 |
|
---|
79 | #endregion // end of UsesBackgroundRendering
|
---|
80 | }
|
---|
81 |
|
---|
82 | public enum RenderingState
|
---|
83 | {
|
---|
84 | DuringRendering,
|
---|
85 | RenderingFinished
|
---|
86 | }
|
---|
87 | }
|
---|