@@ -278,13 +278,16 @@ private void GenerateButtons()
278
278
if ( Is24Hours )
279
279
{
280
280
GenerateButtons ( hoursCanvas , Enumerable . Range ( 13 , 12 ) . ToList ( ) , ButtonRadiusRatio ,
281
- new ClockItemIsCheckedConverter ( ( ) => Time , ClockDisplayMode . Hours , Is24Hours ) , i => "ButtonStyle" , "00" ) ;
281
+ new ClockItemIsCheckedConverter ( ( ) => Time , ClockDisplayMode . Hours , Is24Hours ) , i => "ButtonStyle" , "00" ,
282
+ ClockDisplayMode . Hours ) ;
282
283
GenerateButtons ( hoursCanvas , Enumerable . Range ( 1 , 12 ) . ToList ( ) , ButtonRadiusInnerRatio ,
283
- new ClockItemIsCheckedConverter ( ( ) => Time , ClockDisplayMode . Hours , Is24Hours ) , i => "ButtonStyle" , "#" ) ;
284
+ new ClockItemIsCheckedConverter ( ( ) => Time , ClockDisplayMode . Hours , Is24Hours ) , i => "ButtonStyle" , "#" ,
285
+ ClockDisplayMode . Hours ) ;
284
286
}
285
287
else
286
288
GenerateButtons ( hoursCanvas , Enumerable . Range ( 1 , 12 ) . ToList ( ) , ButtonRadiusRatio ,
287
- new ClockItemIsCheckedConverter ( ( ) => Time , ClockDisplayMode . Hours , Is24Hours ) , i => "ButtonStyle" , "0" ) ;
289
+ new ClockItemIsCheckedConverter ( ( ) => Time , ClockDisplayMode . Hours , Is24Hours ) , i => "ButtonStyle" , "0" ,
290
+ ClockDisplayMode . Hours ) ;
288
291
}
289
292
290
293
if ( GetTemplateChild ( MinutesCanvasPartName ) is Canvas minutesCanvas )
@@ -293,7 +296,8 @@ private void GenerateButtons()
293
296
294
297
GenerateButtons ( minutesCanvas , Enumerable . Range ( 1 , 60 ) . ToList ( ) , ButtonRadiusRatio ,
295
298
new ClockItemIsCheckedConverter ( ( ) => Time , ClockDisplayMode . Minutes , Is24Hours ) ,
296
- i => ( ( i / 5.0 ) % 1 ) == 0.0 ? "ButtonStyle" : "LesserButtonStyle" , "0" ) ;
299
+ i => ( ( i / 5.0 ) % 1 ) == 0.0 ? "ButtonStyle" : "LesserButtonStyle" , "0" ,
300
+ ClockDisplayMode . Minutes ) ;
297
301
}
298
302
299
303
if ( GetTemplateChild ( SecondsCanvasPartName ) is Canvas secondsCanvas )
@@ -302,7 +306,8 @@ private void GenerateButtons()
302
306
303
307
GenerateButtons ( secondsCanvas , Enumerable . Range ( 1 , 60 ) . ToList ( ) , ButtonRadiusRatio ,
304
308
new ClockItemIsCheckedConverter ( ( ) => Time , ClockDisplayMode . Seconds , Is24Hours ) ,
305
- i => ( ( i / 5.0 ) % 1 ) == 0.0 ? "ButtonStyle" : "LesserButtonStyle" , "0" ) ;
309
+ i => ( ( i / 5.0 ) % 1 ) == 0.0 ? "ButtonStyle" : "LesserButtonStyle" , "0" ,
310
+ ClockDisplayMode . Seconds ) ;
306
311
}
307
312
308
313
void RemoveExistingButtons ( Canvas canvas )
@@ -333,7 +338,7 @@ private void HourReadOutPartNameOnPreviewMouseLeftButtonDown(object sender, Mous
333
338
}
334
339
335
340
private void GenerateButtons ( Panel canvas , ICollection < int > range , double radiusRatio , IValueConverter isCheckedConverter , Func < int , string > stylePropertySelector ,
336
- string format )
341
+ string format , ClockDisplayMode clockDisplayMode )
337
342
{
338
343
var anglePerItem = 360.0 / range . Count ;
339
344
var radiansPerItem = anglePerItem * ( Math . PI / 180 ) ;
@@ -359,7 +364,7 @@ private void GenerateButtons(Panel canvas, ICollection<int> range, double radius
359
364
button . SetBinding ( Canvas . LeftProperty , GetBinding ( "X" , button ) ) ;
360
365
button . SetBinding ( Canvas . TopProperty , GetBinding ( "Y" , button ) ) ;
361
366
362
- button . Content = ( i == 60 ? 0 : ( i == 24 ? 0 : i ) ) . ToString ( format ) ;
367
+ button . Content = ( i == 60 ? 0 : ( i == 24 && clockDisplayMode == ClockDisplayMode . Hours ? 0 : i ) ) . ToString ( format ) ;
363
368
canvas . Children . Add ( button ) ;
364
369
}
365
370
}
0 commit comments