public override void Execute(params object[] args) { int year; int month; bool large; using (var dialog = new CalendarDialog()) { if (dialog.ShowDialog(owner) != DialogResult.OK) { return; } year = dialog.Year; month = dialog.Month; large = dialog.Large; } using (var one = new OneNote(out page, out ns)) { var root = MakeCalendar(year, month, large); page.AddNextParagraph(root); var header = MakeHeader(year, month); page.AddNextParagraph(header); one.Update(page); } }
private void OpenCalendar(object sender) { if (!(sender is RequestItemViewModel)) { return; } var requestModel = sender as RequestItemViewModel; var model = new CalendarDialogViewModel(_requestService, requestModel.RequestId); if (requestModel.SelectedExecuter == null) { MessageBox.Show(_view, "Необходимо выбрать исполнителя!"); return; } var sched = _requestService.GetScheduleTasks(requestModel.SelectedExecuter.Id, DateTime.Now.Date.AddDays(-7), DateTime.Now.Date.AddDays(14)); var app = sched.Select(s => new Appointment() { Id = s.Id, RequestId = s.RequestId, Subject = string.Format($"{0}", s.RequestId), StartTime = s.FromDate, EndTime = s.ToDate, WorkerInfo = s.Worker.FullName }); model.ScheduleTaskList = new ObservableCollection <Appointment>(app); var view = new CalendarDialog(model); view.DataContext = model; model.SetView(view); view.ShowDialog(); var t = model; requestModel.SelectedAppointment = model.ScheduleTaskList.LastOrDefault(s => s.Id == 0); }