/// <summary> /// Initializes a new main view model. /// </summary> public MainViewModel() { this.UseLocal = true; this.Light = new LightViewModel(); this.m_SaveData = new SaveEnvironment(); this.Love = new ObservableCollection <LoveViewModel> (); var timer = new DispatcherTimer(DispatcherPriority.Normal, Dispatcher.CurrentDispatcher) { Interval = new TimeSpan(0, 1, 0) }; timer.Tick += this.OnTimerTick; timer.Start(); Instance = this; }
/// <summary> /// Loads any saved data. /// </summary> public void Load() { if (File.Exists(Constants.SAVE_FILE)) { this.m_SaveData = Serialization.Deserialize <SaveEnvironment> (Constants.SAVE_FILE); if (this.m_SaveData.UseProduction) { this.UseProduction = true; } else { this.LoadData(); } } }