/// <summary> /// opens a new tab avigating at uri, and displaying the image /// </summary> /// <param name="uri"></param> /// <param name="propertyBag"></param> /// <param name="img"></param> /// <param name="name"></param> public void NewTab(string uri, IDictionary propertyBag, byte[] img, string name) { Tab oldTab = Current; Current.Hide(); Tab tab = new Tab { HorizontalAlignment = HorizontalAlignment.Stretch, TabName = name, Image = img, Uri = uri }; itemTabs.Add(tab); Current = tab; try { if (propertyBag == null) { tab.Navigate(uri); } else { tab.Navigate(uri, propertyBag); } tab.Focus(); } catch (Exception e) { RoLog.Instance.WriteToLog(e.ToString(), TracedAttribute.ERROR); tab.Close(); Current = oldTab; throw; } Current.Show(); }
/// <summary> /// closes a tab /// </summary> /// <param name="tab"></param> public void Close(Tab tab) { //if more then one tab if (itemTabs.Count > 1) { //close and remove this.RaiseTabClosing(tab); tab.Close(); itemTabs.Remove(tab); //set current the first Current = itemTabs[0]; tab = null; } //othewise do nothing as the last tab can't be closed }
/// <summary> /// opens a new tab avigating at uri, and displaying the image /// </summary> /// <param name="uri"></param> /// <param name="propertyBag"></param> /// <param name="img"></param> /// <param name="name"></param> public void NewTab(string uri, IDictionary propertyBag, byte[] img, string name) { Tab oldTab = Current; Current.Hide(); Tab tab = new Tab { HorizontalAlignment = HorizontalAlignment.Stretch, TabName = name, Image = img, Uri = uri }; itemTabs.Add(tab); Current = tab; try { if (propertyBag == null) tab.Navigate(uri); else tab.Navigate(uri, propertyBag); tab.Focus(); } catch (Exception e) { RoLog.Instance.WriteToLog(e.ToString(), TracedAttribute.ERROR); tab.Close(); Current = oldTab; throw; } Current.Show(); }