// 重新讀取list public void ReloadAllShapes(List <IShape> shapes) { GetTotalShapes.Clear(); Console.WriteLine(shapes.Count); foreach (IShape shape in shapes) { GetTotalShapes.Add(shape); } NotifyModelChanged(); }
// 從所有形狀中移除選取的 public void RemoveSelectedShapeFromTotalShapes() { GetTotalShapes.RemoveAt(GetSelectedShapeIndex()); }
// 從所有形狀中插入選取的 public void InsertSelectedShapeFromTotalShapes(int index) { GetTotalShapes.Insert(index, SelectedShape); }
// 取得選取的形狀的索引 public int GetSelectedShapeIndex() { return(GetTotalShapes.FindIndex(selectShape => selectShape == SelectedShape)); }