public void OnTriangleAdded(object sender, TriangleEventArgs args) { TriangleListItemViewModel viewModel = new TriangleListItemViewModel { Triangle = args.Triangle }; TriangleListItems.Add(viewModel); }
public override void Start() { List <Triangle> triangles = _TrianglesRepo.GetTriangles(); TriangleListItems = CreateListViewModelsFromTriangeList(triangles); SelectedTriangleListItemViewModel = TriangleListItems.FirstOrDefault(); _TrianglesRepo.TriangleAdded += OnTriangleAdded; }
public void RemoveSelectedTriangle() { if (SelectedTriangleListItemViewModel != null) { var viewModelToDelete = SelectedTriangleListItemViewModel; SelectedTriangleContentViewModel = null; _TrianglesRepo.RemoveTriangle(viewModelToDelete.Triangle); TriangleListItems.Remove(viewModelToDelete); } }