private void cBST_SelectionChanged(object sender, SelectionChangedEventArgs e) { Logger.Debug("cBST_SelectionChanged"); try { //lBYear = new System.Windows.Controls.ListBox(); if (cBST.SelectedValue != null) { objST = new GWStation(); objST.STNO = cBST.SelectedValue.ToString(); objST.GetYearsList(); lBYear.ItemsSource = objST.Years; } } catch (Exception ex) { Logger.Error(ex.Message.ToString()); } }
private void cBBasin_SelectionChanged(object sender, SelectionChangedEventArgs e) { Logger.Debug("cBBasin_SelectionChanged"); try { //cBST = new System.Windows.Controls.ComboBox(); objSTList = new GWStationList(); objST = new GWStation(); cBST.SelectedValuePath = "Key"; cBST.DisplayMemberPath = "Value"; objSTList.GetSTList(cBBasin.SelectedValue.ToString()); cBST.ItemsSource = objSTList.Station; objST.Years.Clear(); lBYear.ItemsSource = objST.Years; } catch (Exception ex) { Logger.Error(ex.Message.ToString()); } }
private void btnRun_Click(object sender, RoutedEventArgs e) { Logger.Debug("btnRun_Click"); try { foreach (string item in lBGetData.Items) { objST = new GWStation(); objST.QY = item.Split(' ')[1]; objST.STNO = item.Split(' ')[0]; objST.DailySavetotext(); } System.Windows.Forms.MessageBox.Show("資料讀取成功"); } catch (Exception ex) { Logger.Error(ex.Message.ToString()); System.Windows.Forms.MessageBox.Show("資料讀取失敗 error : " + ex.Message.ToString()); } }