private void lbxSl_Selected(object sender, RoutedEventArgs e) { ListBoxItem i = sender as ListBoxItem; if (i == null) { return; } foreach (TabItem t in tbcSl.Items) { if (t.Name == "_" + (i.Content as string).Replace(':', '_')) { return; } } ExamSlot sl; if (!mBrd.Slots.TryGetValue(i.Content as string, out sl)) { return; } Op1SlotView vw = new Op1SlotView(); vw.mSl = sl; vw.DeepCopyNee(tbiRefNee); vw.ShowExaminee(); vfbLock.Add(vw.vbLock); vw.Name = "_" + (i.Content as string).Replace(':', '_'); vw.Header = sl.Dt.ToString(DT.hh); vw.toSubmCb = ToSubmit; tbcSl.Items.Add(vw); vw.Focus(); }
private void lbxSl_Unselected(object sender, RoutedEventArgs e) { ListBoxItem i = sender as ListBoxItem; if (i == null) { return; } mBrd.Slots.Remove(i.Content as string); foreach (TabItem ti in tbcSl.Items) { if (ti.Name == "_" + (i.Content as string).Replace(':', '_')) { tbcSl.Items.Remove(ti); Op1SlotView vw = ti as Op1SlotView; if (vw != null) { vfbLock.Remove(vw.vbLock); } break; } } }