1
- using ColorPicker . Helpers ;
1
+ using ColorName ;
2
+ using ColorPicker . Helpers ;
2
3
using ColorPicker . Settings ;
3
4
using System ;
4
5
using System . Collections . ObjectModel ;
@@ -28,7 +29,7 @@ public bool IsOpen
28
29
public static readonly DependencyProperty CentralItemProperty =
29
30
DependencyProperty . Register ( "CentralItem" , typeof ( CircularMenuCentralItem ) , typeof ( CircularMenu ) ,
30
31
new FrameworkPropertyMetadata ( null , FrameworkPropertyMetadataOptions . AffectsRender | FrameworkPropertyMetadataOptions . AffectsMeasure ) ) ;
31
-
32
+
32
33
33
34
public CircularMenuCentralItem CentralItem
34
35
{
@@ -57,7 +58,7 @@ public override void BeginInit()
57
58
private void Items_CollectionChanged ( object sender , System . Collections . Specialized . NotifyCollectionChangedEventArgs e )
58
59
{
59
60
var newItem = e . NewItems [ 0 ] as CircularMenuItem ;
60
- if ( newItem != null )
61
+ if ( newItem != null )
61
62
{
62
63
if ( e . Action == System . Collections . Specialized . NotifyCollectionChangedAction . Add )
63
64
{
@@ -72,10 +73,11 @@ private void Items_CollectionChanged(object sender, System.Collections.Specializ
72
73
newItem . PreviewMouseDown -= CircularMenuItem_MouseDown ;
73
74
}
74
75
}
75
-
76
- if ( Items ? . Count > 0 )
76
+
77
+ if ( Items ? . Count > 0 )
77
78
{
78
79
CentralItem . ContentText = string . Empty ;
80
+ CentralItem . ColorName = string . Empty ;
79
81
}
80
82
}
81
83
@@ -92,16 +94,29 @@ private void CircularMenuItem_MouseDown(object sender, System.Windows.Input.Mous
92
94
private void CircularMenuItem_MouseLeave ( object sender , System . Windows . Input . MouseEventArgs e )
93
95
{
94
96
CentralItem . ContentText = string . Empty ;
97
+ CentralItem . ColorName = string . Empty ;
95
98
}
96
99
97
100
private void CircularMenuItem_MouseEnter ( object sender , EventArgs e )
98
101
{
99
- if ( _userSettings == null )
102
+ if ( _userSettings == null )
100
103
{
101
104
_userSettings = Bootstrapper . Container . GetExportedValue < IUserSettings > ( ) ;
102
105
}
103
-
106
+
104
107
var color = ( sender as CircularMenuItem ) . Color ;
108
+
109
+ if ( _userSettings . ShowColorName . Value )
110
+ {
111
+ var colorName = _userSettings . ShowColorName . Value ? ColorNameProvider . GetColorNameFromRGB ( color . R , color . G , color . B ) . colorName : "" ;
112
+ CentralItem . ColorName = colorName ;
113
+ CentralItem . IsColorNameVisible = true ;
114
+ }
115
+ else
116
+ {
117
+ CentralItem . IsColorNameVisible = false ;
118
+ }
119
+
105
120
CentralItem . ContentText = ColorFormatHelper . ColorToString ( color , _userSettings . SelectedColorFormat . Value ) ;
106
121
}
107
122
0 commit comments