public void MoveToPrevious() { switch (Type) { case PeriodType.Day: SelectedDate = SelectedDate.AddDays(-1); break; case PeriodType.Week: SelectedDate = SelectedDate.AddDays(-7); break; case PeriodType.Month: SelectedDate = SelectedDate.AddMonths(-1); break; case PeriodType.Year: SelectedDate = SelectedDate.AddYears(-1); break; case PeriodType.All: /// intentionally blank space break; } CalculateDates(); OnPropertyChanged(nameof(Description)); }
public void PrevPage() { switch (Mode) { case WpfScheduler.Mode.Day: SelectedDate = SelectedDate.AddDays(-1); break; case WpfScheduler.Mode.Week: SelectedDate = SelectedDate.AddDays(-7); break; case WpfScheduler.Mode.Month: SelectedDate = SelectedDate.AddMonths(-1); break; } }
private void BtnIncMonth_Click(object sender, RoutedEventArgs e) { SelectedDate = SelectedDate.AddMonths(1); }
public TimedTasksViewModel() { Utils.Database.InitDB(); Utils.Database.CreateDB(); PropertyChanged += TimedTasksViewModel_PropertyChanged; tasks = new ObservableCollection <object>(); IncreaseDateByDayCommand = new Command(() => SelectedDate = SelectedDate.AddDays(1)); DecreaseDateByDayCommand = new Command(() => SelectedDate = SelectedDate.AddDays(-1)); IncreaseDateByMonthCommand = new Command(() => SelectedDate = SelectedDate.AddMonths(1)); DecreaseDateByMonthCommand = new Command(() => SelectedDate = SelectedDate.AddMonths(-1)); AddNewTaskCommand = new Command <TaskViewModel>((task) => { Utils.Database.InsertTask(task); RefreshTasks(); }); RemoveTaskCommand = new Command <TaskViewModel>((task) => { Utils.Database.DeleteTask(task); RefreshTasks(); }); UpdateTaskCommand = new Command <TaskViewModel>((task) => { Utils.Database.UpdateTask(task); RefreshTasks(); }); ShowDailyTasksCommand = new Command(() => { TaskSelectOption = TaskSelectOptions.CurrentDay; Utils.AppData.Data.TaskSelectOption = TaskSelectOption.ToString(); }); ShowAllTasksCommand = new Command(() => { TaskSelectOption = TaskSelectOptions.AllDaysByDate; Utils.AppData.Data.TaskSelectOption = TaskSelectOption.ToString(); }); ChangeFinishedVisibilityCommand = new Command(() => { FinishedTasksVisible = !FinishedTasksVisible; var key = TaskSelectOption.ToString(); if (Utils.AppData.Data.GroupVisibilitySetting.ContainsKey(key)) { Utils.AppData.Data.GroupVisibilitySetting[key] = FinishedTasksVisible; } else { Utils.AppData.Data.GroupVisibilitySetting.Add(key, FinishedTasksVisible); } RefreshTasks(); }); LoadSettings(); SetTaskSettings(); RefreshTasks(); }
private void buttonRight_Click(object sender, System.EventArgs e) { selectedDayLabel.BackColor = Color.Transparent; selectedDayLabel.ForeColor = foreColor; SelectedDate = SelectedDate.AddMonths(1); }
public void ExpandSchedule() { ExpandSchedule(SelectedDate.AddMonths(-2), SelectedDate.AddMonths(3)); }
public void TimeBackward() { SelectedDate = Mode == PerformanceViewMode.Daily ? SelectedDate.AddDays(-1) : SelectedDate.AddMonths(-1); }
/// <summary> /// Draw the specified canvas. /// </summary> /// <param name="canvas">Canvas.</param> /// <param name="rect">Rect.</param> public void DrawCalendar(NGraphics.ICanvas canvas, NGraphics.Rect rect) { base.Draw(canvas, rect); // Should we use last line? // var drawLastLine = true; var colWidth = rect.Width / 7; var rowHeight = rect.Height / 6; // Find first week of day var firstWeekDay = CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek; // Find last of this day in previous month var lastDayInPrevMonth = GetLastDayInMonth(SelectedDate.AddMonths(-1)); while (lastDayInPrevMonth.DayOfWeek != firstWeekDay) { lastDayInPrevMonth = lastDayInPrevMonth.AddDays(-1); } // Set up brushes var selectedBrush = new NGraphics.SolidBrush(SelectedDateColor.ToNColor()); var prevNextBrush = new NGraphics.SolidBrush(Color.FromHex("#EEEEEE").ToNColor()); var currentDate = lastDayInPrevMonth; StartDate = lastDayInPrevMonth; var col = 0; var row = 0; for (int d = 0; d < _dayNumberLabels.Length; d++) { // Update text _dayNumberLabels [d].Text = currentDate.Day.ToString(); if (currentDate.Month != SelectedDate.Month) { // Prev/next month _dayNumberLabels [d].TextColor = Color.FromHex("#CECECE"); } else { // Background canvas.DrawRectangle(new NGraphics.Rect(col * colWidth, row * rowHeight, colWidth, rowHeight), null, prevNextBrush); if (currentDate.DayOfWeek == DayOfWeek.Sunday || currentDate.DayOfWeek == DayOfWeek.Saturday) { // Weekends _dayNumberLabels [d].TextColor = Color.FromHex("#CACACA"); } else { // Regular days _dayNumberLabels [d].TextColor = Color.Black; } } if (IsSameDay(SelectedDate, currentDate)) { // Selected colors _dayNumberLabels[d].TextColor = Color.White; // Background canvas.DrawRectangle(new NGraphics.Rect(col * colWidth, row * rowHeight, colWidth, rowHeight), null, selectedBrush); } if (IsSameDay(DateTime.Now, currentDate)) { // Today _dayNumberLabels[d].TextColor = Color.White; // Background var wh = Math.Min(colWidth, rowHeight); var rc = new NGraphics.Rect((col * colWidth), (row * rowHeight), wh, wh); rc.Inflate(-1, -1); rc.X += 3; canvas.DrawEllipse(rc, null, new NGraphics.SolidBrush(Color.FromHex("#fc3d39").ToNColor())); } // Col/row-counter col++; if (col == 7) { col = 0; row++; } currentDate = currentDate.AddDays(1); } var colRowPen = new NGraphics.Pen(Color.FromHex("#FFFFFF").ToNColor(), 1); // Draw row lines for (var r = 0; r < 7; r++) { canvas.DrawPath(new NGraphics.PathOp[] { new NGraphics.MoveTo(0, r * rowHeight), new NGraphics.LineTo(rect.Width, r * rowHeight) }, colRowPen); } // Draw col lines for (var c = 0; c < 7; c++) { canvas.DrawPath(new NGraphics.PathOp[] { new NGraphics.MoveTo(c * colWidth, 0), new NGraphics.LineTo(c * colWidth, rect.Height) }, colRowPen); } }