예제 #1
0
        public void Initialize(EntryEditorVM vm)
        {
            _vm = vm ?? throw new ArgumentNullException(nameof(vm));

            InnerCtrl.Initialize(_vm);

            btnNext.DataBindings.Add(nameof(btnNext.Enabled), _vm, nameof(_vm.NextAvailable), false, DataSourceUpdateMode.OnPropertyChanged);
            btnPrevious.DataBindings.Add(nameof(btnPrevious.Enabled), _vm, nameof(_vm.PreviousAvailable), false, DataSourceUpdateMode.OnPropertyChanged);
            btnCommit.DataBindings.Add(nameof(btnCommit.Enabled), _vm, nameof(_vm.CommitEnabled), false, DataSourceUpdateMode.OnPropertyChanged);
            btnRevert.DataBindings.Add(nameof(btnRevert.Enabled), _vm, nameof(_vm.RevertEnabled), false, DataSourceUpdateMode.OnPropertyChanged);

            btnCommit.Click   += (s, a) => _vm.Commit();
            btnRevert.Click   += (s, a) => _vm.Revert();
            btnNext.Click     += (s, a) => _vm.EditNextEntry();
            btnPrevious.Click += (s, a) => _vm.EditPreviousEntry();

            OnEditedChanged();
        }