Exemplo n.º 1
0
        private void BuildListWindow()
        {
            _scoreSpin = new SpinButton(new Adjustment(Original.UserScore, 0, 10, 1, 10, 0), 1, 0);

            // default date is today when adding
            if (Original.UserStart == DateTime.MinValue && Original.ListStatus == ApiEntry.ListStatuses.NotInList)
            {
                Result.UserStart = DateTime.Today;
                _userStart       = new DatePicker(DateTime.Today);
            }
            else
            {
                _userStart = new DatePicker(Original.UserStart);
            }

            _userEnd    = new DatePicker(Original.UserEnd);
            _notesEntry = new TextView()
            {
                Buffer = { Text = Original.Notes }
            };

            // Pack List Table
            ListTable.NRows    = 5;
            ListTable.NColumns = 4;
            ListTable.Attach(new Label("Score"), 0, 1, 1, 2);
            ListTable.Attach(_scoreSpin, 2, 3, 1, 2);
            ListTable.Attach(new Label("Started At"), 0, 1, 2, 3);
            ListTable.Attach(_userStart, 2, 4, 2, 3);
            ListTable.Attach(new Label("Completed At"), 0, 1, 3, 4);
            ListTable.Attach(_userEnd, 2, 4, 3, 4);
            ListTable.Attach(new Label("Notes"), 0, 1, 4, 5);
            ListTable.Attach(new ScrolledWindow()
            {
                new Viewport()
                {
                    _notesEntry
                }
            }, 1, 3, 4, 6);

            // Events
            StatusBox.Changed          += OnStatusChanged;
            _scoreSpin.Changed         += OnScoreChanged;
            _userStart.Changed         += OnStartDateChanged;
            _userEnd.Changed           += OnEndDateChanged;
            _notesEntry.Buffer.Changed += OnNotesChanged;
        }