public void Execute(object parameter)
        {
            var details = new DetailsWindow
            {
                DataContext = _viewModel.SelectedEntry,
                CancelButton = {Visibility = Visibility.Hidden},
                DeleteButton = {Visibility = Visibility.Visible},
            };
            var result = details.ShowDialog();

            if (result != null && result.Value == false)
            {
                _viewModel.Entries.Remove(_viewModel.SelectedEntry);
                _viewModel.SelectedEntry = null;
            }

            LocalDataService.Save(_viewModel.Entries);
            _viewModel.Refresh();
        }
예제 #2
0
        public void Execute(object parameter)
        {
            var entry = new EntryViewModel()
            {
                Index = _viewModel.Entries.Count + 1
            };

            var details = new DetailsWindow
            {
                DataContext = entry,
                CancelButton = {Visibility = Visibility.Visible},
                DeleteButton = {Visibility = Visibility.Hidden}
            };

            var result = details.ShowDialog();

            if (result.HasValue && result.Value)
                _viewModel.Entries.Add(entry);

            if (_viewModel.Entries.Count > 0)
                LocalDataService.Save(_viewModel.Entries);
            _viewModel.Refresh();
        }