/// <summary> /// 创建一个新页面 /// </summary> public void CreateNewTab(string url) { var newTab = new BrowserTabViewModel(url); BrowserTabs.Add(newTab); SelectedTabIndex = BrowserTabs.IndexOf(newTab); OnPropertyChanged("BrowserTabs"); }
/// <summary> /// 关闭当前页面 /// </summary> private void CloseTab(BrowserTabViewModel closedTab) { if (BrowserTabs.Count > 0 && BrowserTabs.Contains(closedTab)) { BrowserTabs.Remove(closedTab); closedTab.Dispose(); } if (BrowserTabs.Count <= 0) { OpenNewTab(); } }