private void Valider_Click(object sender, RoutedEventArgs e) { List <Data> MalistDeData = new List <Data>(); ParseurXml MonParseurXml = new ParseurXml(); DataAcess MonDataAcess = new DataAcess(); MalistDeData = MonDataAcess.GetAllData(); string _lot = LotDropDown.SelectedValue == null ? "" : LotDropDown.SelectedValue.ToString(); string _layout = LayoutDropDown.SelectedValue == null ? "" : LayoutDropDown.SelectedValue.ToString(); string _component = ComponentDropDown.SelectedValue == null ? "" : ComponentDropDown.SelectedValue.ToString(); string _performance = PerformanceDropDown.SelectedValue == null ? "" : PerformanceDropDown.SelectedValue.ToString(); string _quality = QualityDropDown.SelectedValue == null ? "" : QualityDropDown.SelectedValue.ToString(); string _color = ColorDropDown.SelectedValue == null ? "" : ColorDropDown.SelectedValue.ToString(); string _date = Date.SelectedDate == null ? "" : Date.SelectedDate.ToString(); var items = from lotItem in MalistDeData where (_quality == "" || lotItem.quality == _quality) && (_performance == "" || lotItem.performance == _performance) && (_layout == "" || lotItem.layout.ToString() == _layout) && (_component == "" || lotItem.component == _component) && (_lot == "" || lotItem.lot == _lot) && (_color == "" || lotItem.colorbound == _color) && (_date == "" || lotItem.date.ToString() == _date) select lotItem; dataGrid.DataContext = items.ToList(); dataGrid.ItemsSource = items.ToList(); Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.ApplicationIdle, new Action(ProcessRows)); }
public MainWindow() { InitializeComponent(); ListeDataGraph = new List <Data>(); List <Data> MalistDeData = new List <Data>(); ParseurXml MonParseurXml = new ParseurXml(); string sPath = @"C:\Users\eithi\Source\Repos\ProjetClay\Clay\Clay\Resources\"; DataAcess MonDataAcess = new DataAcess(); foreach (string sFileName in System.IO.Directory.GetFiles(sPath)) { if (System.IO.Path.GetExtension(sFileName) == ".xml") { MalistDeData = MonParseurXml.LectureXML(sFileName); MonDataAcess.SetData(MalistDeData); MalistDeData.Clear(); } } ListeDataGraph = MonDataAcess.GetAllData(); Init(); }
private void Extraire_Click(object sender, RoutedEventArgs e) { InitializeComponent(); ParseurXml MonParseurXml = new ParseurXml(); var value = MonthDropDown.SelectedItem; if (value != null) { progressBar.Visibility = Visibility.Visible; progressBar.IsIndeterminate = true; string pMoisAnnee = value.ToString(); List <Data> ListeTrier = new List <Data>(); DataAcess MonDataAcess = new DataAcess(); foreach (var item in MonDataAcess.GetAllData()) { if (item.date.ToString("MMyyyy") == pMoisAnnee) { ListeTrier.Add(item); } } new Thread((ThreadStart) delegate { //do time-consuming work here MonParseurXml.WriteXmlDependMonth(ListeTrier, pMoisAnnee); Thread.Sleep(2000); //then dispatch back to the UI thread to update the progress bar Dispatcher.Invoke((ThreadStart) delegate { progressBar.Visibility = Visibility.Hidden; }); }).Start(); } }
private void Init() { List <Data> MalistDeData = new List <Data>(); ParseurXml MonParseurXml = new ParseurXml(); lot = new List <string>(); quality = new List <string>(); performance = new List <string>(); layout = new List <string>(); component = new List <string>(); color = new List <string>(); month = new List <string>(); DataAcess MonDataAcess = new DataAcess(); dataGrid.DataContext = MonDataAcess.GetAllData(); dataGrid.ItemsSource = MonDataAcess.GetAllData(); MalistDeData = MonDataAcess.GetAllData(); foreach (var item in MalistDeData) { lot.Add(item.lot); if (!isInList(quality, item.quality)) { quality.Add(item.quality); } if (!isInList(layout, item.layout.ToString())) { layout.Add(item.layout.ToString()); } if (!isInList(performance, item.performance)) { performance.Add(item.performance); } if (!isInList(component, item.component)) { component.Add(item.component); } if (!isInList(color, item.colorbound)) { color.Add(item.colorbound); } if (!isInList(month, item.date.ToString("MMyyyy"))) { month.Add(item.date.ToString("MMyyyy")); } } LotDropDown.ItemsSource = lot; LotDropDown.Items.Refresh(); QualityDropDown.ItemsSource = quality; QualityDropDown.Items.Refresh(); PerformanceDropDown.ItemsSource = performance; PerformanceDropDown.Items.Refresh(); ComponentDropDown.ItemsSource = component; ComponentDropDown.Items.Refresh(); LayoutDropDown.ItemsSource = layout; LayoutDropDown.Items.Refresh(); ColorDropDown.ItemsSource = color; ColorDropDown.Items.Refresh(); MonthDropDown.ItemsSource = month; MonthDropDown.Items.Refresh(); Date.SelectedDate = null; Date.Text = ""; Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.ApplicationIdle, new Action(ProcessRows)); }