// データロード public void Load() { var data = DependencyService.Get <ISaveAndLoad>().LoadData("temp.json"); Model = JsonConvert.DeserializeObject <AllPageModel>(data); this.BackgroundColorIndex = Model.BackgroundColorIndex; this.LifeColorIndex = Model.LifeColorIndex; this.LifeIndex = Model.LifeIndex; this.LifeResetCheck = Model.LifeResetCheck; this.BigButtonCheck = Model.BigButtonCheck; this.EnergyCounterCheck = Model.EnergyCounterCheck; }
// Model購読 // データロード public void Load() { try { var data = DependencyService.Get <ISaveAndLoad>().LoadData("temp.json"); Model = JsonConvert.DeserializeObject <AllPageModel>(data); this.BackgroundColor = Model.BackgroundColor; this.LifeFontColor = Model.LifeFontColor; this.DefaultLifePoint = Model.DefaultLifePoint; this.LifeResetCheck = Model.LifeResetCheck; this.BigButtonCheck = Model.BigButtonCheck; this.EnergyCounterCheck = Model.EnergyCounterCheck; this.Message = Model.Message; } catch (Exception) { var json = JsonConvert.SerializeObject(new AllPageModel("初期化")); DependencyService.Get <ISaveAndLoad>().SaveData("temp.json", json); Load(); } }