public void DeleteDesignSurfaceExt2(DesignSurfaceExt2 item) { DesignSurfaceExt2Collection.Remove(item); try { item.Dispose(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } var currentIndex = DesignSurfaceExt2Collection.Count - 1; ActiveDesignSurface = currentIndex >= 0 ? DesignSurfaceExt2Collection[currentIndex] : null; }
public void DeleteDesignSurfaceExt2(int index) { DesignSurfaceExt2 item = DesignSurfaceExt2Collection[index]; DesignSurfaceExt2Collection.RemoveAt(index); try { item.Dispose(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } int currentIndex = DesignSurfaceExt2Collection.Count - 1; if (currentIndex >= 0) { ActiveDesignSurface = DesignSurfaceExt2Collection[currentIndex]; } else { ActiveDesignSurface = null; } }