예제 #1
0
        private void btnCompareToBinary_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            // compare to other binary file(s)!
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = "Trionic 5 binary files|*.bin";
            ofd.Multiselect = true;
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                if (ofd.FileNames.Length > 1)
                {
                    // bekijk het verschil voor alle geselecteerde bestanden en laat dit zien in een
                    // symbolcompareselector
                    DevExpress.XtraBars.Docking.DockPanel dockPanel = dockManager1.AddPanel(new System.Drawing.Point(-500, -500));
                    CompareResultSelector tabdet = new CompareResultSelector();
                    tabdet.onFileSelect += new CompareResultSelector.NotifySelectFile(tabdet_onFileSelect);
                    tabdet.Dock = DockStyle.Fill;
                    dockPanel.Controls.Add(tabdet);
                    System.Data.DataTable dt = new System.Data.DataTable();
                    dt.Columns.Add("FILENAME");
                    dt.Columns.Add("PARTNUMBER");
                    dt.Columns.Add("SOFTWAREID");
                    dt.Columns.Add("NUMBEROFSYMBOLS", Type.GetType("System.Int32"));
                    dt.Columns.Add("FULLFILENAME");
                    int numberofsymbols = 0;

                    foreach (string filename in ofd.FileNames)
                    {
                        Trionic5Tools.SymbolCollection compSymbols = new Trionic5Tools.SymbolCollection();
                        AddressLookupCollection compAddressLookup = new AddressLookupCollection();

                        CompareSymbolTableToFile(filename, compSymbols, compAddressLookup, out numberofsymbols);
                        dt.Rows.Add(Path.GetFileName(filename), "", "", numberofsymbols, filename);
                    }
                    tabdet.SetData(dt);

                    dockPanel.Text = "Compare list: " + Path.GetFileName(m_trionicFileInformation.Filename);
                    bool isDocked = false;
                    foreach (DevExpress.XtraBars.Docking.DockPanel pnl in dockManager1.Panels)
                    {
                        if (pnl.Text.StartsWith("Compare list: ") && pnl != dockPanel && (pnl.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible))
                        {
                            dockPanel.DockAsTab(pnl, 0);
                            //pnl.Options.ShowCloseButton = false;
                            isDocked = true;
                            break;
                        }
                    }
                    if (!isDocked)
                    {
                        dockPanel.DockTo(dockManager1, DevExpress.XtraBars.Docking.DockingStyle.Left, 1);
                        dockPanel.Width = 700;
                    }

                }
                else if (ofd.FileNames.Length == 1)
                {
                    CompareToFile((string)ofd.FileNames.GetValue(0));
                }
            }
        }
예제 #2
0
 void tabdet_onFileSelect(object sender, CompareResultSelector.SelectFileEventArgs e)
 {
     CompareToFile(e.Filename);
 }