private void BomTwoButton_Click(object sender, RoutedEventArgs e) { Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.DefaultExt = ".xls"; dlg.Filter = "BOM File|*.xls;*.csv;*.txt|All Files|*.*"; dlg.Title = "Load BOM File #2"; bool?result = dlg.ShowDialog(); if (result == true) { if (BomTwo != null) { BomTwo = null; } BomTwo = new BeiBOM(dlg.FileName); if (BomTwo.IsValid == false) { MessageBox.Show("Invalid BOM"); tbBom2FileName.Text = "File: "; tbBom2FileName.ToolTip = ""; tblkAssemblyTwo.Text = "Assembly: "; tblkAssemblyTwo.ToolTip = ""; tblkBom2Rev.Text = "Rev: "; tblkBom2Date.Text = "Date: "; BomTwo = null; return; } tbBom2FileName.Text = "File: " + BomTwo.FileName; tbBom2FileName.ToolTip = BomTwo.FullFilePath; tblkAssemblyTwo.Text = "Assembly: " + BomTwo.AssemblyName; tblkAssemblyTwo.ToolTip = BomTwo.AssyDescription; tblkBom2Rev.Text = "Rev: " + BomTwo.Rev; tblkBom2Date.Text = "Date: " + BomTwo.DateOfListing; } }
private int GetPartCount(BeiBOM bom) { int count = 0; HashSet <string> PartsList = new HashSet <string>(); foreach (var entry in bom.Bom) { PartsList.Add(entry.Value.Item1); } count = PartsList.Count; return(count); }
public BOMComparer(BeiBOM bomOne, BeiBOM bomTwo) { ThisProgram = Assembly.GetEntryAssembly(); ThisProgramName = ThisProgram.GetName(); ThisProgramVersion = ThisProgramName.Version; BomOne = bomOne; BomTwo = bomTwo; BomOnePartsAndRefs = PopulatePartsAndRefs(BomOne); BomTwoPartsAndRefs = PopulatePartsAndRefs(BomTwo); InBomOneButNotInBomTwo = new SortedDictionary <string, List <string> >(); InBomTwoButNotInBomOne = new SortedDictionary <string, List <string> >(); }
public BomCompareWindow() { BomOne = null; BomTwo = null; InitializeComponent(); InitializeThemeColors(); try { ThemeManager.ChangeTheme(Application.Current, themes[themenum]); BorderBrush = Application.Current.FindResource($"StatusBar{borderBrushes[borderbrushnum]}BrushKey") as SolidColorBrush; SetBrushes(themes[themenum]); } catch (Exception) { MessageBox.Show("Error setting window skin.\nMainWindow()->ThemeManager.ChangeTheme())"); } }
private SortedDictionary <string, List <string> > PopulatePartsAndRefs(BeiBOM bom) { SortedDictionary <string, List <string> > PartsAndRefs = new SortedDictionary <string, List <string> >(); AlphanumComparator AlphaNumCompare = new AlphanumComparator(); foreach (var entry in bom.Bom) { if (PartsAndRefs.ContainsKey(entry.Value.Item1)) { PartsAndRefs[entry.Value.Item1].AddRange(entry.Value.Item4.Split(',').ToList()); PartsAndRefs[entry.Value.Item1].Sort(AlphaNumCompare); } else { PartsAndRefs.Add(entry.Value.Item1, entry.Value.Item4.Split(',').ToList()); PartsAndRefs[entry.Value.Item1].Sort(AlphaNumCompare); } } return(PartsAndRefs); }