Beispiel #1
0
        public Controller()
        {
            var connString = "Data Source=localhost;Initial Catalog=vim_persist;UID=sa;PWD=d0nkey;";
            var conn = new SqlConnection(connString);
            conn.Open();
            var sql = "select descr, body from note";
            var cmd = new SqlCommand(sql, conn);
            var rdr = cmd.ExecuteReader();
            if (rdr == null) throw new Exception(".NET stopped working!");

            while (rdr.Read()) _data.Add(NoteData.FromReader(rdr));

            _leftNavController = new LeftNavController(_data) {Updater = this};
            var cursor = new TextCursor();
            Cursor = cursor;

            _currentNav = _leftNavController;

            _textMetricAdapter = new TextMetricAdapter(cursor) {TextProvider = _data[HilightIndex].Body};
        }
Beispiel #2
0
 public TextController(TextCursor cursor)
 {
     _cursor = cursor;
 }
 public TextMetricAdapter(TextCursor cursor)
 {
     _fnGetRow = i => _controller.TextProvider.Lines.ElementAt(i);
     _fnRowCount = () => _controller.TextProvider.Lines.Count();
     _controller = new TextController(cursor) {Updater = this};
 }