Пример #1
0
 public calendar(MyViewModel vm)
 {
     InitializeComponent();
     m_vm       = vm;
     background = new CalenderBackground(cl);
     background.AddOverlay("circle", "circle.png");
     background.AddOverlay("tjek", "tjek.png");
     background.AddOverlay("cross", "cross.png");
     background.AddOverlay("box", "box.png");
     background.AddOverlay("gray", "gray.png");
     cl.Background = background.GetBackground();
     // Update background when changing the shown month
     cl.DisplayDateChanged += KalenderOnDisplayDateChanged;
     currentAss             = new List <assignment>();
     this.DataContext       = vm;
     m_vm.PropertyChanged  += (sender, e) =>
     {
         if (e.PropertyName == "VM_chooseDate")
         {
             //currentAss = m_vm.getAssinment();
             updateTask();
             Console.ReadKey();
         }
     };
     fillCalendar();
 }
        private void InitilizeCalendar()
        {
            #region CustomCalendar
            SupportIncomeCalendar.IsTodayHighlighted = false;
            //Kalender.FirstDayOfWeek = DayOfWeek.Sunday;
            //background.ClearDates();
            background = new CalenderBackground(SupportIncomeCalendar);

            //background.AddOverlay("circle", "Resources/Images/circle.png");
            background.AddOverlay("tick", "Resources/Images/tick.png");
            //background.AddOverlay("cross", "Resources/Images/cross.png");
            //background.AddOverlay("box", "Resources/Images/box.png");
            //background.AddOverlay("gray", "Resources/Images/gray.png");

            //SupportIncomeCalendar.ClearValue(Calendar.SelectedDateProperty);
            System.Data.DataTable dtIncomes = vm.GetSupportIncomes();
            foreach (DataRow row in dtIncomes.Rows)
            {
                //SupportIncomeCalendar.SelectedDates.Add(Convert.ToDateTime(row["SupportDate"]));
                background.AddDate(Convert.ToDateTime(row["SupportDate"]), "tick");
            }
            //background.grayoutweekends = "gray";
            SupportIncomeCalendar.Background = background.GetBackground();

            // Update background when changing the displayed month
            //SupportIncomeCalendar.DisplayDateChanged += SupportIncomeCalendarViewOnDisplayDateChanged;
            #endregion
        }
Пример #3
0
        private void CalendarUpdate()
        {
            CalenderBackground background;

            background = new CalenderBackground(MainCalendar);

            background.AddOverlay("blue", $"Assets\\blue.png");

            var model = new NoteViewModel();
            var dates = model.GetDates();

            foreach (var date in dates)
            {
                background.AddDate(date, "blue");
            }

            MainCalendar.Background          = background.GetBackground();
            MainCalendar.DisplayDateChanged += (sender, e) => MainCalendar.Background = background.GetBackground();
            MainCalendar.DisplayModeChanged += (s, e) => MainCalendar.Background = background.GetBackground();
        }