private void subMenu_Closed_Handler(object sender, EventArgs e) { NewDiag newDiag = sender as NewDiag; if (newDiag.Result == true) { Target t = new Target(false, newDiag.T_FileTextBox.Text, newDiag.T_NameTextBox.Text, new Syslog() { Priority = (newDiag.C_Syslog_Priority.SelectedItem as Priority).Id, Facility = (newDiag.C_Syslog_Facility.SelectedItem as Facility).Id, Receiver = newDiag.T_Syslog_IP.Text, AddDate = (newDiag.C_AddDate.IsChecked == true) ? true : false, } ); if (newDiag.EditMode == false) { this.L_MainList.Items.Add(t); } else { this.L_MainList.Items[newDiag.Index] = t; } t.Init(); Modified = true; } }
private void subMenu_New_Click(object sender, RoutedEventArgs e) { NewDiag newDiag = new NewDiag(); newDiag.Closed += new EventHandler(subMenu_Closed_Handler); newDiag.Show(); }
private void subMenu_Edit_Click(object sender, RoutedEventArgs e) { int index = this.L_MainList.SelectedIndex; NewDiag newDiag = new NewDiag(); newDiag.SetTargetParam(this.L_MainList.Items[index] as Target, index); newDiag.Closed += new EventHandler(subMenu_Closed_Handler); newDiag.Show(); }