public MainViewModel(ISQLiteMethods sqlite)
 {
     _sqlite = sqlite;
     LoadItems();
     SaveCommand = new Command(async() => await AddItems());
     Items       = new ObservableCollection <Todo>();
 }
Esempio n. 2
0
        public MainViewModel(IPageService pageService, ISQLiteMethods sqlite)
        {
            _pageService = pageService;
            _sqlite      = sqlite;

            MemoList = new ObservableCollection <Memo>();

            AddMemoCommand      = new Command(AddMemo);
            DeleteMemoCommand   = new Command <Memo>(DeleteMemo);
            SelectedMemoCommand = new Command(MemoSelected);
            LoadDataCommand     = new Command(LoadData);

            LoadDataCommand.Execute(null);
        }
        public AddMemoViewModel(IPageService pageService, ISQLiteMethods sqlite, Memo memo)
        {
            _pageService = pageService;
            _sqlite      = sqlite;
            _memo        = new Memo
            {
                Id      = memo.Id,
                Title   = memo.Title,
                Content = memo.Content
            };

            TitleEntry    = memo.Title;
            ContentEditor = memo.Content;

            SaveMemoCommand = new Command(() => SaveMemo());
        }