/// <summary> /// Edits the love of the given truth. /// </summary> /// <param name="truth">Truth to edit.</param> public void EditTruth(Truth truth) { var love = new LoveViewModel { IsUpdating = true, IsExpanded = true }; foreach (var light in truth.Love.Peace) { love.Light.Add(new Light(light)); } love.IsUpdating = false; love.Light.Add(truth.Love.Light); this.Love.Insert(0, love); this.OnLoveAdded(); }
/// <summary> /// Sets the data baseed on the current environment. /// </summary> private void LoadData() { if (this.m_SaveData == null) { return; } var data = this.UseProduction ? this.m_SaveData.ProductionData : this.m_SaveData.LocalData; this.UserName = data.User; this.Light.SearchText = data.SearchText; this.Light.SearchResults.Clear(); foreach (var light in data.SearchLight) { this.Light.SearchResults.Add(new Light { Id = light.Id, Text = light.Text }); } this.Light.Light.Clear(); foreach (var light in data.StagedLight) { this.Light.Light.Add(new Light { Id = light.Id, Text = light.Text }); } this.Love.Clear(); foreach (var l in data.Love) { var love = new LoveViewModel { IsUpdating = true, IsExpanded = l.IsExpanded }; for (var i = 0; i < l.Light.Count; i++) { var light = l.Light [i]; if (i == l.Light.Count - 1) { love.IsUpdating = false; } love.Light.Add(new Light { Id = light.Id, Text = light.Text }); } this.Love.Add(love); } }
/// <summary> /// Closes the given love. /// </summary> /// <param name="love">The love to close.</param> public void CloseLove(LoveViewModel love) { this.Love.Remove(love); }