public AddCalendarNoteView(CalendarNoteModel model = null) { InitializeComponent(); DataContext = ViewModel = new AddCalendarNoteViewModel(model); Owner = Application.Current.MainWindow; }
private void ProcessNote(CalendarNoteModel note) { _isEdit = note != null; CalendarNote = _isEdit ? note : GetCalendarNote(); CalendarNote.PropertyChanged += (sender, args) => SaveCommand.RaiseCanExecuteChanged(); }
public AddCalendarNoteViewModel(CalendarNoteModel note) { var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve<IDataUnitLocator>(); _eventsDataUnit = dataUnitLocator.ResolveDataUnit<IEventDataUnit>(); SaveCommand = new RelayCommand(SaveCommandExecuted, SaveCommandCanExecute); CancelCommand = new RelayCommand(CancelCommandExecuted); ProcessNote(note); }
private Appointment ConvertCalendarNoteToAppointment(CalendarNoteModel note) { return new CalendarNoteAppointment() { Start = note.CalendarNote.StartTime, End = note.CalendarNote.EndTime, Subject = note.Description, CalendarNote = note, Color = new BrushConverter().ConvertFromString(note.Color) as SolidColorBrush }; }
private async void DeleteCalendarNoteCommandExecuted(CalendarNoteModel obj) { _eventsDataUnit.CalendarNotesRepository.Delete(obj.CalendarNote); await _eventsDataUnit.SaveChanges(); }
private async void EditCalendarNoteCommandExecuted(CalendarNoteModel obj) { RaisePropertyChanged("DisableParentWindow"); var window = new AddCalendarNoteView(obj); window.ShowDialog(); RaisePropertyChanged("EnableParentWindow"); if (window.DialogResult != null && window.DialogResult.Value) { await OnLoadCalendarNotes(); RefreshAppointments(); } }