public static void SaveState <T>(this T vm) where T : CoreViewModel, new() { Task.Run(async() => { await CoreDependencyService.GetService <IFileStore, FileStore>(true)?.SaveAsync <T>(typeof(T).FullName, vm); }); }
public static void LoadState <T>(this T vm) where T : CoreViewModel, new() { Task.Run(async() => { var result = await CoreDependencyService.GetService <IFileStore, FileStore>(true)?.GetAsync <T>(typeof(T).FullName); if (result.Error == null) { foreach (var prop in typeof(T).GetProperties()) { prop.SetValue(vm, prop.GetValue(result.Response)); } } }); }