public void LoadState(IReadOnlyStateBucket state) { RestoreRestorableState(state); OnLoadState(state); _stateLoaded = true; SetIsNew(); }
private void RestoreRestorableState(IReadOnlyStateBucket state) { var viewModelProperties = GetType().GetRuntimeProperties().Where(c => c.GetCustomAttribute(typeof(RestorableStateAttribute)) != null); foreach (PropertyInfo propertyInfo in viewModelProperties) { if (state.ContainsKey(propertyInfo.Name)) { propertyInfo.SetValue(this, state[propertyInfo.Name]); } } }
protected virtual void OnLoadState(IReadOnlyStateBucket sessionState) { }