private void newW(object sender, RoutedEventArgs e) { string xml = label_xmlPath.Content.ToString(); string xml2 = label_xml2Path.Content.ToString(); string txt = label_txtPath.Content.ToString(); if (comboList == "broadcasting" && isPath() == 0) { Broadcasting br = new Broadcasting(); br.xml = xml; br.txt = txt; json.json.broadcasting.Add(br); json.record(); WatcherOne wo = new WatcherOne(); wo.dataFile = br; wo.context = this; WOne.Add(wo); } else if (comboList == "retransmission" && isPath() == 0) { Retransmission re = new Retransmission(); re.xml = xml; re.xml2 = xml2; re.txt = txt; json.json.retransmission.Add(re); json.record(); WatcherTwo wt = new WatcherTwo(); wt.dataFile = re; wt.context = this; WTwo.Add(wt); } list_name_main.Items.Refresh(); }
public MainWindow() { InitializeComponent(); of = new OpenFile(); json = new Json(); json.read(); WTwo = new List <WatcherTwo>(); foreach (Retransmission ret in json.json.retransmission) { ret.status = "off"; ret.artist = ""; ret.name = ""; WatcherTwo wt = new WatcherTwo(); wt.dataFile = ret; wt.context = this; WTwo.Add(wt); } WOne = new List <WatcherOne>(); foreach (Broadcasting ret in json.json.broadcasting) { ret.status = "off"; ret.artist = ""; ret.name = ""; WatcherOne wo = new WatcherOne(); wo.dataFile = ret; wo.context = this; WOne.Add(wo); } list_name_main.ItemsSource = json.json.broadcasting; List <string> cbeList = new List <string>() { "broadcasting", "retransmission" }; ComboBoxElements cbe = new ComboBoxElements() { bindComboSearch = cbeList }; comboBox_name_category.DataContext = cbe; comboBox_name_category.SelectedValue = "broadcasting"; label_header.Visibility = Visibility.Hidden; button_header.Visibility = Visibility.Hidden; label_xml2Path.Visibility = Visibility.Hidden; }