private void Run() { List <FHXParameter> parameters = Root.GetAllParameters(); References = FHXReferenceSearch.Search(parameters); this.gridResults.ItemsSource = References; }
private void Compare(object sender, RoutedEventArgs e) { string n1 = ""; string n2 = ""; OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.Title = Properties.Resources.OpenFirstFile; if (openFileDialog1.ShowDialog() == true) { n1 = openFileDialog1.FileName; } OpenFileDialog openFileDialog2 = new OpenFileDialog(); openFileDialog2.Title = Properties.Resources.OpenSecondFile; if (openFileDialog2.ShowDialog() == true) { n2 = openFileDialog2.FileName; } if (n1 == "" || n2 == "") { return; } FHXObject a = FHXParserWrapper.FromFile(n1); //a = a.Children.Single(i => i.Type == "MODULE"); FHXObject b = FHXParserWrapper.FromFile(n2); //b = b.Children.Single(i => i.Type == "MODULE"); if (a == null || b == null) { MessageBox.Show(Properties.Resources.ErrorLoading); return; } double coef = 37.0 / 11940138.0; double sec = coef * (double)(a.GetAllParameters().Count *b.GetAllParameters().Count); string unit = "s"; if (sec > 60.0) { sec = sec / 60.0; unit = "m"; } else if (sec > 3600.0) { sec = sec / 3600.0; unit = "h"; } string sMessageBoxText = string.Format("La procédure prendra environ {0}{1}. Continuer ?", sec, unit); string sCaption = "Valider la comparaison"; MessageBoxButton btnMessageBox = MessageBoxButton.YesNoCancel; MessageBoxImage icnMessageBox = MessageBoxImage.Warning; MessageBoxResult rsltMessageBox = MessageBox.Show(sMessageBoxText, sCaption, btnMessageBox, icnMessageBox); switch (rsltMessageBox) { case MessageBoxResult.Yes: results = FHXComparator.CompareObjects(a, b); this.gridResults.ItemsSource = results.Results; this.gridResults.Columns[1].Visibility = Visibility.Hidden; break; case MessageBoxResult.No: return; case MessageBoxResult.Cancel: return; } }