public Window1() { InitializeComponent(); EventTab ti = new EventTab(this); EventsPanel.Items.Add(ti); LogError(ti.name); ti.XButton.IsEnabled = false; baseDirectory.Text = System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\"; folderName.Text = "C" + DateTime.Now.ToString("s").Replace(":",""); }
internal void RemoveEventHandler(EventTab et) { TabControl tc = (TabControl)et.Parent; if (ErrorList.Contains(et.name)) ErrorList.Remove(et.name); foreach (GVEntry gve in et.GVPanel.Items) if (ErrorList.Contains(gve.name)) ErrorList.Remove(gve.name); tc.Items.Remove(et); foreach (EventTab et1 in tc.Items) // recheck the tabs to clear errors and reset BDF Create button { string check = et1.name.Text; bool OK = (check != ""); foreach (EventTab et2 in tc.Items) OK &= (et1 == et2 || et2.name.Text != check); if (OK) RemoveError(et1.name); else LogError(et1.name); foreach (GVEntry gve in et1.GVPanel.Items) { check = gve.name.Text; OK = (check != ""); foreach (EventTab et2 in tc.Items) foreach (GVEntry gve1 in et2.GVPanel.Items) OK &= (gve == gve1 || gve1.name.Text != check); if (OK) RemoveError(gve.name); else LogError(gve.name); } } if (tc.Items.Count == 1) // disable event remove buttons { ((EventTab)tc.Items[0]).XButton.IsEnabled = false; RemoveEvent.IsEnabled = false; } }
private void AddEvent_Click(object sender, RoutedEventArgs e) { EventTab ti = new EventTab(this); EventsPanel.Items.Add(ti); LogError(ti.name); // mark as error initially to force name change ti.IsSelected = true; foreach (EventTab et in EventsPanel.Items) et.XButton.IsEnabled = true; RemoveEvent.IsEnabled = true; }