Пример #1
0
        public AddCalendarNoteView(CalendarNoteModel model = null)
        {
            InitializeComponent();
            DataContext = ViewModel = new AddCalendarNoteViewModel(model);

            Owner = Application.Current.MainWindow;
        }
Пример #2
0
        private void ProcessNote(CalendarNoteModel note)
        {
            _isEdit = note != null;

            CalendarNote = _isEdit ? note : GetCalendarNote();
            CalendarNote.PropertyChanged += (sender, args) => SaveCommand.RaiseCanExecuteChanged();
        }
Пример #3
0
        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);
        }
Пример #4
0
 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
     };
 }
Пример #5
0
 private async void DeleteCalendarNoteCommandExecuted(CalendarNoteModel obj)
 {
     _eventsDataUnit.CalendarNotesRepository.Delete(obj.CalendarNote);
     await _eventsDataUnit.SaveChanges();
 }
Пример #6
0
        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();
            }
        }