Exemple #1
0
        void SetMonthControl(MonthControl _monthControl)
        {
            if (monthControl != null)
            {
                monthControl.SelectionChanged -= MonthGridControl_SelectionChanged;
            }
            monthControl = _monthControl;
            monthControl.SelectionChanged += MonthGridControl_SelectionChanged;
            monthControl.ValueConverter    = this.ValueConverter;
            monthControl.ItemsSource       = dateModel.Days;
            monthControl.SelectedItem      = dateModel.Current;

            void MonthGridControl_SelectionChanged(object sender, RoutedEventArgs e)
            {
                if (sender is MonthControl listBox)
                {
                    this.SelectedItem = listBox.SelectedItem;
                    var date = listBox.SelectedDate;
                    if (date.HasValue)
                    {
                        dateModel.Current = date.Value;
                    }
                    datePickerControl.Month = dateModel.Month;
                    datePickerControl.Year  = dateModel.Year;
                }
            }
        }
 void Start()
 {
     points = new List <MapLocation>();
     foreach (Transform child in transform)
     {
         if (child.name == "points")
         {
             foreach (Transform point in child)
             {
                 points.Add(point.GetComponent <MapLocation>());
             }
         }
         else if (child.name == "notebook")
         {
             year  = child.GetChild(0).GetChild(0).GetComponent <YearControl>();
             month = child.GetChild(0).GetChild(1).GetComponent <MonthControl>();
         }
     }
 }
        private void InitializeMonths()
        {
            var currentMonthLength = DimensionX * DimensionY;

            if (currentMonthLength == Months.Count)
            {
                return;
            }

            Controls.Clear();
            Months.Clear();

            for (var i = 0; i < currentMonthLength; ++i)
            {
                var month = new MonthControl();
                month.TabStop  = true;
                month.TabIndex = i;
                Controls.Add(month);
                Months.Add(month);
            }
            ResizeMonths();
            UpdateMonths();
        }