1e99108236cb05bb5edd1fb70f8c2e0fca5ea356
[mono.git] / mcs / class / referencesource / System.Activities.Presentation / System.Activities.Presentation / System / Activities / Presentation / WorkflowDesignerColors.cs
1 //-----------------------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation.  All rights reserved.
3 //-----------------------------------------------------------------------------
4
5 namespace System.Activities.Presentation
6 {
7     using System;
8     using System.Collections.Generic;
9     using System.Text;
10     using System.Windows.Media;
11     using System.Windows;
12     using System.Runtime;
13     using System.Activities.Presentation.Internal.PropertyEditing;
14
15     public static class WorkflowDesignerColors
16     {
17         static ResourceDictionary defaultColors;
18         static ResourceDictionary highContrastColors;
19         static ResourceDictionary fontAndColorResources;
20
21         public const string WorkflowViewElementBorderColorKey = "WorkflowViewElementBorderColorKey";
22         public const string WorkflowViewElementBackgroundColorKey = "WorkflowViewElementBackgroundColorKey";
23         public const string WorkflowViewElementSelectedBackgroundColorKey = "WorkflowViewElementSelectedBackgroundColorKey";
24         public const string WorkflowViewElementSelectedBorderColorKey = "WorkflowViewElementSelectedBorderColorKey";
25         public const string DesignerViewStatusBarBackgroundColorKey = "DesignerViewStatusBarBackgroundColorKey";
26         public const string WorkflowViewElementCaptionColorKey = "WorkflowViewElementCaptionBrushColorKey";
27         public const string DesignerViewBackgroundColorKey = "DesignerViewBackgroundColorKey";
28         public const string DesignerViewShellBarColorGradientBeginKey = "DesignerViewShellBarColorGradientBeginKey";
29         public const string DesignerViewShellBarColorGradientEndKey = "DesignerViewShellBarColorGradientEndKey";
30         public const string DesignerViewShellBarSelectedColorGradientBeginKey = "DesignerViewShellBarSelectedColorGradientBeginKey";
31         public const string DesignerViewShellBarSelectedColorGradientEndKey = "DesignerViewShellBarSelectedColorGradientEndKey";
32         public const string DesignerViewShellBarHoverColorGradientBeginKey = "DesignerViewShellBarSelectedHoverGradientBeginKey";
33         public const string DesignerViewShellBarHoverColorGradientEndKey = "DesignerViewShellBarSelectedHoverGradientEndKey";
34         public const string DesignerViewShellBarControlBackgroundColorKey = "DesignerViewShellBarControlBackgroundColorKey";
35         public const string DesignerViewShellBarCaptionActiveColorKey = "DesignerViewShellBarCaptionActiveColorKey";
36         public const string DesignerViewShellBarCaptionColorKey = "DesignerViewShellBarCaptionColorKey";
37         public const string DesignerViewExpandAllCollapseAllButtonColorKey = "DesignerViewExpandAllCollapseAllButtonColorKey";
38         public const string DesignerViewExpandAllCollapseAllButtonMouseOverColorKey = "DesignerViewExpandAllCollapseAllButtonMouseOverColorKey";
39         public const string DesignerViewExpandAllCollapseAllPressedColorKey = "DesignerViewExpandAllCollapseAllPressedColorKey";
40
41         public const string ContextMenuBackgroundGradientBeginColorKey = "ContextMenuColorGradientBeginColorKey";
42         public const string ContextMenuBackgroundGradientEndColorKey = "ContextMenuColorGradientEndColorKey";
43         public const string ContextMenuBorderColorKey = "ContextMenuBorderColorKey";
44         public const string ContextMenuIconAreaColorKey = "ContextMenuIconAreaColorKey";
45         public const string ContextMenuMouseOverBeginColorKey = "ContextMenuMouseOverBeginColorKey";
46         public const string ContextMenuMouseOverMiddle1ColorKey = "ContextMenuMouseOverMiddle1ColorKey";
47         public const string ContextMenuMouseOverMiddle2ColorKey = "ContextMenuMouseOverMiddle2ColorKey";
48         public const string ContextMenuMouseOverEndColorKey = "ContextMenuMouseOverEndColorKey";
49         public const string ContextMenuMouseOverBorderColorKey = "ContextMenuMouseOverBorderColorKey";
50         public const string ContextMenuItemTextColorKey = "ContextMenuItemTextColorKey";
51         public const string ContextMenuItemTextHoverColorKey = "ContextMenuItemTextHoverColorKey";
52         public const string ContextMenuItemTextSelectedColorKey = "ContextMenuItemTextSelectedColorKey";
53         public const string ContextMenuItemTextDisabledColorKey = "ContextMenuItemTextDisabledColorKey";
54         public const string ContextMenuSeparatorColorKey = "ContextMenuSeparatorColorKey";
55
56         public static string PropertyInspectorTextBrushKey { get { return PropertyInspectorMergedResources.TextBrushKey; } }
57         public static string PropertyInspectorSelectedForegroundBrushKey { get { return PropertyInspectorMergedResources.SelectedForegroundBrushKey; } }
58         public static string PropertyInspectorSelectedBackgroundBrushKey { get { return PropertyInspectorMergedResources.SelectedBackgroundBrushKey; } }
59         public static string PropertyInspectorBackgroundBrushKey { get { return PropertyInspectorMergedResources.BackgroundBrushKey; } }
60         public static string PropertyInspectorBorderBrushKey { get { return PropertyInspectorMergedResources.BorderBrushKey; } }
61         public static string PropertyInspectorCategoryCaptionTextBrushKey { get { return PropertyInspectorMergedResources.CategoryCaptionTextBrushKey; } }
62         public static string PropertyInspectorPaneBrushKey { get { return PropertyInspectorMergedResources.PaneBrushKey; } }
63         public static string PropertyInspectorPopupBrushKey { get { return PropertyInspectorMergedResources.PopupBrushKey; } }
64         public static string PropertyInspectorToolBarItemHoverBackgroundBrushKey { get { return PropertyInspectorMergedResources.ToolBarItemHoverBackgroundBrushKey; } }
65         public static string PropertyInspectorToolBarItemHoverBorderBrushKey { get { return PropertyInspectorMergedResources.ToolBarItemHoverBorderBrushKey; } }
66         public static string PropertyInspectorToolBarItemSelectedBackgroundBrushKey { get { return PropertyInspectorMergedResources.ToolBarItemSelectedBackgroundBrushKey; } }
67         public static string PropertyInspectorToolBarItemSelectedBorderBrushKey { get { return PropertyInspectorMergedResources.ToolBarItemSelectedBorderBrushKey; } }
68         public static string PropertyInspectorToolBarBackgroundBrushKey { get { return PropertyInspectorMergedResources.ToolBarBackgroundBrushKey; } }
69         public static string PropertyInspectorToolBarSeparatorBrushKey { get { return PropertyInspectorMergedResources.ToolBarSeparatorBrushKey; } }
70         public static string PropertyInspectorToolBarTextBoxBorderBrushKey { get { return PropertyInspectorMergedResources.ToolBarTextBoxBorderBrushKey; } }
71
72
73         public const string FlowchartExpressionButtonColorKey = "FlowchartExpressionButtonColorKey";
74         public const string FlowchartExpressionButtonMouseOverColorKey = "FlowchartExpressionButtonMouseOverColorKey";
75         public const string FlowchartExpressionButtonPressedColorKey = "FlowchartExpressionButtonPressedColorKey";
76
77         
78
79         public const string AnnotationBackgroundGradientBeginColorKey = "AnnotationBackgroundGradientBeginColorKey";
80         public const string AnnotationBackgroundGradientMiddleColorKey = "AnnotationBackgroundGradientMiddleColorKey";
81         public const string AnnotationBackgroundGradientEndColorKey = "AnnotationBackgroundGradientEndColorKey";
82         public const string AnnotationBorderColorKey = "AnnotationBorderColorKey";
83         public const string AnnotationDockTextColorKey = "AnnotationDockTextColorKey";
84         public const string AnnotationUndockTextColorKey = "AnnotationUndockTextColorKey";
85         public const string AnnotationDockButtonColorKey = "AnnotationDockButtonColorKey";
86         public const string AnnotationDockButtonHoverColorKey = "AnnotationDockButtonHoverColorKey";
87         public const string AnnotationDockButtonHoverBorderColorKey = "AnnotationDockButtonHoverBorderColorKey";
88         public const string AnnotationDockButtonHoverBackgroundColorKey = "AnnotationDockButtonHoverBackgroundColorKey";
89
90         public const string OutlineViewItemHighlightBackgroundColorKey = "OutlineViewItemHighlightBackgroundColorKey";
91         public const string OutlineViewCollapsedArrowBorderColorKey = "OutlineViewCollapsedArrowBorderColorKey";
92         public const string OutlineViewCollapsedArrowHoverBorderColorKey = "OutlineViewCollapsedArrowHoverBorderColorKey";
93         public const string OutlineViewExpandedArrowColorKey = "OutlineViewExpandedArrowColorKey";
94         public const string OutlineViewExpandedArrowBorderColorKey = "OutlineViewExpandedArrowBorderColorKey";
95         public const string OutlineViewBackgroundColorKey = "OutlineViewBackgroundColorKey";
96         public const string OutlineViewItemSelectedTextColorKey = "OutlineViewTitemSelectedTextColorKey";
97         public const string OutlineViewItemTextColorKey = "OutlineViewItemTextColorKey";
98
99         public const string RubberBandRectangleColorKey = "RubberBandRectangleColorKey";
100
101         public static readonly string FontSizeKey = CreateKey("FontSizeKey");
102         public static readonly string FontFamilyKey = CreateKey("FontFamilyKey");
103         public static readonly string FontWeightKey = CreateKey("FontWeightKey");
104
105
106         static ResourceDictionary DefaultColors
107         {
108             get
109             {
110                 if (defaultColors == null)
111                 {
112                     Uri resourceLocator = new Uri(
113                         string.Concat(
114                         typeof(WorkflowDesignerColors).Assembly.GetName().Name,
115                         @";component/System/Activities/Presentation/DefaultColorResources.xaml"),
116                         UriKind.RelativeOrAbsolute);
117                     defaultColors = (ResourceDictionary)Application.LoadComponent(resourceLocator);
118                 }
119                 Fx.Assert(defaultColors != null, "Could not load default color resources.");
120                 return defaultColors;
121             }
122         }
123
124         static ResourceDictionary HighContrastColors
125         {
126             get
127             {
128                 if (highContrastColors == null)
129                 {
130                     Uri resourceLocator = new Uri(
131                         string.Concat(
132                         typeof(WorkflowDesignerColors).Assembly.GetName().Name,
133                         @";component/System/Activities/Presentation/HighContrastColorResources.xaml"),
134                         UriKind.RelativeOrAbsolute);
135                     highContrastColors = (ResourceDictionary)Application.LoadComponent(resourceLocator);
136                 }
137                 Fx.Assert(highContrastColors != null, "Could not load high contrast color resources.");
138                 return highContrastColors;
139             }
140         }
141
142         internal static ResourceDictionary FontAndColorResources
143         {
144             get
145             {
146                 if (WorkflowDesignerColors.fontAndColorResources == null)
147                 {
148                     InitializeDefaultResourceDictionary();
149                 }
150
151                 return WorkflowDesignerColors.fontAndColorResources;
152             }
153         }
154
155         // Trying to figure out whether or not we are in highcontrast mode is a little tricky.
156         // There are two things highcontrast mode and highcontrast color scheme. unfortunately in some platforms ( w2k3) these are not both updated from OS UX
157         // here is a good article on this http://blogs.msdn.com/oldnewthing/archive/2008/12/03/9167477.aspx
158         // highcontrast mode can be detected easily by using
159         // applications in generatel ( e.g. VS) unfortunately handle high contrast color scheme as well, so we are forced to do it
160         // This is code is dervied from the way VS does this.
161
162         static bool IsHighContrastEnabled
163         {
164             get
165             {
166                 if (SystemParameters.HighContrast)
167                 {
168                     return true;
169                 }
170
171                 if (SystemColors.ControlColor == Colors.Black && SystemColors.ControlTextColor == Colors.White)
172                 {
173                     return true;
174                 }
175
176                 if (SystemColors.ControlColor == Colors.White && SystemColors.ControlTextColor == Colors.Black)
177                 {
178                     return true;
179                 }
180
181                 if (SystemColors.ControlColor == Colors.Black && SystemColors.ControlTextColor == Color.FromArgb(0xff, 0x00, 0xff, 0x00))
182                 {
183                     return true;
184                 }
185
186                 return false;
187             }
188         }
189
190
191         public static Color WorkflowViewElementBorderColor
192         {
193             get
194             {
195                 return GetColor(WorkflowDesignerColors.WorkflowViewElementBorderColorKey);
196             }
197         }
198
199         public static Color WorkflowViewElementBackgroundColor
200         {
201             get
202             {
203                 return GetColor(WorkflowDesignerColors.WorkflowViewElementBackgroundColorKey);
204             }
205         }
206         public static Color WorkflowViewElementSelectedBackgroundColor
207         {
208             get
209             {
210                 return GetColor(WorkflowDesignerColors.WorkflowViewElementSelectedBackgroundColorKey);
211             }
212         }
213
214         public static Color GridViewRowHoverColor
215         {
216             get
217             {
218                 return GetColor(WorkflowDesignerColors.WorkflowViewElementSelectedBackgroundColorKey, 0xA0);
219             }
220         }
221
222         public static Color WorkflowViewElementSelectedBorderColor
223         {
224             get
225             {
226                 return GetColor(WorkflowDesignerColors.WorkflowViewElementSelectedBorderColorKey);
227             }
228         }
229         public static Color DesignerViewStatusBarBackgroundColor
230         {
231             get
232             {
233                 return GetColor(WorkflowDesignerColors.DesignerViewStatusBarBackgroundColorKey);
234             }
235         }
236         public static Color WorkflowViewElementCaptionColor
237         {
238             get
239             {
240                 return GetColor(WorkflowDesignerColors.WorkflowViewElementCaptionColorKey);
241             }
242         }
243         public static Color DesignerViewBackgroundColor
244         {
245             get
246             {
247                 return GetColor(WorkflowDesignerColors.DesignerViewBackgroundColorKey);
248             }
249         }
250
251         public static Color DesignerViewShellBarColorGradientBeginColor
252         {
253             get { return GetColor(WorkflowDesignerColors.DesignerViewShellBarColorGradientBeginKey); }
254         }
255
256         public static Color DesignerViewShellBarColorGradientEndColor
257         {
258             get { return GetColor(WorkflowDesignerColors.DesignerViewShellBarColorGradientEndKey); }
259         }
260
261         public static Color DesignerViewShellBarSelectedColorGradientBeginColor
262         {
263             get { return GetColor(WorkflowDesignerColors.DesignerViewShellBarSelectedColorGradientBeginKey); }
264         }
265
266         public static Color DesignerViewShellBarSelectedColorGradientEndColor
267         {
268             get { return GetColor(WorkflowDesignerColors.DesignerViewShellBarSelectedColorGradientEndKey); }
269         }
270
271         public static Color DesignerViewShellBarHoverColorGradientBeginColor
272         {
273             get { return GetColor(WorkflowDesignerColors.DesignerViewShellBarHoverColorGradientBeginKey); }
274         }
275
276         public static Color DesignerViewShellBarHoverColorGradientEndColor
277         {
278             get { return GetColor(WorkflowDesignerColors.DesignerViewShellBarHoverColorGradientEndKey); }
279         }
280
281         public static Color DesignerViewShellBarControlBackgroundColor
282         {
283             get { return GetColor(WorkflowDesignerColors.DesignerViewShellBarControlBackgroundColorKey); }
284         }
285
286         public static Color DesignerViewShellBarCaptionActiveColor
287         {
288             get { return GetColor(WorkflowDesignerColors.DesignerViewShellBarCaptionActiveColorKey); }
289         }
290
291         public static Color DesignerViewShellBarCaptionColor
292         {
293             get { return GetColor(WorkflowDesignerColors.DesignerViewShellBarCaptionColorKey); }
294         }
295
296         public static Brush DesignerViewExpandAllCollapseAllButtonBrush
297         {
298             get { return GetBrush(WorkflowDesignerColors.DesignerViewExpandAllCollapseAllButtonColorKey); }
299         }
300
301         public static Brush DesignerViewExpandAllCollapseAllButtonMouseOverBrush
302         {
303             get { return GetBrush(WorkflowDesignerColors.DesignerViewExpandAllCollapseAllButtonMouseOverColorKey); }
304         }
305
306         public static Brush DesignerViewExpandAllCollapseAllPressedBrush
307         {
308             get { return GetBrush(WorkflowDesignerColors.DesignerViewExpandAllCollapseAllPressedColorKey); }
309         }
310
311         public static Color ContextMenuBackgroundGradientBeginColor
312         {
313             get { return GetColor(WorkflowDesignerColors.ContextMenuBackgroundGradientBeginColorKey); }
314         }
315         public static Color ContextMenuBackgroundGradientEndColor
316         {
317             get { return GetColor(WorkflowDesignerColors.ContextMenuBackgroundGradientEndColorKey); }
318         }
319
320         public static Color ContextMenuBorderColor
321         {
322             get { return GetColor(WorkflowDesignerColors.ContextMenuBorderColorKey); }
323         }
324
325         public static Color ContextMenuIconAreaColor
326         {
327             get { return GetColor(WorkflowDesignerColors.ContextMenuIconAreaColorKey); }
328         }
329
330         public static Color ContextMenuMouseOverBeginColor
331         {
332             get { return GetColor(WorkflowDesignerColors.ContextMenuMouseOverBeginColorKey); }
333         }
334
335         public static Color ContextMenuMouseOverMiddle1Color
336         {
337             get { return GetColor(WorkflowDesignerColors.ContextMenuMouseOverMiddle1ColorKey); }
338         }
339
340         public static Color ContextMenuMouseOverMiddle2Color
341         {
342             get { return GetColor(WorkflowDesignerColors.ContextMenuMouseOverMiddle2ColorKey); }
343         }
344
345         public static Color ContextMenuMouseOverEndColor
346         {
347             get { return GetColor(WorkflowDesignerColors.ContextMenuMouseOverEndColorKey); }
348         }
349
350         public static Color ContextMenuMouseOverBorderColor
351         {
352             get { return GetColor(WorkflowDesignerColors.ContextMenuMouseOverBorderColorKey); }
353         }
354
355         public static Color ContextMenuItemTextColor
356         {
357             get { return GetColor(WorkflowDesignerColors.ContextMenuItemTextColorKey); }
358         }
359
360         public static Color ContextMenuItemTextHoverColor
361         {
362             get { return GetColor(WorkflowDesignerColors.ContextMenuItemTextHoverColorKey); }
363         }
364
365         public static Color ContextMenuItemTextSelectedColor
366         {
367             get { return GetColor(WorkflowDesignerColors.ContextMenuItemTextSelectedColorKey); }
368         }
369
370         public static Color ContextMenuItemTextDisabledColor
371         {
372             get { return GetColor(WorkflowDesignerColors.ContextMenuItemTextDisabledColorKey); }
373         }
374
375         public static Color ContextMenuSeparatorColor
376         {
377             get { return GetColor(WorkflowDesignerColors.ContextMenuSeparatorColorKey); }
378         }
379
380         public static Brush FlowchartExpressionButtonBrush
381         {
382             get { return GetBrush(WorkflowDesignerColors.FlowchartExpressionButtonColorKey); }
383         }
384
385         public static Brush FlowchartExpressionButtonMouseOverBrush
386         {
387             get { return GetBrush(WorkflowDesignerColors.FlowchartExpressionButtonMouseOverColorKey); }
388         }
389
390         public static Brush FlowchartExpressionButtonPressedBrush
391         {
392             get { return GetBrush(WorkflowDesignerColors.FlowchartExpressionButtonPressedColorKey); }
393         }
394
395         public static Color AnnotationBackgroundGradientBeginColor
396         {
397             get { return GetColor(WorkflowDesignerColors.AnnotationBackgroundGradientBeginColorKey); }
398         }
399
400         public static Color AnnotationBackgroundGradientMiddleColor
401         {
402             get { return GetColor(WorkflowDesignerColors.AnnotationBackgroundGradientMiddleColorKey); }
403         }
404
405         public static Color AnnotationBackgroundGradientEndColor
406         {
407             get { return GetColor(WorkflowDesignerColors.AnnotationBackgroundGradientEndColorKey); }
408         }
409
410         public static Color AnnotationBorderColor
411         {
412             get { return GetColor(WorkflowDesignerColors.AnnotationBorderColorKey); }
413         }
414
415         public static Color AnnotationDockTextColor
416         {
417             get { return GetColor(WorkflowDesignerColors.AnnotationDockTextColorKey); }
418         }
419
420         public static Color AnnotationUndockTextColor
421         {
422             get { return GetColor(WorkflowDesignerColors.AnnotationUndockTextColorKey); }
423         }
424
425         public static Color AnnotationDockButtonColor
426         {
427             get { return GetColor(WorkflowDesignerColors.AnnotationDockButtonColorKey); }
428         }
429
430         public static Color AnnotationDockButtonHoverColor
431         {
432             get { return GetColor(WorkflowDesignerColors.AnnotationDockButtonHoverColorKey); }
433         }
434
435         public static Color AnnotationDockButtonHoverBorderColor
436         {
437             get { return GetColor(WorkflowDesignerColors.AnnotationDockButtonHoverBorderColorKey); }
438         }
439
440         public static Color AnnotationDockButtonHoverBackgroundColor
441         {
442             get { return GetColor(WorkflowDesignerColors.AnnotationDockButtonHoverBackgroundColorKey); }
443         }
444
445         public static Color OutlineViewItemHighlightBackgroundColor
446         {
447             get { return GetColor(WorkflowDesignerColors.OutlineViewItemHighlightBackgroundColorKey); }
448         }
449
450         public static Color OutlineViewCollapsedArrowBorderColor
451         {
452             get { return GetColor(WorkflowDesignerColors.OutlineViewCollapsedArrowBorderColorKey); }
453         }
454
455         public static Color OutlineViewCollapsedArrowHoverBorderColor
456         {
457             get { return GetColor(WorkflowDesignerColors.OutlineViewCollapsedArrowHoverBorderColorKey); }
458         }
459
460         public static Color OutlineViewExpandedArrowColor
461         {
462             get { return GetColor(WorkflowDesignerColors.OutlineViewExpandedArrowColorKey); }
463         }
464
465         public static Color OutlineViewExpandedArrowBorderColor
466         {
467             get { return GetColor(WorkflowDesignerColors.OutlineViewExpandedArrowBorderColorKey); }
468         }
469
470         public static Color OutlineViewBackgroundColor
471         {
472             get { return GetColor(WorkflowDesignerColors.OutlineViewBackgroundColorKey); }
473         }
474
475         public static Color OutlineViewItemSelectedTextColor
476         {
477             get { return GetColor(WorkflowDesignerColors.OutlineViewItemSelectedTextColorKey); }
478         }
479
480         public static Color OutlineViewItemTextColor
481         {
482             get { return GetColor(WorkflowDesignerColors.OutlineViewItemTextColorKey); }
483         }
484
485         public static FontFamily FontFamily
486         {
487             get
488             {
489                 return GetFontFamily(FontFamilyKey);
490             }
491         }
492
493         public static double FontSize
494         {
495             get
496             {
497                 return GetFontSize(FontSizeKey);
498             }
499         }
500
501         public static FontWeight FontWeight
502         {
503             get
504             {
505                 return GetFontWeight(FontWeightKey);
506             }
507         }
508
509         internal static Brush RubberBandRectangleBrush
510         {
511             get { return GetBrush(WorkflowDesignerColors.RubberBandRectangleColorKey); }
512         }
513
514         private static Brush GetBrush(string colorKey)
515         {
516             SolidColorBrush brush = 
517                 (SolidColorBrush)GetFontOrColor(colorKey, WorkflowDesignerColors.DefaultColors[colorKey], WorkflowDesignerColors.HighContrastColors[colorKey]);
518
519             if (brush.CanFreeze)
520             {
521                 brush.Freeze();
522             }
523             return brush;
524         }
525
526         private static Color GetColor(string colorKey)
527         {
528             SolidColorBrush brush = (SolidColorBrush)GetBrush(colorKey);
529
530             return brush.Color;
531         }
532
533         private static Color GetColor(string colorKey, byte alpha)
534         {
535             Color color = GetColor(colorKey);
536             color.A = alpha;
537             return color;
538         }
539
540         private static FontFamily GetFontFamily(string key)
541         {
542             return (FontFamily)GetFontOrColor(key, SystemFonts.MessageFontFamily, SystemFonts.MessageFontFamily);
543         }
544
545         private static double GetFontSize(string key)
546         {
547             return (double)GetFontOrColor(key, SystemFonts.MessageFontSize, SystemFonts.MessageFontSize);
548         }
549
550         private static FontWeight GetFontWeight(string key)
551         {
552             return (FontWeight)GetFontOrColor(key, SystemFonts.MessageFontWeight, SystemFonts.MessageFontWeight);
553         }
554
555         private static object GetFontOrColor(string key, object defaultValue, object valueInHighContrast)
556         {
557             if (WorkflowDesignerColors.FontAndColorResources.Contains(key))
558             {
559                 return WorkflowDesignerColors.FontAndColorResources[key];
560             }
561             else if (IsHighContrastEnabled)
562             {
563                 return valueInHighContrast;
564             }
565             else
566             {
567                 return defaultValue;
568             }
569         }
570
571         static string CreateKey(string name)
572         {
573             //return AdornerResources.CreateResourceKey(typeof(PropertyInspectorMergedResources), name);
574             return name;
575         }
576
577         private static void InitializeDefaultResourceDictionary()
578         {
579             ResourceDictionary resources = new ResourceDictionary();
580             resources[WorkflowDesignerColors.PropertyInspectorTextBrushKey] = new SolidColorBrush(SystemColors.ControlTextColor);
581             resources[WorkflowDesignerColors.PropertyInspectorBackgroundBrushKey] = new SolidColorBrush(SystemColors.WindowColor);
582             resources[WorkflowDesignerColors.PropertyInspectorBorderBrushKey] = new SolidColorBrush(SystemColors.ControlDarkColor);
583             resources[WorkflowDesignerColors.PropertyInspectorPaneBrushKey] = new SolidColorBrush(SystemColors.ControlColor);
584             resources[WorkflowDesignerColors.PropertyInspectorSelectedBackgroundBrushKey] = new SolidColorBrush(SystemColors.HighlightColor);
585             resources[WorkflowDesignerColors.PropertyInspectorSelectedForegroundBrushKey] = new SolidColorBrush(SystemColors.HighlightTextColor);
586             resources[WorkflowDesignerColors.PropertyInspectorToolBarItemHoverBackgroundBrushKey] = new SolidColorBrush(SystemColors.GradientActiveCaptionColor);
587             resources[WorkflowDesignerColors.PropertyInspectorToolBarItemHoverBorderBrushKey] = new SolidColorBrush(SystemColors.ActiveCaptionTextColor);
588             resources[WorkflowDesignerColors.PropertyInspectorToolBarItemSelectedBackgroundBrushKey] = new SolidColorBrush(SystemColors.GradientInactiveCaptionColor);
589             resources[WorkflowDesignerColors.PropertyInspectorToolBarItemSelectedBorderBrushKey] = new SolidColorBrush(SystemColors.ActiveCaptionTextColor);
590             resources[WorkflowDesignerColors.PropertyInspectorToolBarBackgroundBrushKey] = new SolidColorBrush(SystemColors.ControlColor);
591             resources[WorkflowDesignerColors.PropertyInspectorToolBarSeparatorBrushKey] = new SolidColorBrush(SystemColors.ControlDarkColor);
592             resources[WorkflowDesignerColors.PropertyInspectorToolBarTextBoxBorderBrushKey] = new SolidColorBrush(SystemColors.ControlDarkDarkColor);            
593
594             WorkflowDesignerColors.fontAndColorResources = resources;               
595         }
596     }
597 }