-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCalendarComponent.razor.cs
More file actions
3236 lines (2844 loc) · 105 KB
/
CalendarComponent.razor.cs
File metadata and controls
3236 lines (2844 loc) · 105 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#region using statements
using DataJuggler.Blazor.Components.Enumerations;
using DataJuggler.Blazor.Components.Interfaces;
using DataJuggler.Blazor.Components.Objects;
using DataJuggler.Blazor.Components.Util;
using DataJuggler.UltimateHelper;
using Microsoft.AspNetCore.Components;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Threading.Tasks;
#endregion
namespace DataJuggler.Blazor.Components
{
#region class CalendarComponent
/// <summary>
/// This class is the code behind for the CalendarComponent
/// </summary>
public partial class CalendarComponent : IBlazorComponent, IBlazorComponentParent, ILabelFont, ITextBoxFont
{
#region Private Variables
private Color buttonBorderColor;
private double buttonBorderWidth;
private bool allowYearSelector;
private string name;
private IBlazorComponentParent parent;
private bool expanded;
private List<DayObject> dates;
private string bottomRowClassName;
private string calendarStyle;
private string caption;
private double height;
private string heightStyle;
private string heightUnit;
private string buttonStyle;
private string buttonUrl;
private double cellWidth;
private Color dayButtonBackgroundColor;
private double fontSize;
private string fontName;
private double width;
private string unit;
private string containerStyle;
private double buttonLeft;
private double buttonTop;
private double calendarLeft;
private double calendarTop;
private double textBoxHeight;
private double textBoxWidth;
private double column1Width;
private double column2Width;
private double dayRowLeft;
private double dayRowHeight;
private double dayRowWidth;
private double dayRowTop;
private double buttonWidth;
private double buttonHeight;
private double controlWidth;
private double controlHeight;
private string className;
private Color labelColor;
private double left;
private double top;
private string display;
private string calendarDisplay;
private string columnStyle;
private string rowStyle;
private Color dayRowColor;
private Color dayRowTextColor;
private string dayRowStyle;
private string dayButtonStyle;
private string dayButtonStyle2;
private string dayButtonStyle3;
private DateTime selectedDate;
private double labelFontSize;
private string labelFontName;
private TextBoxComponent textBox;
private string prevYearButtonUrl;
private string nextYearButtonUrl;
private string prevMonthButtonUrl;
private string nextMonthButtonUrl;
private string dateTitle;
private string navButtonStyle;
private string bottomRowStyle;
private DateTime thisMonth;
private string labelClassName;
private string position;
private double textBoxLeft;
private double rowHeight;
private string yearSelectorButtonStyle;
private bool yearSelectorVisible;
private double yearButtonWidth;
private ThemeEnum theme;
private string yearSelectorStyle;
private string yearSelectorDecadesStyle;
private string yearSelectorYearsStyle;
private string yearSelectorDisplay;
private Decade selectedDecade;
private string decadeButtonStyle;
private string yearButtonStyle;
private string dividerStyle;
private string yearSelectorContainerStyle;
private Color selectedColor;
private string yearButtonSelectedStyle;
private Color yearButtonTextColor;
private Color yearButtonTextColorSelected;
private string navButtonCellStyle;
private ImageButton button;
private double dateTitleLeft;
private double dateTitleTop;
private string dateTitlePosition;
private double yearSelectorLeft;
private double yearSelectorTop;
private double textBoxFontSize;
private string textBoxFontName;
private YearSelectorAlignmentEnum yearSelectorAlignment;
private string calendarPosition;
private List<CalendarRow> weeks;
private double scale;
private string dayRowColumnStyle;
private int zIndex;
private double bottomRowLeft;
private double bottomRowBottom;
private double bottomRowFontSize;
private string bottomRowFontName;
private string bottomRowPosition;
private string bottomRowFontWeight;
private double labelLeft;
private double rowLeft;
private double dayButtonWidth;
private string dayButtonContainerStyle;
private double dayButtonContainerLeft;
private double dayButtonContainerTop;
private string cellWidth2Style;
private double textBoxTop;
private string dayRowTextStyle;
private double dayRowTextLeft;
private double dayRowTextTop;
private bool visible;
private string visibility;
// Nav buttons
private double previousYearButtonLeft;
private double previousMonthButtonLeft;
private double nextYearButtonLeft;
private double nextMonthButtonLeft;
private double bottomNavButtonTop;
#endregion
#region Constructor
/// <summary>
/// Create a new instance of a 'CalendarComponent' object.
/// </summary>
public CalendarComponent()
{
// Perform initializations for this object
Init();
}
#endregion
#region Methods
#region ButtonClicked(int buttonNumber, string buttonName)
/// <summary>
/// Button Clicked
/// </summary>
public void ButtonClicked(int buttonNumber, string buttonName)
{
if (buttonNumber == 1)
{
// Toggle the open or close, which shows the calendar or not
Expanded = !Expanded;
}
else if (buttonNumber == 2)
{
// Previous Year
CreateDates(ThisMonth.Year - 1, ThisMonth.Month);
}
else if (buttonNumber == 3)
{
// Create a tempDate one month prior
DateTime tempDate = ThisMonth.AddMonths(-1);
// Previous Month
CreateDates(tempDate.Year, tempDate.Month);
}
else if (buttonNumber == 4)
{
// Next Month
// Create a tempDate one month forward
DateTime tempDate = ThisMonth.AddMonths(1);
// Recreate the Date
CreateDates(tempDate.Year, tempDate.Month);
}
else if (buttonNumber == 5)
{
// Next Year
CreateDates(ThisMonth.Year + 1, ThisMonth.Month);
}
// Update the UI
Refresh();
}
#endregion
#region Close()
/// <summary>
/// Close
/// </summary>
public void Close()
{
// If currently open
if (Expanded)
{
// Set to closed
Expanded = false;
// Update the UI
Refresh();
}
}
#endregion
#region CreateDates(int year, int month)
/// <summary>
/// returns a list of Dates
/// </summary>
public void CreateDates(int year, int month)
{
// initial value
Dates = new List<DayObject>();
// locals
DateTime now = DateTime.Now;
ThisMonth = new DateTime(year, month, 1);
DateTime firstOfMonth = new DateTime(year, month, 1);
DayOfWeek dayOfWeek = firstOfMonth.DayOfWeek;
int prevMonthDays = GetPrevMonthDays(dayOfWeek);
int daysInMonth = System.DateTime.DaysInMonth(year, month);
DateTime lastDayOfMonth = new DateTime(year, month, daysInMonth);
dayOfWeek = lastDayOfMonth.DayOfWeek;
int nextMonthDays = GetNextMonthDays(dayOfWeek);
// Get the name
DateTitle = DateHelper.GetMonthName(firstOfMonth) + " " + year.ToString();
// Now create the dates
for (int x = 0; x < prevMonthDays; x++)
{
// get the number of days this is from the firstOfMonth and make negative
int previousDays = (prevMonthDays - x) * -1;
// Get the datetime for this day
DateTime tempDate = firstOfMonth.AddDays(previousDays);
// Create a new instance of a 'DayObject' object.
DayObject dayObject = new DayObject();
// Set the properties
dayObject.Date = tempDate;
// This will show in Gray
dayObject.ThisMonth = false;
// Add this day
dates.Add(dayObject);
}
// Now add the days from this month
for (int x = 0; x < daysInMonth; x++)
{
// Get the datetime for this day
DateTime tempDate = firstOfMonth.AddDays(x);
// Create a new instance of a 'DayObject' object.
DayObject dayObject = new DayObject();
// Set the properties
dayObject.Date = tempDate;
if ((tempDate.Year == now.Year) && (tempDate.Month == now.Month) && (tempDate.Day == now.Day))
{
// only way it can be true
dayObject.Today = true;
}
// This will show in Gray
dayObject.ThisMonth = true;
// Add this day
dates.Add(dayObject);
}
// Now Add the dates that show after this month
for (int x = 0; x < nextMonthDays; x++)
{
// get the number of days this is from the firstOfMonth and make negative
// Get the datetime for this day
DateTime tempDate = lastDayOfMonth.AddDays(x + 1);
// Create a new instance of a 'DayObject' object.
DayObject dayObject = new DayObject();
// Set the properties
dayObject.Date = tempDate;
// This will show in Gray
dayObject.ThisMonth = false;
// Add this day
dates.Add(dayObject);
}
// Set the CurrentWeeks
Weeks = GetWeeks();
}
#endregion
#region DateSelected(DayObject date)
/// <summary>
/// A date was selected. This method sets the selected date and closes the Calendar.
/// </summary>
public void DateSelected(DayObject date)
{
// Store
SelectedDate = date.Date;
// if exists
if (HasTextBox)
{
// Display the value
TextBox.SetTextValue(date.Date.ToShortDateString());
}
// Hide
Expanded = false;
// Update the UI
Refresh();
}
#endregion
#region GetNextMonthDays()
/// <summary>
/// returns the Next Month Days
/// </summary>
public static int GetNextMonthDays(DayOfWeek dayOfWeek)
{
// initial value
int prevMonthDays = 0;
switch (dayOfWeek)
{
case DayOfWeek.Sunday:
// Set the
prevMonthDays = 6;
// required
break;
case DayOfWeek.Monday:
// Set the
prevMonthDays = 5;
// required
break;
case DayOfWeek.Tuesday:
// Set the
prevMonthDays = 4;
// required
break;
case DayOfWeek.Wednesday:
// Set the
prevMonthDays = 3;
// required
break;
case DayOfWeek.Thursday:
// Set the
prevMonthDays = 2;
// required
break;
case DayOfWeek.Friday:
// Set the
prevMonthDays = 1;
// required
break;
case DayOfWeek.Saturday:
// Set the
prevMonthDays = 0;
// required
break;
}
// return value
return prevMonthDays;
}
#endregion
#region GetPrevMonthDays()
/// <summary>
/// returns the Prev Month Days
/// </summary>
public static int GetPrevMonthDays(DayOfWeek dayOfWeek)
{
// initial value
int prevMonthDays = 0;
switch (dayOfWeek)
{
case DayOfWeek.Sunday:
// Set the
prevMonthDays = 0;
// required
break;
case DayOfWeek.Monday:
// Set the
prevMonthDays = 1;
// required
break;
case DayOfWeek.Tuesday:
// Set the
prevMonthDays = 2;
// required
break;
case DayOfWeek.Wednesday:
// Set the
prevMonthDays = 3;
// required
break;
case DayOfWeek.Thursday:
// Set the
prevMonthDays = 4;
// required
break;
case DayOfWeek.Friday:
// Set the
prevMonthDays = 5;
// required
break;
case DayOfWeek.Saturday:
// Set the
prevMonthDays = 6;
// required
break;
}
// return value
return prevMonthDays;
}
#endregion
#region GetWeeks()
/// <summary>
/// returns a list of Weeks
/// </summary>
public List<CalendarRow> GetWeeks()
{
// initial value
List<CalendarRow> weeks = new List<CalendarRow>();
// Create a CalendarRow
CalendarRow currentWeek = new CalendarRow();
// If the Dates collection exists and has one or more items
if (ListHelper.HasOneOrMoreItems(Dates))
{
for (int i = 0; i < Dates.Count; i++)
{
if (i % 7 == 0 && i != 0)
{
// Add this week
weeks.Add(currentWeek);
// Set the new currentWeek
currentWeek = new CalendarRow();
}
// Add this DayObject to the currentWeek
currentWeek.Days.Add(Dates[i]);
}
// Add the last week if it has any days
if (currentWeek.Days.Count > 0)
{
// Add this week
weeks.Add(currentWeek);
}
}
// return value
return weeks;
}
#endregion
#region Init()
/// <summary>
/// This method performs initializations for this object.
/// </summary>
public void Init()
{
// Get the current date
DateTime now = DateTime.Now;
// Create the dates
CreateDates(now.Year, now.Month);
// Default
Caption = "Date:";
// Set Defaults
AllowYearSelector = false;
ButtonBorderColor = Color.Black;
ButtonBorderWidth = 1;
BottomNavButtonTop = 2;
BottomRowBottom = 3;
BottomRowClassName = "right12 up4 width220";
BottomRowFontName = "Calibri";
BottomRowFontSize = 11;
BottomRowFontWeight = "bold";
BottomRowLeft = -8;
BottomRowPosition = "absolute";
ButtonHeight = 22;
ButtonLeft = 5;
ButtonTop = 0;
ButtonWidth = 24;
CalendarLeft = 300;
CalendarPosition = "relative";
CalendarTop = -156;
Caption = "Date:";
DayButtonWidth = 32;
Column1Width = GlobalDefaults.Column1Width;
Column2Width = GlobalDefaults.Column2Width;
ControlHeight = 32;
ControlWidth = 640;
DateTitleLeft = 0;
DateTitlePosition = "relative";
DateTitleTop = 0;
DayButtonBackgroundColor = Color.White;
DayRowColor = Color.DodgerBlue;
DayRowLeft = 0;
DayButtonContainerLeft = 2;
DayRowTextColor = Color.White;
FontSize = GlobalDefaults.LabelFontSize;
Height = 146;
HeightUnit = "px";
LabelClassName = "down4 right6";
LabelColor = Color.Black;
LabelFontName = GlobalDefaults.LabelFontName;
LabelFontSize = GlobalDefaults.LabelFontSize;
LabelLeft = -4;
Position = "relative";
RowLeft = -3;
RowHeight = 12.8;
Scale = 100;
SelectedColor = Color.Firebrick;
TextBoxFontName = GlobalDefaults.TextBoxFontName;
TextBoxFontSize = GlobalDefaults.TextBoxFontSize;
TextBoxHeight = 21;
TextBoxLeft = -3;
TextBoxTop = 2;
TextBoxWidth = GlobalDefaults.TextBoxWidth;
Theme = ThemeEnum.BlueGold;
Top = 4;
Left = 0;
Unit = "px";
Visible = true;
Width = 228;
YearButtonTextColor = Color.Black;
YearButtonTextColorSelected = Color.White;
YearButtonWidth = 24;
YearSelectorAlignment = YearSelectorAlignmentEnum.OnBottom;
ZIndex = 400;
// Buttons
NextYearButtonUrl = "_content/DataJuggler.Blazor.Components/Images/Buttons/VCRLastSmall.png";
NextMonthButtonUrl = "_content/DataJuggler.Blazor.Components/Images/Buttons/VCRNextSmall.png";
PrevYearButtonUrl = "_content/DataJuggler.Blazor.Components/Images/Buttons/VCRFirstSmall.png";
PrevMonthButtonUrl = "_content/DataJuggler.Blazor.Components/Images/Buttons/VCRPrevSmall.png";
// Adjust posions
PreviousYearButtonLeft = 12;
PreviousMonthButtonLeft = 12;
NextYearButtonLeft = 12;
NextMonthButtonLeft = 12;
// Setup the Component
SetupComponent();
}
#endregion
#region OnAfterRenderAsync(bool firstRender)
/// <summary>
/// This method is used to verify a user
/// </summary>
/// <param name="firstRender"></param>
/// <returns></returns>
protected async override Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
// Setup this component
SetupComponent();
}
// call the base
await base.OnAfterRenderAsync(firstRender);
}
#endregion
#region ReceiveData(Message message)
/// <summary>
/// method Receive Data
/// </summary>
public void ReceiveData(Message message)
{
// local
DateTime invalidDate = new DateTime(1900, 1, 1);
if ((NullHelper.Exists(message)) && (HasTextBox))
{
if (message.Text == "EnterPressed")
{
SelectedDate = DateHelper.ParseDate(TextBox.Text, invalidDate, invalidDate);
// if a valid date
if (SelectedDate.Year > 1900)
{
// Set the Date
TextBox.SetTextValue(SelectedDate.ToShortDateString());
// Close the Calendar if open
Close();
}
}
else if (message.Text == "EscapePressed")
{
// Close the Calendar if open
Close();
}
}
}
#endregion
#region Refresh()
/// <summary>
/// method Refresh
/// </summary>
public void Refresh()
{
InvokeAsync(() =>
{
// Refresh
StateHasChanged();
});
}
#endregion
#region Register(IBlazorComponent component)
/// <summary>
/// method Register
/// </summary>
public void Register(IBlazorComponent component)
{
if (component is TextBoxComponent)
{
// Store
TextBox = component as TextBoxComponent;
}
else if (component is ImageButton)
{
// Store
Button = component as ImageButton;
}
}
#endregion
#region SelectDecade(Decade decade)
/// <summary>
/// Select Decade
/// </summary>
public void SelectDecade(Decade decade)
{
// Store
SelectedDecade = decade;
// if the value for HasSelectdDecade is true
if (HasSelectedDecade)
{
// if the years have not been loaded yet
if (!SelectedDecade.HasYears)
{
// Load the Years
SelectedDecade.Years = Decade.CreateYears(SelectedDecade);
}
}
}
#endregion
#region SelectYear(int year)
/// <summary>
/// Select Year
/// </summary>
public void SelectYear(int year)
{
// Get the selected Month
int month = SelectedDate.Month;
int day = SelectedDate.Day;
int lastDayOfMonth = DateTime.DaysInMonth(year, month);
// can't be a day that doesn't exist
if (day > lastDayOfMonth)
{
// reset
day = lastDayOfMonth;
}
// Recreate the Selected Date
SelectedDate = new DateTime(year, month, day);
// Create the Dates
CreateDates(SelectedDate.Year, SelectedDate.Month);
// Redraw the Component
SetupComponent();
// Stop showing the Year Selector
ToggleYearSelector();
}
#endregion
#region SetSelectedDate(DateTime date)
/// <summary>
/// Set Selected Date
/// </summary>
public void SetSelectedDate(DateTime date)
{
// Set the SelectedDate
SelectedDate = date;
// if the value for HasTextBox is true
if (HasTextBox)
{
// Dislay
TextBox.SetTextValue(SelectedDate.ToShortDateString());
// Create the Dates
CreateDates(date.Year, date.Month);
}
}
#endregion
#region SetupComponent()
/// <summary>
/// Setup Component
/// </summary>
public void SetupComponent()
{
// if Blue Mode
if (theme == ThemeEnum.Blue)
{
if (Expanded)
{
ButtonUrl = "_content/DataJuggler.Blazor.Components/Images/Buttons/TriangleButtonOpen.png";
}
else
{
ButtonUrl = "_content/DataJuggler.Blazor.Components/Images/Buttons/TriangleButtonClosed.png";
}
}
else if ((theme == ThemeEnum.Dark) || (theme == ThemeEnum.Black))
{
if (Expanded)
{
ButtonUrl = "_content/DataJuggler.Blazor.Components/Images/Buttons/BlackTriangleOpen.png";
}
else
{
ButtonUrl = "_content/DataJuggler.Blazor.Components/Images/Buttons/BlackTriangleClosed.png";
}
}
else if (theme == ThemeEnum.Brown)
{
if (Expanded)
{
ButtonUrl = "_content/DataJuggler.Blazor.Components/Images/Buttons/BrownTriangleOpen.png";
}
else
{
ButtonUrl = "_content/DataJuggler.Blazor.Components/Images/Buttons/BrownTriangleClosed.png";
}
}
else if (theme == ThemeEnum.BlueGold)
{
if (Expanded)
{
ButtonUrl = "_content/DataJuggler.Blazor.Components/Images/Buttons/BlueGoldArrowOpen.png";
}
else
{
ButtonUrl = "_content/DataJuggler.Blazor.Components/Images/Buttons/BlueGoldArrowClosed.png";
}
}
// If Expanded
if (Expanded)
{
// Show Calendar
CalendarDisplay = "inline-block";
// if the value for YearSelectorVisible is true
if (YearSelectorVisible)
{
// Set to show
YearSelectorDisplay = "inline-block";
// if on YearSelector appears on left
if (YearSelectorAlignment == YearSelectorAlignmentEnum.OnLeft)
{
// Left Side
YearSelectorLeft = -184;
}
else if (YearSelectorAlignment == YearSelectorAlignmentEnum.OnRight)
{
// Right Side
YearSelectorLeft = 226;
}
else
{
// On bottom
YearSelectorLeft = 21;
}
// Defaults to 40
YearSelectorTop = 40;
}
else
{
// Set to hide
YearSelectorDisplay = "none";
}
}
else
{
// Hide
CalendarDisplay = "none";
// Set to hide
YearSelectorDisplay = "none";
}
// if the Button exists
if (HasButton)
{
// Update the Button
Button.Refresh();
}
}
#endregion
#region SetVisible(bool visible)
/// <summary>
/// returns the Visible
/// </summary>
public void SetVisible(bool visible)
{
// Set to Visible
this.Visible = visible;
// Update
Refresh();
}
#endregion
#region ToggleYearSelector()
/// <summary>
/// Toggle the Year Selector
/// </summary>
public void ToggleYearSelector()
{
// Toggle
YearSelectorVisible = !YearSelectorVisible;
// Update
Refresh();
}
#endregion
#endregion
#region Properties
#region AllowYearSelector
/// <summary>
/// This property gets or sets the value for 'AllowYearSelector'.
/// If true, the month and year becomes a button, and a user
/// can select a decade and or year.
/// </summary>
[Parameter]
public bool AllowYearSelector
{
get { return allowYearSelector; }
set { allowYearSelector = value; }
}
#endregion
#region BottomNavButtonTop
/// <summary>
/// This property gets or sets the value for 'BottomNavButtonTop'.
/// </summary>
[Parameter]
public double BottomNavButtonTop
{
get { return bottomNavButtonTop; }
set { bottomNavButtonTop = value; }
}
#endregion
#region BottomRowBottom
/// <summary>
/// This property gets or sets the value for 'BottomRowBottom'.
/// </summary>
[Parameter]
public double BottomRowBottom
{
get { return bottomRowBottom; }
set { bottomRowBottom = value; }
}
#endregion
#region BottomRowBottomStyle
/// <summary>
/// This read only property returns the value of BottomRowBottom + HeightUnit
/// </summary>
public string BottomRowBottomStyle
{
get
{
// initial value
string bottomRowBottomStyle = BottomRowBottom + HeightUnit;
// return value
return bottomRowBottomStyle;
}
}
#endregion
#region BottomRowClassName
/// <summary>
/// This property gets or sets the value for 'BottomRowClassName'.
/// </summary>