예제 #1
0
        public ThoughtEntryVM(IRandomThoughtDatabase database)
        {
            _database = database;
            Speed     = 100;

            this._addCommand = ReactiveCommand.Create(
                () =>
            {
                _database.AddThought(Thought);
            });
            this._getSizeCommand = ReactiveCommand.Create(
                () =>
            {
                dbsize();
            });
            this._getItemCommand = ReactiveCommand.Create(
                () =>
            {
                if (GetItemId != null && GetItemId != "")
                {
                    PluckedRandomThought = _database.GetThought(Int32.Parse(GetItemId));
                }
            });
            this._dropTableCommand = ReactiveCommand.Create(
                () =>
            {
                _database.DropTable();
            });
            this._getNumberOfRowsCommand = ReactiveCommand.Create(
                () =>
            {
                numrows();
            }
                );
        }
예제 #2
0
        public RandomThoughtsVM(IRandomThoughtDatabase randomThoughtDatabase)
        {
            _randomThoughtDatabase = randomThoughtDatabase;
            ThoughtList            = new ReactiveList <RandomThought>();
            var thoughts = _randomThoughtDatabase.GetThoughts();

            ThoughtList.AddRange(thoughts);
        }