public void OpenLawIncident(string i9EventID) { if (string.IsNullOrEmpty(i9EventID) == false) { foreach (TabItem tab in IncidentTabControl.Items) { if (tab.Content.GetType() == typeof(IncidentEntry)) { IncidentEntry i = (IncidentEntry)tab.Content; if (i.i9EventID == i9EventID) { tab.Focus(); return; } } } } IncidentEntry ie = new IncidentEntry(i9EventID); ie.CloseIncident += new IncidentEntry.CloseIncidentDelegate(IncidentEntry_CloseIncident); TabItem ti = new TabItem(); if (string.IsNullOrEmpty(i9EventID)) { ti.Header = "New Law Incident"; } else { ti.Header = "Edit Law Incident"; } ti.Content = ie; ie.Visibility = Visibility.Visible; IncidentTabControl.Items.Add(ti); IncidentTabControl.SelectedItem = ti; ie.Width = Double.NaN; ie.Height = Double.NaN; }
private void IncidentEntry_CloseIncident(string i9EventID, string i9Guid) { if (string.IsNullOrEmpty(i9Guid) == false) { foreach (TabItem tab in IncidentTabControl.Items) { if (tab.Content.GetType() == typeof(IncidentEntry)) { IncidentEntry i = (IncidentEntry)tab.Content; if (i.i9Guid == i9Guid) { if ((MessageBox.Show("Close Incident Entry", "Incident Entry", MessageBoxButton.YesNoCancel, MessageBoxImage.Question) == MessageBoxResult.Yes)) { IncidentTabControl.Items.Remove(tab); } return; } } } } }
public void OpenLawIncident(string i9EventID) { if (string.IsNullOrEmpty(i9EventID) == false) { foreach (TabItem tab in IncidentTabControl.Items) { if (tab.Content.GetType() == typeof(IncidentEntry)) { IncidentEntry i = (IncidentEntry)tab.Content; if (i.i9EventID == i9EventID) { tab.Focus(); return; } } } } IncidentEntry ie = new IncidentEntry(i9EventID); ie.CloseIncident += new IncidentEntry.CloseIncidentDelegate(IncidentEntry_CloseIncident); TabItem ti = new TabItem(); if (string.IsNullOrEmpty(i9EventID)) ti.Header = "New Law Incident"; else ti.Header = "Edit Law Incident"; ti.Content = ie; ie.Visibility = Visibility.Visible; IncidentTabControl.Items.Add(ti); IncidentTabControl.SelectedItem = ti; ie.Width = Double.NaN; ie.Height = Double.NaN; }