예제 #1
0
        public bool Load(TRecord record)
        {
            if (record == null)
            {
                throw new ArgumentNullException(nameof(record));
            }

            if (Save())
            {
                if (_record != null)
                {
                    _priorRecord = _record;
                }
                _record  = record;
                _suspend = true;
                foreach (var action in _setControls)
                {
                    action.Invoke(record);
                }
                RecordLoaded?.Invoke(this, new EventArgs());
                ValidationPanel?.SetStatus(RecordStatus.Valid, "Record loaded");
                ToolStrip?.OnClean(false);
                _suspend = false;
                return(true);
            }
            return(false);
        }