示例#1
0
        public SnippetsViewModel()
        {
            _snippetRepository = new SnippetRepository();
            _snippetService    = new SnippetService();

            Snippets = new ObservableCollection <Snippet>(
                _snippetRepository.GetAll());

            _snippetService.ApplySnippets(Snippets);

            AddCommand    = new DelegatingCommand(x => true, OnAdd);
            SaveCommand   = new DelegatingCommand(x => true, OnSave);
            DeleteCommand = new DelegatingCommand(x => true, OnDelete);
        }
示例#2
0
 public void OnSave(object param)
 {
     // todo use Rx to debounce and auto-save
     _snippetRepository.Save(Snippets);
     _snippetService.ApplySnippets(Snippets);
 }